About this article
This article will explain how to create a document language field in the user profile, what settings to take in account and that it is recommended to use 'DocumentLanguage' as the name of the variable.
The document language is used in many functions like FormatDateTime() and Translate(). It's also used to set the proofing language.
- Add languages to the Languages data source
- Create a document language field in the User Profile
- Examples
Prerequisites
|
Add languages to the Languages data source
Before you create a document language field in the user profile, first add languages to the Languages data source in the Admin Center. Follow the steps below:
- In the upper right corner click
More options
and thenSettings
.
- In the dropdown select the language(s) you want to use, for example:
- Only use languages with a 4 letter code like
en-US
orfr-FR
like in the image above. Languages with a 2 letter code likeen
orfr
are not supported as they might cause unexpected behavior when a user clicksUpdate document
.
- Only use languages with a 4 letter code like
- Click
Save
to save the languages.
- The selected languages are now automatically added to the system-generated data sources
Languages
andTranslations
:
- You can add values to the
Translations
data source like the translations for 'Subject' in the image above (optional).
Create a document language field in the User Profile
The next step is to create a document language field in the user profile. Follow the steps below:
- In the Admin Center select
Users
in the menu, then go to the User Profile tab and clickEdit form
:
- In the middle of the screen click
+ Add form field
.
- On the General tab, in the
Type
field selectDropdown
, then in theName
field type 'DocumentLanguage' (without quotes).
In theLabel
field type any text, for example 'Document language'. The result looks like this:
- The name 'DocumentLanguage' is a reserved word within Templafy (exactly written like this, so with an uppercase 'D' and 'L' and without a space). Whenever a document language is required in a (Dynamics) binding and the variable is omitted, Templafy will look for a 'DocumentLanguage' field in the user profile. If a field with this name is not present, then e.g. dates will always be shown in English notation, even when the selected language is e.g. Dutch or French.
- It's recommended to always use 'DocumentLanguage' as value in the
Name
field.
- On the Configuration tab, in the
Options
dropdown selectLanguages
then in theField to show
field selectName
. The result looks like this:
- Click
Add field
.
- Click
Publish
.
Examples
Example 1
When the recommended name 'DocumentLanguage' is used in the user profile, then these are the results in combination with a FormatDateTime() binding with the date '15 May 2023' and the language set to 'Dutch (Netherlands) (nl-NL)':
Binding | Output |
{{FormatDateTime(Form.Date, "d MMMM yyyy", DocumentLanguage)}} | 15 mei 2023 |
{{FormatDateTime(Form.Date, "d MMMM yyyy")}} | 15 mei 2023 |
|
Example 2
The same values from example 1 are used, but this time 'MyLanguage' is used in the user profile instead of the recommended name 'DocumentLanguage':
These are the results:
Binding | Output |
{{FormatDateTime(Form.Date, "d MMMM yyyy", UserProfile.MyLanguage.Language)}} | 15 mei 2023 |
{{FormatDateTime(Form.Date, "d MMMM yyyy")}} | 15 May 2023 |
|
Example 3
In this example this data source is used:
When the recommended name 'DocumentLanguage' is used in the user profile, then these are the results in combination with a Translate() binding with the text 'Subject' and the language set to 'Dutch (Netherlands) (nl-NL)':
Binding | Output |
{{Translate("Subject", DocumentLanguage)}} | Onderwerp |
{{Translate("Subject")}} | Onderwerp |
|
Example 4
The same values from example 3 are used, but this time 'MyLanguage' is used in the user profile instead of the recommended name 'DocumentLanguage':
Binding | Output |
{{Translate("Subject", UserProfile.MyLanguage.Language)}} | Onderwerp |
{{Translate("Subject")}} | Subject |
|
Related articles
Comments
0 comments
Article is closed for comments.