mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 03:17:13 +01:00
Fix following the system locale
Fixes https://github.com/SchildiChat/SchildiChat-android/issues/157 Change-Id: Idcf4bb84e5a0ec5bcd3d73c81447e13f3fd0e9e3
This commit is contained in:
parent
23a96329d6
commit
3d39699542
@ -33,9 +33,16 @@ class VectorLocaleProvider @Inject constructor(
|
||||
* SharedPref values has been initialized in [VectorLocale.init]
|
||||
*/
|
||||
val applicationLocale: Locale
|
||||
get() = Locale(
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_LANGUAGE_KEY, "")!!,
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_COUNTRY_KEY, "")!!,
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_VARIANT_KEY, "")!!
|
||||
)
|
||||
get() {
|
||||
val followSystemLocale = preferences.getBoolean(VectorPreferences.SETTINGS_FOLLOW_SYSTEM_LOCALE, false)
|
||||
return if (followSystemLocale) {
|
||||
Locale.getDefault()
|
||||
} else {
|
||||
Locale(
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_LANGUAGE_KEY, "")!!,
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_COUNTRY_KEY, "")!!,
|
||||
preferences.getString(VectorLocale.APPLICATION_LOCALE_VARIANT_KEY, "")!!
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user