Android emulator correctly displays Hebrew resources, but the device does not

I want to support Hebrew resources in my application (English by default). I assigned Hebrew resources in the "res / values-iw / strings.xml" section and tested it in the emulator. The results were good - after switching the emulator language to Hebrew, I saw Hebrew lines in my application.

The problem is that it did not appear on my device (Samsung Galaxy S2) after setting the device language to Hebrew. I continued to see English strings.

Any ideas how to solve it?

Thanks!

+4
source share
2 answers

Try adding a duplicate copy of your resources from res / values-iw / in res / values-he /, the same for res / xml-he / etc, if necessary.

Samsung Galaxy S2 seems to handle Jewish language and resources differently than other Android devices. Android uses the β€œiw” language code for Hebrew for compatibility with older versions, while Samsung seems to have changed it to use the β€œhe” language code, which is possibly correct in accordance with ISO 639-1. but incompatible. See Android 3639 for more details.

The effect is that the resources in res / * - iw / are not downloaded to the affected Samsung devices, and a workaround is to add a duplicate copy to res / * - he /.

To confirm, try the following:

Locale loc = new Locale("iw"); Log.i(TAG, "locale language: " + loc.getLanguage()); Log.i(TAG, "display language: " + loc.getDisplayLanguage()); 

This should print β€œiw” on regular Android devices, and β€œhe” on Galaxy S2, and Χ’Χ‘Χ¨Χ™Χͺ as the display language for both. I could not verify this myself due to the fact that I did not have a damaged device.

See Problem with hacker keyboard 122 , which is also affected by the same problem.

+4
source

Is the Android emulator version the same as the Samsung Galaxy S2 version?

Try to learn the language of the language and the country that you will receive after switching to Hebrew on the device. Perhaps this is not so.

 String lang = Locale.getLocale().getDisplayLanguage(); String country = Locale.getLocale().getDisplayCountry(); 
+1
source

Source: https://habr.com/ru/post/1388915/


All Articles