问题
I got a strange case going on. My app has 4 language supports: English, Turkish, Russian & Ukrainian. I got the following resource folders:
I got Turkish translation on values, so default will be Turkish if it fails to find the translation of any string.
Below you can see there are no keys needing translation:
Okay so, as far as I know, when I change the phone language, it should use corresponding strings.
When I make phone language Turkish:
Great. Now, English:
Works too. Now Russian:
Ugh.
So Turkish and English are working, but making phone language Russian or Ukrainian does not.
There is no manual setting for locale anywhere in the app. When I call
getResources().getConfiguration().locale
or
getResources().getConfiguration().getLocales()
I get correct locale, "ru_RU".
Is there something I'm missing here ? What might cause this problem ?
回答1:
I found the problem, it was resConfigs in build.gradle. My config was
resConfigs "en", "tr"
so it was not compiling ru & uk resources. Adding "ru" & "uk" solved the problem. Final line looks like this:
resConfigs "en", "tr", "ru", "uk"
来源:https://stackoverflow.com/questions/42361243/application-fails-to-read-strings-from-localized-folders