Skip to content

Commit

Permalink
language fix
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Jul 24, 2024
1 parent cca4563 commit 975b409
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

0 comments on commit 975b409

Please sign in to comment.