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. The wizard consists of the following pages:

String selection page

This page lets you configure the actions you want the refactoring to perform on the strings found in the file. The actions are applied when finishing the wizard.

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 easely 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 Key...

Opens a dialog for entering a new key.

Context

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

Translation settings page

This page specifies translation specific settings.

Option

Description

Package

Specifies the destination package for the property file.

Property file name

Specifies the property file name.

Create resource bundle accessor class in "package"

If enabled, the wizard creates a class to access the language specific resource bundle.

Class name

The name of the class to access the resource bundle.

Use default substitution pattern

If enabled, the wizard will use default substitution patterns.

Substitution pattern

Specifies the source pattern to replace the string to externalize.

Add import declaration

Specifies additional import declarations. This might be required depending on referenced types by the substitution pattern.

Error page

Displays a list of errors and warnings if any.

Preview page

Displays a preview of the actions which will be performed on 'Finish'.

Related concepts

String externalization
Eclipse string externalization mechanism

Related tasks

Externalizing Strings

Related reference

Source actions