更改 BlackBerry 区域设置
我需要在我的应用程序中在阿拉伯语和英语之间切换“定位”。
我有以下代码来切换区域设置:
if (Locale.getDefault() == Locale.get(Locale.LOCALE_ar, null)) {
Locale.setDefault(Locale.get(Locale.LOCALE_en, null));
} else {
Locale.setDefault(Locale.get(Locale.LOCALE_ar, null));
}
在我的应用程序中,我有以下资源文件:
- appName.rr
- appName.rrc
- appName_ar.rrc
- appName_en.rrc
我有一个使用本地化字符串的按钮,如下所示:
subscribeButton = new ButtonField(res.getString(LANG), ButtonField.CONSUME_CLICK);
我的问题是当区域设置更改为阿拉伯语,UI 翻转(阿拉伯语从右到左),再次切换为英语会再次翻转,但按钮中的文本都没有改变。请指导我做错了什么。
I need to switch Locate in my app between Arabic and English.
I have the following code to switch locale:
if (Locale.getDefault() == Locale.get(Locale.LOCALE_ar, null)) {
Locale.setDefault(Locale.get(Locale.LOCALE_en, null));
} else {
Locale.setDefault(Locale.get(Locale.LOCALE_ar, null));
}
And in my app I have the following resource files:
- appName.rrh
- appName.rrc
- appName_ar.rrc
- appName_en.rrc
And I have a button which uses a localized string as follows:
subscribeButton = new ButtonField(res.getString(LANG), ButtonField.CONSUME_CLICK);
My problem is when the locale is changed to Arabic, the UI flips (Arabic is right to left), and switching it again to English flips it again, but all without the text in the button changing. Please guide me on what I'm doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为,您已经使用与该区域设置相关的文本创建了按钮字段。一旦区域设置发生变化,您将必须将按钮字段文本重新设置为
Its because, you have created the button field with the text which was relevant for that locale. Once the locale changes, you will have to re set the buttonField text as