更改 BlackBerry 区域设置

发布于 2024-12-27 14:44:52 字数 630 浏览 1 评论 0原文

我需要在我的应用程序中在阿拉伯语和英语之间切换“定位”。

我有以下代码来切换区域设置:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃不饱 2025-01-03 14:44:52

这是因为,您已经使用与该区域设置相关的文本创建了按钮字段。一旦区域设置发生变化,您将必须将按钮字段文本重新设置为

subscribeButton.setLabel(res.getString(LANG));

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

subscribeButton.setLabel(res.getString(LANG));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文