Android模拟器正确显示希伯来语资源,但设备不 [英] Android emulator displays Hebrew resources correctly but device doesn't

查看:164
本文介绍了Android模拟器正确显示希伯来语资源,但设备不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要支持希伯来语资源,我的应用程序(默认为英文)。
我分配希伯来资源下的RES /值-IW / strings.xml中,并在模拟器中进行了测试。效果还不错 - 仿真语言切换到希伯来文后,我看到了我的应用程序希伯来串

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.

问题是,它并没有设置设备语言希伯来语后,我的设备(三星Galaxy S2)现身。我不断看到的英文字符串。

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.

任何想法如何解决呢?

谢谢!

推荐答案

尝试从加入你的资源的副本的 RES /值-IW / 的中的 RES /价值观,他/ 的,对于相同的 RES / XML的他/ 的等如果需要的话。

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

看上去,三星Galaxy S2的操作系统处理希伯来语言环境和资源,不同于其他Android设备。 Android使用的语言codeIW希伯来语为传统设备的兼容性,而三星显然改变了它使用的语言code他,这是根据ISO 639-1不兼容,但可以说是正确的。请参见 Android的问题3639 更多的背景信息。

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.

的效果是,在资源的 RES / * - IW / 的没有被装上受影响的三星设备,而解决办法是在的 RES /添加副本* - 他/

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/.

要确认,试试这个:

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

这应该打印正常的Andr​​oid设备IW,和他在Galaxy S2,以עברית作为两者的显示语言。我不能这个自己测试,由于不拥有受影响的设备。

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.

请参阅黑客的键盘问题122 其也受到同样的问题。

See Hacker's Keyboard issue 122 which is also affected by the same problem.

这篇关于Android模拟器正确显示希伯来语资源,但设备不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆