Java:如何强制本地化 swt FileDialog
我会将 FileDialog 组件本地化为英语。我的默认语言是意大利语。 是否可以?
我使用 FileDialog 的项目是一个 Eclipse 插件项目。
我找到了仅适用于 JFileChooser 组件的解决方案,并且它有效。
先感谢您。
I would localize a FileDialog component in English. My default language is Italian.
Is it possible?
The project where I'm using the FileDialog is an Eclipse plug-in project.
I've found the solution only for JFileChooser
components and it works.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原始答案中的信息已过时。请向下滚动到编辑 2。
我的理解是 SWT 正在调用一些操作系统 API 来显示常见对话框(FileDialog 就是其中之一)。因此,它将始终以当前操作系统语言或当前用户为 MUI 系统选择的语言显示。
如果我的理解是正确的(我坚信如此),那么根本没有办法将其本地化。
编辑(贾雷克发表评论后):
看来我错了。 此页面(向下滚动到国际化)显示:
这意味着它应该是可本地化的。但这并不意味着它是本地化的。另一句话:
这是否意味着它已本地化为德语和日语?我不知道。 Mac 平台上的 Swing 就是这样(我不确定现在是否还一样)。
然而,这意味着本地化至少应该是可能的。
编辑2(当前的事态)
如果一开始就是这种情况我就不能(我不这么认为),但现在你所要做的就是 使用语言包:
只需在类路径上放置一个或多个语言包就足以翻译 FileDialog。如果是意大利语和其他少数语言,则为 NLpack1。对于波兰语、匈牙利语、捷克语和俄语,则为 NLpack2< /a>.
原始信息似乎是错误的,抱歉(感谢 Jarek 的质疑,它应该提高这个答案的质量)。
The information in original answer is outdated. Please scroll down to Edit 2.
My understanding is that SWT is calling some Operating System API to display common dialogs (FileDialog be one of them). Therefore it will always show up in the current OS language or current user selected language for MUI systems.
If my understanding is correct (and I strongly believe so), there is simply no way to localize that.
Edit (after comment from Jarek):
It seems that I was wrong. This page (scroll down to Internationalization) says:
That means it should be localizable. But it does not mean it is localized. Another quote:
Does it mean it is localized into German and Japanese? I don't know. That was the case with Swing on Mac platform (I am not sure if it still remains the same).
However, that means that localization should be at least possible.
Edit 2 (current state of affairs)
I can't if it was the case in the first place (I don't think so), but nowadays all you have to do is to use language pack:
Just placing one or more language packs on your class path should be enough to have FileDialog translated. In case of Italian and few others it would be NLpack1. For Polish, Hungarian, Czech and Russian it would be NLpack2.
Original information just seems to be wrong, sorry (and thank you Jarek for your doubts, it should improve the quality of this answer).