Translating templates
OL Connect has a built-in feature to automatically generate output and previews from one template in different languages, and to pluralize certain words in the output.
When OL Connect generates output or creates a preview for a template, it looks for a translation file that matches the current Locale. If there is one, OL Connect uses it to localize any elements that are tagged for translation, and to pluralize words as indicated.
For this feature to work, a template needs to have:
-
Content that is tagged for translation (see: Tagging elements for translation) and, optionally, pluralization (see Pluralization).
-
One or more translation files (.po). Each file gives translations in one language.
The files that hold the actual translations are not made in the Designer. They can be made in any translation tool that accepts a .pot file as input, and outputs .po files.
-
The .pot file is exported from the Translations pane in the Designer. The file contains a list of texts in the base language. In OL Connect this is the language in which the template was originally written. (A template's language can be set via the Locale Settings dialog.)
-
A .po file holds translated texts for one language. Each .po file has an entry by which OL Connect recognizes the target language.
(See: Exporting and importing translation files.)
These file types are widely used in translation software, so you can team up with a professional translator or translation agency to translate your templates, or you can do it yourself using a free online tool, such as the Poedit software.
Other ways to translate a template
The built-in translation feature is easy to use for labels and short texts in for instance invoices, web forms, transaction email messages, and pack lists. It is less suitable for long texts like insurance policies or terms and conditions.
-
For longer texts it is recommended to use a content management system in combination with scripts.
-
It is also possible to use snippets or separate sections for translation purposes in combination with scripts.
Translating a template
To make use of the built-in translation feature, take the following steps.
-
Tag content for translation. See Tagging elements for translation.
-
Optional: enable the pluralization option on any translation entry that should conform with the number in a certain data field; see Pluralization.
-
Export the entries on the Translations pane to a .pot file. See Exporting a file for translation (.pot).
-
Open the .pot file in a translation tool (e.g. Poedit), translate the texts and/or enter the (text with) plurals.
Or, if you work with a translator or translation agency, send them the .pot file.
The result is a .po file (one per language). -
Import the .po file or files. See Importing translations (.po).
-
Set the template's Locale, or select the field that contains a Locale value, in order to get output in the correct language. See Changing the locale.
Translating snippets
Snippets get translated when they are inserted in the output, if the text is tagged for translation (see Tagging text in snippets).
Translating content that is inserted by a script
Personalization scripts may add content to the output. OL Connect will apply translations to that content at the moment it is added to the template, for example with the html()
or replaceWith()
function. Translations are applied if that content is marked for translation, and if there is a matching translation entry (see Tagging text that is inserted by a script).
Translating content via a script
If a template has been prepared for translation, personalization scripts that add content to the output may translate that content using the translate() function.