mirror of
https://github.com/markusfisch/BinaryEye.git
synced 2024-09-20 12:02:17 +02:00
Fix creating Locale from resource format
Locale() requires the country part as secondary argument and can't use the resource format "lang-country" directly.
This commit is contained in:
parent
6347bd568c
commit
d890bf28fa
@ -6,7 +6,12 @@ import java.util.*
|
||||
|
||||
fun Context.applyLocale(localeName: String) {
|
||||
if (localeName.isNotEmpty()) {
|
||||
val locale = Locale(localeName)
|
||||
val localeParts = localeName.split("-")
|
||||
val locale = if (localeParts.size == 2) {
|
||||
Locale(localeParts[0], localeParts[1])
|
||||
} else {
|
||||
Locale(localeName)
|
||||
}
|
||||
Locale.setDefault(locale)
|
||||
val conf = resources.configuration
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
<item>Turkish</item>
|
||||
<item>Ukrainian</item>
|
||||
<item>Chinese</item>
|
||||
<item>Chinese (Simplified Han,China)</item>
|
||||
<item>Chinese (Simplified Han, China)</item>
|
||||
<item>Japanese</item>
|
||||
<item>Czech</item>
|
||||
</string-array>
|
||||
|
Loading…
Reference in New Issue
Block a user