Translate Form
This action translates all strings on a form to the selected language. Translation file that contains strings in source language and translated strings is mandatory for this action. If you have to create a new translation file, follow the formatting rules below.
About group identifies the selected action.
- Name: allows you to define a custom action name. This makes actions easily recognizable on the solution's list of actions. By default, the action name is taken from its type.
- Description: custom information about the action. Enter a description to explain the purpose and role of action in a solution.
- Action type: read-only information about the selected action type.
Translate form settings group selects language and selects or creates a new translation file.
-
Language: language to be used on the translated form. The language name is defined in the first row of the translation file.
Tip
The language name in the translation file is user-configurable. Use the same ID (name) in the action as you have defined in the translation file. The language name can be fixed or variable. Its usage depends on the language selection type you that is used on the form.
Fixed name: hard-coded language name which must match the name in the first row of the translation file.
Variable name: Example is a drop-down box with language names. When the user changes the language in the list, the onChange event executes the Translate Form action. The drop-down box saves the user selection in a variable, which is used for the action.
-
Translation file: file that contains source strings and translations into various languages. This is a structured text file, similar to a CSV file.
-
Create translation file: click this button to create the translation file containing the source and translated strings.
Translation File Structure: a text file with UTF-8 encoded data. It is similar to comma-separated-values (CSV).
Formatting Rules are mandatory. Always follow the below listed rules.
-
The first line contains language ID.
-
The first field is always named as Source. Do not change it.
-
The names of other fields in the first row are user-configurable. Use the suggested names, such as "Language 2" and "Language 3", or replace them with whatever describes the language better, such as "German", "French", "Chinese", etc.
-
All lines that follow the first line are lines with the translations from the original language. The first field contains the original string, the next fields in the same line contain translation to other languages. The first line specifies in which order the translation should follow the source string.
-
All values are enclosed with double-quote characters (").
-
All values are delimited by a semicolon character (;).
-
If you have multiline text objects in the form, the newline (<CR><LF>) will be encoded as special string $NEWLINE$.
-
If you leave the translation empty, the Source string is used.
Example of Translation File:
Source";"DE" "&Print";"&Druck" "Customize$NEWLINE$your$NEWLINE$printing$NEWLINE$forms";" Anpassen$NEWLINE$Sie$NEWLINE$Ihre$NEWLINE$Druckformen" "Printer:";"Drucker" "Quantity";"Menge" "SAMPLE";"PROBE" "Se&ttings";"Einstellungen" "Translate";"Übersetzen" "www.loftware.com/solutions";""
Translating Strings
When using the Translate Form action anywhere in your form, all strings of the form are automatically saved to the translation file whenever you save the form. This ensures that the translation file is always up to date with your form.
The translation file is Unicode-aware text file. You can edit it in any text editor, but you might have troubles recognizing the fields, because their values are semicolon-separated and not aligned one below another.
You can also open the file in a spreadsheet application, such as Microsoft Excel. In this case, the fields belonging to particular language are displayed in the same column of data, and much easier to edit.
Note
Spreadsheet applications might change the input file structure of the translation file. In this case, reformat the data by yourself after you save the translation file.
Example 94. Example
Microsoft Excel will save the translation file as CSV. The fields lose the double quotes around the values and will be delimited by comma (,) instead of semicolon (;). You will have to convert commas into semicolons and put double quotes around fields. This can be done with a few search & replace actions.
Translating Label Values in a Solution
Forms sometimes display values that come from labels in the same solution document. The Translate Form action does not translate these label values automatically because you have to manually add them to the translation file.
Add label values to the translation file using the same formatting rules as described above.
Example 95. Example
Your solution contains one form and one label. The form includes Data Initialization object for assigning values to the label variables. You want to display the originally English form in German language using the Translate Form action (i.e. by clicking a button on the form).
Original prompt text for variables is "Define variable value"
. To display German translation, add this line to the translation file: "Define variable value";"Definieren Sie den Variablenwert";
After you click the button with assigned Translate Form action, the prompt text appears in German.
Action Execution and Error Handling
Each action can be set as a conditional action. Conditional actions only run when the defined conditions allow them to be run. To define these conditions, click Show execution and error handling options.
Execution options are:
- Enabled: specifies if the action is enabled or disabled. Only enabled actions will execute. This functionality may be used while testing a form.
- Condition: defines one-line programming expression that must provide a Boolean value (true or false). When the result of the expression is true, the action will execute. Condition offers a way to avoid executing actions every time.
Error handling options are:
- Ignore failure: specifies whether an error should be ignored. If enabled, the execution of actions continues even if the current action fails.
Note
Nested actions that depend on the current action do not execute in case of a failure. The execution of actions continues with the next action on the same level as the current action. The error is logged but does not break the execution of the action.
- Save error to variable: allows you to select or create a variable to save the error to. The same cause of the error is also saved to internal variables ActionLastErrorId and ActionLastErrorDesc.
At the end of printing, you might want to send the status update to an external application using the HTTP Request action. If the printing action fails, action processing stops. In order to execute the reporting even after the failed print action, the Print Label action must have the option Ignore failure enabled.