Localization using POT and PO files

October 08, 2018

Manage template localization outside of Dyspatch with POT(Portable Object Template) and PO(Portable Object) files.

What are POT/PO files?

POT (portable object template) and PO (portable object) files make up a text-based file system that is commonly used for localization and is accepted by many translation service providers. Each file will contain a message ID (msgid) and message 'string' (msgstr). A POT file will only contain the untranslated text strings and acts as a template for creating PO files which will contain both the untranslated text strings and the translations.

Example POT Content:

msgid "Hello"
msgstr ""

Example PO Content:

msgid "Hello"
msgstr "Bonjour"

Download the Localization Template POT file

Download a POT file from the Editor

From the Template Editor on the Localizations tab select "Download Localization Template". This will download a POT file containing the content wrapped in {%trans%} {%endtrans%} in the template.

Send the POT file to your localization provider

If your team uses translation service the POT file can be sent to them for localization. Your translation service will use the POT file to create PO files that you can upload to the Editor to create your template's localizations. Skip to Uploading PO files to find out more about uploading PO files from a translation service.

Creating PO Files and adding Translations

For each locale you or your translation service wants to create, a copy of the POT file with the file extension .po will have to be created. We recommend the PO file is named something you will recognize while uploading it to the Template Editor, for example: de_DE.po.

In the PO file translations will be added below the msgid on the line with msgstr.

msgid "Hello"
msgstr "Bonjour"

If any of your msgid’s contain variables, make sure the translated msgstr also includes the exact same variable name. Don’t forget the % at the beginning of the variable and the s at the end.

msgid "Hello %(FirstName)s."
msgstr "Bonjour %(FirstName)s."

Uploading PO files

Upload all your .po files

On the Localization tab click "Create a Localization" and select "Upload multiple localizations".

Select the PO files you've created to upload them all at once.

Assign a locale for each po file

Assign the locale for each PO file and rename the localization if needed. Click "Apply All" to finish creating your new localizations.

View your localizations in the Edtior

You should now have all the localizations you've created available in the Editor. Preview the localizations using device previewsDevice PreviewsPreview an email template on a variety of email clients to make sure template code is working as intended. and publish the template to make the localizations available via the APIApiDyspatch’s ‘Application Programming Interface’ allows developers to programmatically access their organization’s templates from Dyspatch..

Didn't find what you're looking for?

Ask our support team, we're here to help!

Contact Support