Translations (Localization)
Digital supports localizing surveys into multiple languages and displaying the appropriate translation based on the user's locale. Localized surveys define a default language for the elements and then any text is translated into as many languages as necessary. A localized survey's structure remains identical for all languages, only the text shown in survey form elements is changed. A single localized survey is preferred over duplicating surveys for each language.
Reporting translations have limitations related to ad hoc fields. See your Digital expert for details.
Use the Digital Command Center to export all of the text strings from a survey in Microsoft Excel or CSV format. This localization file contains a table with the strings required for translation, and the equivalent translated strings are added to a new column in the file. Medallia recommend working with a professional translator when localizing. Import the file with the translated strings back into Digital and the localized survey is immediately available. One major advantage is that the app where Digital is embedded does not need to be changed to add the new language because the survey's FormID remains the same. This simplifies managing surveys, and how they are targeted.
Defining languages
By default, the Digital survey localization feature identifies languages based on IETF language tags in the format language-country, where language and country are each a two letter code separated by a dash. For example en-uk is English language from the country United Kingdom, or pt-br is Portuguese language from Brazil, and so on.
Each localized survey has a default language that defines the initial version that is displayed if no other matching language is detected. By default, when a localized survey is the candidate to be displayed, Digital selects a translation depending on the language and country reported by the respondent's locale. For example, if the locale language is set to Spanish and there is a Spanish translation, Digital displays the survey text in Spanish. The country is used as a secondary identifier, a survey with translations into Portuguese from both Portugal and Brazil is shown to users in each country as appropriate.
If a localized survey is triggered and there is not a matching country, but there is a match to a language then this translation is used. For example, a suppose a survey has a translation into the Spanish language (sp) but there is not a Spanish Argentinian (sp-ar) translation. If the locale is sp-ar then although the translation does not match the country, it first falls back to using the matching country - the Spanish translation, before falling back to using the default language.
Because there are inconsistencies in how different countries and regions are returned, it cannot always be guaranteed that Digital matches the language and country desired. An alternative solution is to use a custom parameter that specifies the desired translation.
Text direction
When translations exist for languages which are both right-to-left (RTL) or left-to-right (LTR), Digital detects the text direction and the survey elements are aligned correctly. This checks that all text related to fields, labels, descriptions, error indications and so on are correctly aligned. Buttons, the close "X" and so on are also aligned correctly to the left when using different translations of the survey.
For example, this survey defaults to using an RTL language, and the form elements have been aligned to reflect this:
A survey that has been translated into an RTL language is displayed in the following ways:
Text for an always-on button is flipped in RTL languages.
An example invitation on a mobile device.
An example survey on a mobile device.
Survey localization settings
Open the localization settings by clicking the Translate button for a specific survey in either card or list view.
The localization settings configure the default language, and the list of available languages that this survey has been translated into.
Use the options to work with localization files and to add a language to this survey.
Localizing a survey
To localize a survey, follow these steps:
Configure a default language.
Add the new language, optionally based on an existing translation.
Configure how the translation is chosen. Either use the default that relies on the respondee's locale settings or optionally add a custom parameter.
Export the survey to a localization file.
Translate the strings and add them to the localization file.
Import the file back to Digital.
Selecting the default language
The default language for a survey is used when Digital determines that a survey has not been translated into the language reported by the respondee's locale. The default language for a survey is determined during survey creation. For old surveys, the default language is English (United States).
On the Form Localization screen select an option from the Default Language dropdown.
The languages defined within Digital must contain a country and language (for example, 'en-us').
See defining languages for more information.
Language determination method
When a localized survey is the candidate to be displayed, Digital chooses from the available translations. The SDK determines the device’s locale, and therefore the translation used, using the following logic:
- By default the translation is chosen based on the locale and language set on the user’s device
- Override the default behavior with a custom locale using the Update Custom Locale API. Using this API is not mandatory and usually caters for unique scenarios or needs.
For example, if your app should provide an option to manually change the language, pass a custom parameter to the Update Custom Locale API to override the OS-based locale display logic. The custom parameter must be of type Text attached to the survey or to all surveys. The custom parameter's value must be an IETF language tag in the format described at defining languages. See Custom parameters for additional information.
For a full description of the Update Custom Locale API see the integration instructions in the Integration Guide.
Languages table
The languages table contains a list of translations supported by the survey.
- Add language (1)
- Click Add language and select the language to add in the dialog that opens. It is also possible to copy an existing translation into the new language. For example, if you are adding the 'French (Canada)' language, select French (Canada) from the Form Language dropdown and select French (French) from the Duplicate Translations from Language dropdown.
- Delete language (2)
- To delete a language from the table, hover over that language and click the delete icon. Confirm the deletion in the message that opens. Note: The default language cannot be deleted from the table.
- Export (3)
- Click Export and select either Export to CSV or Export to Excel (.xlsx). The localization file can be sent out for translation.
- Import (4)
- Click Import to select the localization file that contains the translated content. The survey can contain one or more languages for translation. After the import process has completed successfully, a message appears. Click Save to persist the changes. If any errors occurred, a message appears listing those errors. See Importing the localization file.
Adding a language
Before exporting a localization file to work with a translator, add the new language. Use the Duplicate Translations from Language option to copy the values from an existing translation. When this option is selected, the new language column in the localization file is automatically populated with the values of an existing translation. Use this option when adding a new translation such as a specific dialect of English, where only certain words need to be translated, for example the difference between "color" and "colour".
- In the Translation Settings dialog, under Available languages click +Add language. The Add language dialog opens.
- Under Language, select a language from the menu. The list of languages shows the name and the IETF language code.
- Optionally, under Duplicate Translations from Language select a language from the menu to use an existing translation as the base for the new translation.
- Click Add. The Add language dialog closes and the new language is visible in the list of languages.
Exporting a survey's fields
Use the Export button in the languages table to export all of the text strings from a survey in Microsoft Excel or CSV format. This localization file contains a table with the strings required for translation.
Open the localization file in an editor and identify the column which contains the newly added language. Each populated row represents one of the fields in the survey that has a text element. In the column for the new language, add the equivalent translated strings for each of the rows in the file.
Localization files
The localization process relies on a file that you export and import to Digital. Observe the following while using localization files:
File format
Using CSV with Microsoft Excel can result in issues because it only imports CSV in an ANSI format and this can negatively impact moving the file between Excel and Digital. Medallia recommend using Microsoft Excel .xlsx format for both export and import, maintaining UTF-8.
File structure
The structure of a localization file that has been exported as Microsoft Excel format and opened in a spreadsheet program looks similar to this:
- Settings (1)
- Contains the description the translated area or internal field ID. This column should not be modified.
- Translated fields (2)
- Describes the translated field (for example, the Close Button label). This column should not be modified.
- Default language column (4)
- Contains all the source strings required for translation in the defined default language ('US English' by default). This column should not be modified.
- Additional language columns (3,5,6)
- The column header contains the relevant language locale (for example, ja-jp or pl). The rows contain the translated strings. When adding a new language, use one of these columns and add the translated strings to it. The strings in these columns can be modified.
HTML encoded strings
Depending on the survey that is being localized, some of the cells in the translation table could contain encoded HTML. For example if a survey contains a privacy policy notice or an introduction text, this is also part of the exported text which should be translated. Such text appears in the translation table using HTML encoding, for example:
<p><span style="font-size:18px"><strong>We value your feedback!</strong></span></p>
When adding a new language, the text in this kind of cell must also be translated, but the HTML structure must not be changed. In the example shown, only the text "We value your feedback!" should change in the translated cell - the surrounding encoded HTML must remain the same. For example adding a translation to the Czech language requires a cell with:
<p><span style="font-size:18px"><strong>Ceníme si vaší zpětné vazby!</strong></span></p>
Importing the localization file
Once a new language has been added to the correct column in a localization file, in the Digital Command Center's Translation Settings dialog, use the Import button to import the file. When importing a localization file back into Digital observe the following:
- The structure of the localization file must match the current state of the survey. Do not add more columns, change the order of rows, and so on. Click Export again to save the original version and compare the files.
- File encoding should be UTF-8 if using a CSV file.
- The language code in the file must exist within the languages table in the dialog. It should be in the language-locale format (for example 'en-uk'). Importing a translation without adding the language to the survey results in an error.
- No script or embed tags within rich text fields are allowed.
- All fields contain a translation. Empty fields are reflected within the survey.
- The import process validates the file initially, but do not forget to click Save in the form localization screen to persist the changes.