Location of Resource Bundles

The translations used by the PMO NLS service must be located in the project’s resource folder, mirroring the path of the used PMO. For example:

Figure 1. An example of a NLS folder structure

In this example, NLS Strings in org.linkki.samples.binding.pmo.ButtonsSectionPmo that need to be translated must be defined in

These .properties files contain messages in text form, each file represents one supported language for the PMOs in the same folder. It’s important that these files share the base name linkki-messages. A file with the base name has to be present in the resource folder and acts as fall back option if no specific .properties file is found for a locale. You can support as many languages as you want by simple adding another .properties file to the resource folder, its name consisting of the base name and the language code separated by _. As shown in the example above, the German translations are represented by the file Note that each of these files has to contain the same items, but translated for the language they represent.

Predefined Key Structure for linkki PMO

An entry for a translation in the files consists of two parts: The "key" that identifies a localizable aspect of a PMO property and the text, seperated by =. The key is a String that consists of the PMO’s class name, the name of the PMO property and the localizable aspect of the property, separated by _. The file from the picture above looks like this:

ChildrenSectionPmo_noOfChildren_label=Number of children
ContactSectionPmo_favorite_caption=Add to favorites
ContactSectionPmo_countryOfBirth_label=Country of Birth

The last entry of the above .properties file points to the PMO ContactRowPmo, and provides an English translation for the label of its property name:

    @UITableColumn(flexGrow = 10)
    @UILabel(position = 10, label = "Name")
    public String getName() {
        return contact.getName();
linkki always tries to retrieve a value from the, if the file exists. That means that the label "Name" that is defined directly in the annotation @UILabel above will not be used in this constellation. The entry ContactRowPmo_name_label=name overrides it as default value if there is no specific .properties file for the user’s locale. It is useful to include the default label in the annotation to avoid having to look it up in the properties file when viewing the source code.

Translatable PMO Properties

All aspects containing String values can be translated. Frequently used examples are label, caption and toolip. Section captions can also be translated. Their key does not contain a property name but only the PMO’s class name and "_caption". For example:

@UISection(caption = "Children", closeable = true)
public class ChildrenSectionPmo {

With its German translation entry in