Jump to: navigation, search

Scout/Concepts/Text Provider Service

Wiki Home

Text Provider Services are services responsible to provide localization for texts in the user interface. A typical application contains a such service contributed by the Shared Plug-In.

  • implements: I obj.pngITextProviderService
  • extends: C obj.pngAbstractDynamicNlsTextProviderService (default, translations are stored in properties files)


Using Text Provider Services developers can decide to store the translations in a custom container like a database or XML files. Furthermore using TextProviderServices it is very easy to overwrite any translated text in the application (also texts used in Scout itself) using the service ranking.

The mechanism is aligned with the icon retrieval which is also managed using Icon Provider Services.

Localization using .properties files

By default the internationalization mechanism relies on .properties files using a reference implementation of the TextProviderServices:

Service extending the C obj.pngAbstractDynamicNlsTextProviderService class.

A Text Provider Service working with the default implementation need to define where the properties files are located. This is realized by overriding the getter getDynamicNlsBaseName(). Here an example:

  protected String getDynamicNlsBaseName() {
    return "resources.texts.Texts";

If configured like this, it means that the .properties files will be located in the same plug-in at the location:

  • /resources/texts/Texts.properties (default)
  • /resources/texts/Texts_fr.properties (french)
  • /resources/texts/Texts_de.properties (german)
  • ... (additional languages)

If you decide to store your translated texts in .properties files, you migth want to use the NLS Editor to edit them.

You need to respect the format defined by the Java Properties class. In particular the encoding of a .properties file is ISO-8859-1 (also known as Latin-1). All non-Latin-1 characters must be encoded. Examples:

 'à' => "\u00E0"
 'ç' => "\u00E7"
 'ß' => "\u00DF"

The encoding is the "Unicode escape characters": \uXXXX where XXXX is a hexadecimal id of the character in the Unicode character table. Read more on the .properties File on wikipedia.

See Also