Reputation: 61
I have a problem with internationalization (I18n).
I have followed almost all the tutorials I could find , I have created a message.java file , message_en.properties , and message_de.properties, but the problem is I don't know what to write inside my main class to call the budles.
I mean when I click on a button , my plugin language should change from English to German.
What should I do ?
Upvotes: 0
Views: 684
Reputation: 382160
You can't have a button that changes the languages instantly, a restart is needed for the plugin to reload the bundles.
Changing the locale programatically isn't easy. The simplest way seems to be to change the yourproduct.ini
file (or config.ini
in your plugin) in order to change the language. For example :
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
-nl
it
-vmargs
-Xmx1024m
-Xms412M
The important config is -nl it
(for Italian here). You need to restart Eclipse/your product after that of course.
Here's the most complete tutorial I know regarding i18n in RCP applications : http://www.vogella.com/articles/EclipseInternationalization/article.html#i18n_osgi
Upvotes: 3