Reputation: 181
I want to support Hebrew resources in my App (default is English). I assigned the Hebrew resources under "res/values-iw/strings.xml" and tested it in the emulator. The results were good - after switching the emulator language to Hebrew I saw the Hebrew strings in my App.
The problem is that it didn't show up in my device (Samsung Galaxy S2) after setting the device language to Hebrew. I kept seeing the English strings.
Any ideas how to solve it?
Thanks!
Upvotes: 4
Views: 1665
Reputation: 356
Try adding a duplicate copy of your resources from res/values-iw/ in res/values-he/, same for res/xml-he/ etc. if needed.
It appears that the OS of the Samsung Galaxy S2 handles the Hebrew locale and resources differently than other Android devices. Android uses language code "iw" for Hebrew for legacy compatibility, while Samsung apparently changed it to use language code "he", which is arguably correct as per ISO 639-1 but incompatible. See Android issue 3639 for more background information.
The effect is that the resources in res/*-iw/ aren't being loaded on the affected Samsung devices, and the workaround is to add a duplicate copy in res/*-he/.
To confirm, try this:
Locale loc = new Locale("iw");
Log.i(TAG, "locale language: " + loc.getLanguage());
Log.i(TAG, "display language: " + loc.getDisplayLanguage());
This should print "iw" on normal Android devices, and "he" on the Galaxy S2, with "עברית" as the display language for both. I couldn't test this myself due to not owning an affected device.
See Hacker's Keyboard issue 122 which is also affected by the same problem.
Upvotes: 4
Reputation: 11230
Is the emulator Android version same as Samsung Galaxy S2 version?
Try to find out locale language and Country which you get after shifting to Hebrew on the device. Perhaps it is not iw.
String lang = Locale.getLocale().getDisplayLanguage();
String country = Locale.getLocale().getDisplayCountry();
Upvotes: 1