I recently added an en-rZA
, zu
and xh
strings file to my Android application, for users from South Africa.
Each of these files contain a single translation.
This translation seems to work as expected when I am running my application on an emulator (I am from the UK, therefore I see default string) but users reported that when using the application on non-emulated devices, they are seeing the South African translation.
When debugging, I noticed that this is specifically caused by the en-rZA
strings file, and the zu
and xh
strings files translate as and when expected (I changed the value in each and re-ran the app to determine where the issue was coming from).
My devices locale shows up in the debugger as en_UK, and then proceeds to show the en-rZA
translation.
A workaround I am currently using is to introduce an en_rGB
strings file with the correct translation, but it doesn't make sense to me that I should need to do this.
What is causing this mis-translation, am I missing something?
Thanks
This is the expected (although surprising) behaviour starting with Android N according to https://stackoverflow.com/a/45512903/766024 and https://issuetracker.google.com/issues/64429534?pli=1
The solution is to duplicate values/strings.xml
in values-en/strings.xml
or values-b+en+001/strings.xml