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 the 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 at the top of the Dynaform designer, in the right-hand corner of the window.
Read the following sections to learn how to use Dynaform translations.
Downloading the Translation File of the Dynaform
Every time 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 lists the ID of the control in the
msgid attribute and the label or text of the property in the msgstr attribute.
Read the next section to learn how to make a translation file in another language.
Translating and Creating a .po File
The following Dynaform will be used in this example to demonstrate how to create a 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 connected to 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 translation file 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 NOT to change the msgid strings. Each msgid string is the ID of a label that relates the translation file 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 "\" .
Poedit is an easy-to.use open source translation editor available for Mac OS X, Windows and UNIX/Linux.
Install Poedit and click the Edit a translation option to open the "processmaker.en.po" file that was downloaded before.
In the window that will appear, click on the Fix Language button in the header that appears to change the language of the translation.
Or by going to Catalog > Properties:
The Catalog properties window will open. Change the language from English to the target 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 in the translation file ready to be translated in the top box of the window.
Select a phrase, then the Source textbox will display the original English phrase and the Translation box will display its translation. Translate the phrase in the Translation box from English to the target 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.
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 yellow, indicating to 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 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 original design 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 switches 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 log out and log in again 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 navigation bar and edit the URL. Then, refresh the web browser screen by pressing ENTER in the navigation bar, or pressing CTRL+R to display the new language in the Dynaform.