mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
language fix
This commit is contained in:
parent
cca45639c6
commit
975b409023
2 changed files with 7 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.extensions
|
|||
|
||||
import android.content.res.Resources
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.common.habitica.helpers.LanguageHelper
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
|
|
@ -173,7 +174,7 @@ fun Duration.getMinuteOrSeconds(): DurationUnit {
|
|||
}
|
||||
|
||||
fun Date.formatForLocale(): String {
|
||||
val locale = Locale.getDefault()
|
||||
val locale = LanguageHelper.systemLocale
|
||||
val dateFormatter: DateFormat =
|
||||
if (locale == Locale.US || locale == Locale.ENGLISH) {
|
||||
SimpleDateFormat("M/d/yy", locale)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ class LanguageHelper(languageSharedPref: String?) {
|
|||
companion object {
|
||||
// Intentional, we want the system locale, not the app locale
|
||||
@SuppressLint("ConstantLocale")
|
||||
val systemLocale = Locale.getAvailableLocales().firstOrNull() ?: Locale.getDefault()
|
||||
val systemLocale: Locale
|
||||
|
||||
init {
|
||||
systemLocale = Locale.getDefault()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue