I would localize a FileDialog component in English. My d开发者_Go百科efault 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.
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:
The Eclipse SDK is designed as the basis for internationalized products. The user interface elements provided by the Eclipse SDK components, including dialogs and error messages, are externalized. The English strings are provided as the default resource bundles.
That means it should be localizable. But it does not mean it is localized. Another quote:
German and Japanese locales are tested.
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:
java -Duser.language=fr -Djava.library.path=C:\MyApp -classpath C:\MyApp\swt.jar;C:\MyApp\swt-nl.jar;C:\MyApp\myApp.jar my.org.HelloWorld
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).
精彩评论