In most cases, the native widgets correctly pick up the locale of the machine you are running on and display the translated string provided by the operating system. For example, the FileDialog will have the correct strings for "Open" and "Cancel" if the locale on your machine has been set correctly. However, on some platforms, a native widget may not exist and an emulated widget may be be used. In addition, all custom widgets (org.eclipse.swt.custom) are "emulated". For these widgets, the correct translations need to be provided. To have an SWT application with translated strings for all SWT widgets you need to download the swt-nl.jar and include it on the classpath of your application. For example:
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
IBM has donated translations from their products to Eclipse. These translations are based on the Eclipse 3.2 build but should work with older releases of SWT.
To use the translations, simply download the appropriate language pack and place it on the classpath of your application.
Back to the top