String Externalization
The Java tools help you to develop applications that can be run on international platforms. An important facet of designing a program for use in different countries is the localization, or externalization, of text that is displayed by the program. By externalizing strings, the text can be translated for different countries and languages without rebuilding the Java program.
The JDT provides the following support for internationalization and string externalization:
- A compiler option lets you mark non-externalized strings as compile-time warnings or errors.
- See the Non-externalized strings option in the Code style section of the
Java > Compiler > Errors/Warnings
preference page.
- Tools that allow you to find strings that have not been externalized.
- A wizard that will guide you through externalizing the strings.
- Tools that help you to find unused and incorrectly used keys for strings located in property files.
Comments can be used to denote strings that should not be externalized and should not result in compile-time warnings or errors. These comments are of form
//$NON-NLS-n$
where n is the 1-based index of the string in a line of code.Additional information about internationalized applications can be found in the following documents:
- http://eclipse.org/articles/Article-Internationalization/how2I18n.html
- http://java.sun.com/docs/books/tutorial/i18n/intro/index.html
Finding strings to externalize
Finding unused and incorrectly used keys in property files
Source menu
Externalize strings wizard
Java compiler preferences