As a feature of ProcessMaker version 3.0, the Dynaforms created inside the designer have multi-language support. Now, designers have the ability to download a .po file with the labels used inside the Dynaform and make its corresponding translation to any language. The translation can be used later inside the same form without having to create a new form for each language.
This option is in the menu of the Dynaform designer at the top right-hand of the window:
Check the following sections to learn how to work Dynaform translations.
Downloading the Translation File of the Dynaform
Everytime a Dynaform is created, the designer generates a .po file that contains the labels of the controls included in the Dynaform, as well as some other labels used in the properties of the controls, such as placeholders, hints and default values.
To download the .po file of the Dynaform, click on the icon in the Dynaform menu and the following modal window will open:
As mentioned before, all Dynaforms are created with English as the default language, so simply click on the name of the language (for English, the name of the file is "English [processmaker.en.po]") and the file will be downloaded automatically.
A .po file have the following characteristics:
The first section contains the following information about the translation file:
The next section have the ID of the control in the
msgid attribute and the label or text of the property in the
msgstr attribute. Check the next section to learn how to make the translation file in another language.
Translating and Creating a .po File
The following Dynaform will be used in this example to elaborate the new translation file.
The controls used in this Dynaform are the following:
- "Employee Information" -> Title
- "Fill the information below" -> Subtitle
- "Employee ID" -> Text Control
- "Employee Name" -> Text Control
- "Employee Last Name" -> Text Control
- "Employee Birth Date" -> Datetime Control
- "Employee Home Address" -> TextArea Control
- "Employee Submit" -> Text Control
The .po file of the Dynaform above is the following:
The translations that are empty ("") are the labels of control properties that have not been set.
Before creating a new translation file, take into account the following points:
- The name of the new .po file must have the following format:
In this example the new file will be named:
- The translation of the label must be made only in the
msgstrattribute. Do not change the
msgidlabel because it is the ID that relates the file translation to the label of the control or property in the Dynaform.
- In the header of the new file, the following attributes must be updated with information about the new language:
Using a Plain Text Editor
Open the .po file in your favorite editor (in this example, gedit was used) and translate all the msgstr strings. Do not forget to update the following properties to the new language.
- "X-Poedit-Language: Español\n"
- "X-Poedit-Language: Español\n"
- "File-Name processmaker.es.po\n"
The new translation file will look like:
When translating the file, take care to NOT change the msgid strings. Each msgid string is the ID of a label that relates the file translation to the label of the control or property in the Dynaform.
Also, make sure that each msgstr is enclosed in double quotes. To use a double quotation mark within a string, precede it with a backslash \" .
Using PO Editor
PO Edit is an easy to use open source program available for Mac OS X, Windows and UNIX/Linux.
Install POedit and click the Edit the translation option to open the "processmaker.en.po" file that was downloaded before.
In the window that will appear, first edit the header information for the PO file by clicking the Fix Language button.
Or by going to Catalog > Properties:
The Catalog properties window will open. Change the language from English to your language (in this example, the language is changed to Spanish), add your name in the Team field and your email address in the Team's email address so people can contact you with revisions and updates about the translation. Finally, set the Charset and Source code charset to UTF-8. Click on OK to save the changes.
PoEdit will display the list of labels, contained in the translation file, ready to be translated in the top box of the window.
Select a phrase, the Source text box will display the original English phrase and the Translation box will display its translation. Translate the phrase in the Translation box from English to your language.
For each line, the user can see translation suggestions in the sidebar of the window. If this sidebar is not displayed by default, go to View > Show Sidebar in the menu.
If you are unsure how to translate a phrase, it is better to leave it blank, rather than use a wrong translation. Another option is to do a preliminary translation of a phrase, but indicate that the phrase needs to be reviewed in the future by clicking the Fuzzy icon in the toolbar. The text will be painted in yellow indicating the next translator that the translation of that line needs to be reviewed.
Once done, save the new translation file as:
Where <LANGUAGE> is the two letter 639-1 ISO language code. The language code for the Spanish language is
es, therefore the new file will be named "processmaker.es.po".
Uploading the Translation
To upload the translation file to the Dynaform, click on the icon in the menu of the Dynaform. In the Languages window click on the Choose File button to upload the .po file.
The new translation file will be uploaded to the Dynaform and listed in the panel, as shown in the image below:
To remove the translation file from the Dynaform, click on the Delete button at the right side of the name of the file.
Reviewing the Dynaform Language
Then, go to the preview mode of the Dynaform by clicking to the Preview button
Changing the Dynaform Language in the URL
The current system language (which is specified in the URL) is automatically selected when loading the Dynaform if there is a .po file available for that language. Otherwise, the DynaForm displays the field labels in the definition of the Dynaform.
Therefore, if the user logs into ProcessMaker with the English language, the Dynaform will be displayed using the English translation file.
If the user switchs the language to Spanish, the DynaForm will select the Spanish translation file automatically and all its labels will be translated.
It is not necessary to logout and login just to change the language of the ProcessMaker interface. At any time, the user can simply edit the language code in the URL. To do so, go to the web browser's location bar and edit the URL. Then, refresh the web browser screen by pressing ENTER in the location bar or pressing CTRL+R, so the new language will be displayed.