4

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!

Noam Behar
  • 201
  • 2
  • 11
  • Did you ever find a solution to localizing drawables the same way? localizing would be costly using the duplication solution... – Zaky German Mar 14 '12 at 18:45

2 Answers2

4

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.

klausw
  • 336
  • 1
  • 4
  • Thanks for your replies. This was tested in API 10 (2.3.3). The functions getDisplayLanguage() and getDisplayCountry() returned the correct values. So are you saying that it is only a S2 problem? I'll go ahead and test it in S1 and some HTC devices. – Noam Behar Jan 03 '12 at 20:35
  • Hi, I checked this issue in several devices - HTC, Galaxy S1, S2. All the devices that have root access can see Hebrew fonts, and all the "pure" devices without a changed ROM can't see Hebrew. Another concern on the same hand is that on all root devices I couldn't see my Ads, and on non-root devices, I saw the Ads – Noam Behar Jan 04 '12 at 20:38
1

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();
Rajdeep Dua
  • 11,190
  • 2
  • 32
  • 22