Create
In our application, we will inevitably encounter internationalization problems, ECLIPSE RCP provides us with a good solution, even in the later batch processing, but if the other plug-ins do not provide the language we need it? How can we provide language packs for them?
A simple example, when you open the dialog box with Messagedialog, the button is generally: Ok,cancel, Yes, no, it is not very authentic in a Chinese system, at present, the class gives us the opportunity to correct at the time of construction, that is, we can pass in the characters that you need to display when you construct, for example:
Messagedialog dialog = new Messagedialog (parent, title, Null,message, question, new string[] {"OK", "Cancel"}, 0);
But for an international system, this is not appropriate, if the future needs of Japanese version/French version of it? Do you still have to change the code?
Other, eclipse can solve the problem with the language pack well, we just need to create the language pack for the specified plug-ins, that is, the application can use the current locale language. We thought that JFace created the Chinese language pack as an example of this process:
1. Create a fragment Project
2. Note In the third step, choose which plug-in you want to create a language pack (red), and select the version to be shown.
3. The project structure is as follows:
Among them, Messages_zh_cn.properties is the jface of the messages.properties part of the translation into Chinese after the native2ascii generated files. Messages.properties can be translated according to their own requirements.
Here is part of my file, and I have only translated a few of these lable:
ok= OK
Cancel= canceled.
Yes= is (&y)
Yestoall= All (&a)
Skip=s&kip
Stop=&stop
Abort=&abort
Retry=&retry
Ignore=&ignore
Proceed=&proceed
Open=&open
Close= Off (&c)
After the conversion of the appearance:
ok=\u786e\u5b9a
Cancel=\u53d6\u6d88
YES=\U662F (&y)
Yestoall=\u5168\u90e8 (&a)
Skip=s&kip
Stop=&stop
Abort=&abort
Retry=&retry
Ignore=&ignore
Proceed=&proceed
Open=&open
Close=\u5173\u95ed (&C)
4, export the project as a deployable package (available through the Export Wizard).
5, put the package into your own RCP plug-in search directory (such as the plugins directory) can be.
6. At this time, you run RCP application in Chinese system, the corresponding dialog box label becomes the label that you translate into
7, need to do other language version, the same process.