Externalize Strings Wizard

The Externalize Strings wizard allows you to refactor a compilation unit such that strings used in the compilation unit can be translated to different languages. The wizard can be invoked on new, unprocessed files, but also modify already translated pages. It also allows you revert changes done by a previous invocation of the wizard.

On the first page of the wizard you can specify how the strings found in the compilation unit should be externalized. It is also possible to internalize strings which have been externalized before.

Field

Description

Use Eclipse's string externalization mechanism

If unchecked the standard externalization mechanism is used, otherwise the new Eclipse string externalization mechanism is used.
Note: This field is only present if the project build path contains the org.eclipse.osgi.util.NLS class.

Enter common prefix for generated keys

Specifies an optional prefix for all newly generated key. A good practice is to use the name of the compilation unit so entries in the property files can easily be grouped.

Strings to externalize

Displays the list of all strings in the file. When non-externalized strings are found, the list ill be filtered to only show the new strings with proposed keys and values. To control this filter, use the checkbox on top of the table.

Externalize

Marks the selected strings to be externalized. Externalized strings will be placed in a property file and the code will be changed to a lookup to the property file.

Ignored

Marks the selected strings to be ignored from externalization. These strings will be marked with a '//$NON_NLS' comment and the compiler will ignore this string when warning about non-externalized strings.

Internalize

Marks the selected strings to be internalized again: This brings the code back in its original state before the externalize wizard was applied: The entry in the property file will be removed, and a '//$NON_NLS' comment will be removed.

Edit...

Opens a dialog for entering a new key.

Context

Displays the occurrence of the string in the context of the compilation unit.

Accessor class

The class used to access the property file. Press Configure... to open the Configure Accessor Class dialog.

Configure Accessor Class

This dialog specifies the name and location of the property file and its accessor class. An accessor class is used to retrieve strings stored in the property file given a key.

Accessor class settings:

Option

Description

Source folder

The source folder to store the accessor class in.

Package

The location for the accessor class.

Class name

The name of the class to access the resource bundle.

Substitution pattern

Specifies the source pattern to replace the string to externalize with.

Property file settings:

Option

Description

Source folder

The source folder to store the property file in.

Package

The location for the property file.

Property file name

The name of the property file.

String externalization
Eclipse string externalization mechanism

Externalizing strings

Source actions