NLS Editor

The NLS Editor allows to edit the different properties files containing the translated text entries. It is a efficient way to edit all the property files for multilingual texts in one go.

Accessing the NLS Editor

Search for the *.nls files in the shared projects. Select Open With  NLS Editor in the context menu

The NLS Editor

The screenshot below shows the opened NLS editor. In the first column the key values are shown that are used in accessing translations through TEXTS.get("key"). The second columns holds the default translations followed by columns holding the translations for other translated languages.

sdk editor nls

Action Buttons

Actions on the top right corner:

icon refresh

Refresh NLS Project

Reload the content of the editor.

icon find obj

Show NLS entry usage

For each row, search in the Java code where the NLS Key is used. Results are displayed in the first column.

icon text add

New entry…​

Opens the New Text Entry Wizard

icon fileadd pending

New language…​

Opens the Add a Language Wizard

icon import

Import…​

Import the NLS entries of an external file

icon export

Export…​

Export the NLS entries to an external file

Import and Export requires additional components.

Hide inherited rows checkbox

On the top of each column, the text fields allow you to filter the entries in the table. With the Reset button on the right you will empty those filters.

The entries in the table can be directly edited by pressing F2 or double-clicking into a text cell.

On each row it is possible to call following context menu:

icon text

Modify Entry

Opens the New Text Entry Wizard

icon find obj

Find references to 'Xxx'

Search in the Java code where the NLS Key is used.

icon text remove

Remove Xxx

Delete the NLS Entry from the files

Default Mapping to Properties Files

The mapping between the properties files is registered in the "Text Provider Service" class. Per default the files follow this pattern: <your application>.shared/src/main/resources/<identifier of the project>/texts/Texts<language>.properties

where:

  • <identifier of the project> is a chain of folders following the same convention as the Java source files with the package name. For example the org.eclipse.contacts.shared project uses org/eclipse/scout/contacts/shared as path.

  • <language> is an identifier of the language and the country. Some possible file names:

    • Texts.properties is the default language

    • Texts_de.properties is for German

    • Texts_fr_BE will be for French in Belgium

Find missing NLS Keys

If NLS keys are used in the code that do not exist in a properties file, an ugly placeholder is displayed to the user. To find such missing translations the Menu Scout → Search missing text keys…​ may be handy. The result is listed in the Eclipse Search view.

The search also takes the scope of each NLS key into account. So that the key is considered to be available there must be a TextProviderService with that key on the classpath of that module.

Reported false positives can be suppressed using the following comment at the end of the corresponding line: NO-NLS-CHECK. Matches on that line are then not reported in future searches anymore.


Go back to the Scout Tooling.

Do you want to improve this document? Have a look at the sources on GitHub.