Pluralization

Ideally, in templates with variable data, the text automatically adjusts to numbers in the data. Take for example the following line in a template:
"This order contains @num_products@ product."
In the output, the text "@num_products@" will be replaced with the value of a data field, a number in this case. (See Variable Data.)
The word "product" should only remain the same when the actual number of products is 1:
"This order contains 1 product".
In all other cases it should be changed into "products", e.g.:
"This order contains 10 products".

This topic explains how to make OL Connect dynamically select a singular or plural word, depending on the value of a data field.

Adding plurals

Entering plurals, or text with plurals, is a natural part of the translation process of a template. This process starts by creating translation entries as described in the following topic: Translating templates.

Note that it isn't required to translate the template effectively. You may also create a translation file for the original language of a template and use it just for pluralization by entering plurals only.

To enable pluralization on a translation entry:

  1. Double-click the respective entry on the Translations pane.
  2. Check the Pluralization option.
  3. Select the data field that holds the number.

    Pluralization cannot be based on a data field in a detail table.

  4. Now there are two possibilities:
    • Click OK. Proceed with the translation process after you've created all translation entries and enabled pluralization as needed. For further instructions see Translating templates.
    • Enter the singular and plural and click OK. The entries are stored in the template itself.
      OL Connect will automatically fall back to these entries when there is no translation file (.po) that matches the Locale. The singular is used when the value of the data field is 1, and the plural is used in all other cases.

    In some languages, like Arabic and Polish, words have multiple plurals for use with different numbers. Multiple plurals can only be entered in a translation tool. See Translating templates.