Quick Steps for Internationalization:
- Setup Policy class
- Copy a Policy class from another plug-in. (Note that some Policy's have an initAction method that depends on Images. If you don't want to bring Images along, you can remove this method.)
- In your Plugin class's start() method, call Policy.localize, passing the path to the properties file. For example:
Policy.localize("an.example.plugin.messages");
- In your Plugin class's stop() method, call Policy.cleanup().
- Hunt down Strings that need to be externalized. Two ways to do this:
- Under compilation preferences, turn on Externalize Strings as a warning or error, and then look for them in the Problems view.
- To externalize the string, replace the string with a call to Policy.bind("example.key"), and then place //$NON-NLS-1$ at the end.
- Alternatively, you can use the Externalize Strings tool. Right click on your package and select source code -> find strings to externalize.
- You need to configure wizard setup first though:
- Select Configure
- Change class name to point to your plugin's Policy class
- Change substitution pattern to be:
- and under Propert file location and name, change Package to be where you specified the location of messages.properties in your Plugin's start method.
- Note: You need to reconfigure the wizard every time you run it.
- Follow the wizard's instructions from there.
To internationalize your plugin.properties files, see Plugin Internationalization
|