I am trying to translate strings.xml for Serbian latin (srpski) and Montenegro (both Cyrillic and Latin) . I have included Serbian Cyrillic (српски) in values folder as values-sr. And it works fine. But for Serbian latin & Montenegro, I am unable to decide what should be the name of the values folder.I went through many posts in SO like
How to change locale to use Latin Serbian (instead of Cyrillic Serbian)
What should be the values folder name for Serbian (Latin,Serbia) (sr-rs-latn) language?
but they didnt help much.
I understand from https://github.com/championswimmer/android-locales that values folder should be :
Serbian (Cyrillic) sr --> values-sr-r_#Cyrl
Serbian (Cyrillic,Montenegro) sr ME --> values-sr-rME_#Cyrl
Serbian (Cyrillic,Serbia) sr RS --> values-sr-rRS_#Cyrl
Serbian (Latin) sr --> values-sr-r_#Latn
Serbian (Latin,Montenegro) sr ME --> values-sr-rME_#Latn
Serbian (Latin,Serbia) sr RS --> values-sr-rRS_#Latn
But if I try to create a folder like values-sr-rRS_#Latn in Android studio, it throws error "Invalid directory". Then I started some analysis.
In Nexus 9 Marshmallow, list of available locales using Locale.getAvailableLocales() lists all the serbian languages. So they are supported.
sr
sr__#Cyrl
sr_BA_#Cyrl
sr_ME_#Cyrl
sr_RS_#Cyrl
sr_XK_#Cyrl
sr__#Latn
sr_BA_#Latn
sr_ME_#Latn
sr_RS_#Latn
sr_XK_#Latn
In Settings screen of Nexus 9, I can see option to only change to Serbian Cyrillic(српски) whereas in a Lenovo Yoga tab, I see option to change to only Serbian latin(srpski). When I debugged in both the devices, I found that both have sr as the language code and RS as the region code and the script code was blank. So how to include both values folder in app and how its mapped?
Should I create values folder like values-sr-ZZ or something for the languages I need and in code check for the script code?
But if that's the case, in resources folder of Google Play Games and Settings app I found that they have only one values-sr folder. So how do they handle values-sr-r_#Latn and values-sr-rME_#Latn and values-sr-rME_#Cyrl.
Can anyone please guide me ?
I have just successfully used:
values-b+sr+Latn
Also see Android build error for values-b+sr+Latn if you can't get past Invalid directory issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With