Correct pt_BR translation

master
wkawecki 2022-04-01 23:58:52 +02:00
rodzic c23c584ad3
commit bcbe36009f
2 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -15,14 +15,14 @@ open class BaseActivity: AppCompatActivity(), Logging {
// get chosen language from preference // get chosen language from preference
val prefs = UIViewModel.getPreferences(newBase) val prefs = UIViewModel.getPreferences(newBase)
val langCode = prefs.getString("lang","zz") val langCode: String = prefs.getString("lang","zz") ?: ""
debug("langCode is $langCode") debug("langCode is $langCode")
if (Build.VERSION.SDK_INT >= 17) { if (Build.VERSION.SDK_INT >= 17) {
val locale = if (langCode == "zz") val locale = if (langCode == "zz")
Locale.getDefault() Locale.getDefault()
else else
Locale(langCode) createLocale(langCode)
config.setLocale(locale) config.setLocale(locale)
if(Build.VERSION.SDK_INT > 24) { if(Build.VERSION.SDK_INT > 24) {
@ -37,4 +37,13 @@ open class BaseActivity: AppCompatActivity(), Logging {
} }
} }
private fun createLocale(language: String):Locale {
var langArray = language.split("_")
if (langArray.size == 2) {
return Locale(langArray[0], langArray[1]);
} else {
return Locale(langArray[0]);
}
}
} }

Wyświetl plik

@ -46,7 +46,7 @@
<item>ht</item> <item>ht</item>
<item>it</item> <item>it</item>
<item>ja</item> <item>ja</item>
<item>ko-rKR</item> <item>ko_KR</item>
<item>hu</item> <item>hu</item>
<item>nl</item> <item>nl</item>
<item>no</item> <item>no</item>