About this article
This article will explain what the Translate() function is and provide examples of how it can be utilized with the binding syntax in smart templates.
Prerequisites
|
What is the Translate() function?
Translate() is a function that allows the translation of specific terms or complete sentences by returning specific values from the Translations data source. When utilizing the Translate() function, the value present in the Name
column of the Translations data source will be utilized to resolve the value from the desired language column.
Translate() logic
Syntax | {{Translate(NameValueToLookUp, ColumnName)}} |
NameValueToLookUp
must be present in the Name column of the Translations data source and will be used to identify the row that should be utilized for the translation.ColumnName
will be utilized to resolve the desired language column
If the user profile contains a Language dropdown called DocumentLanguage
, a simplified syntax can be used that will automatically use the language column set in the user profile
Syntax | {{Translate(NameValueToLookUp)}} |
|
Translate() function examples
The below data sources and user profile field will be used in the examples:
|
|
User profile using DocumentLanguage
:
|
Example 1
Using the Translate() function to translate "Subject" to Dutch.
Binding | {{Translate("Subject", "nl-NL")}} |
Output | Onderwerp |
|
Example 2
Using the Translate() function to translate "Subject" based on DocumentLanguage
set in the user profile.
Binding | {{Translate("Subject", DocumentLanguage)}} | ||
Input | DocumentLanguage = "nl-NL" | DocumentLanguage = "fr-FR" | DocumentLanguage = not set |
Output | Onderwerp | Sujet | Subject |
|
Example 3
Using the Translate() function to translate "Subject" based on DocumentLanguage
selected by the user in the response form.
Binding | {{Translate("Subject", Form.DocumentLanguage.Language)}} | ||
Input | DocumentLanguage = "nl-NL" | DocumentLanguage = "fr-FR" | DocumentLanguage = not set |
Output | Onderwerp | Sujet | Subject |
Example 4
Using the Translate() together with FormatDateTime() function to show a specific date format depending on theDocumentLanguage
set in the user profile.
Binding | {{FormatDateTime(Form.Date, Translate("FormatLongDate", DocumentLanguage), DocumentLanguage)}} | ||
Input |
Date = 4 October 2021 DocumentLanguage = "nl-NL" |
Date = 4 October 2021 DocumentLanguage = "fr-FR" |
Date = 4 October 2021 DocumentLanguage = "en-US" |
Output | maandag 4 oktober 2021 | lundi 04 oct. 2021 | Mon 4 October 2021 |
|
Related articles
Comments
0 comments
Article is closed for comments.