SWT/JFace 相当于 JComponent.setDefaultLocale()?
在 Swing 中,如果我想设置组件使用的默认语言环境,我可以调用 JComponent.setDefaultLocale()
。我想在 SWT/JFace 中执行相同的操作,因此我的 JFace 对话框使用我选择的区域设置来显示“确定”/“取消”按钮等。SWT/JFace API 中是否有我可以调用的等效方法?
我知道我可以调用 Locale.setDefault()
,但我想避免这种情况,因为应用程序的其他部分我需要它作为系统默认区域设置,而不是我的语言环境选择。
In Swing, if I want to set the default locale used by components, I can call JComponent.setDefaultLocale()
. I want to do the same thing in SWT/JFace, so my JFace dialogs use a locale of my choosing to display the OK/Cancel buttons, etc. Is there an equivalent method in the SWT/JFace API that I can call?
I am aware that I could call Locale.setDefault()
, but I would like to avoid this because there are other parts of the application where I need this to be the system default locale, instead of the locale of my choosing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从我在源代码中看到的情况来看 - 特别是
IDialogConstants.OK_LABEL
的值和类似常量的来源 - JFace 完全依赖于默认区域设置 (Locale.getDefault())。直接使用SWT,例如
org.eclipse.swt.widgets.MessageBox
,甚至会忽略Java 默认语言环境并以系统语言环境显示对话框。因此,似乎没有与 JComponent.setDefaultLocale() 等效的 SWT/JFace。From what I've seen in the source code - especially where the values of
IDialogConstants.OK_LABEL
and similar constants originate - JFace completely relies on the default locale (Locale.getDefault()
). Using SWT directly, e.g.org.eclipse.swt.widgets.MessageBox
, will even ignore the Java default locale and display the dialog in the system's locale. So there seem's to be no SWT/JFace equivalent ofJComponent.setDefaultLocale()
.据我所知,您应该能够使用您选择的语言环境:
请检查下载适合您需求的正确 swt-nl 包,有不同的可用...
HTH
杰罗姆
as far as I know you should be able to use the locale of your choice using :
Please check to download the correct swt-nl pack for your needs , different are available ...
HTH
jerome