Articles in this section

Document language

This article explains how to create a document language field in the User Profile.

The document language is used in many functions like FormatDateTime() and Translate() as well as to set the proofing language. It is recommended to use 'DocumentLanguage' as the name of the variable.

  Prerequisites

  • Admin/owner access to the Templafy tenant.
  • Library and at least one Dynamics modules enabled.
  • Templafy Desktop and Office VSTO add-in installed.

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:

  1. Click on the Resources section of the Admin Center.
  2. In the upper right corner click More options and then Settings.
  3. In the dropdown select the language(s) you want to use, for example:
    languagesettings.png

      Important

    Only use languages with a 4 letter code like en-US or fr-FR. Languages with 2 letter codes like en or fr are not supported as they might cause unexpected behavior when users click Update document.

  4. Click Save to save the languages.
  5. The selected languages are now automatically added to the system-generated data sources Languages and Translations:
    languagestranslations.png
  6. 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:

  1. In the Admin Center select the Users section, then go to the User Profile tab and click Edit form:
    userprofileeditform.png
  2. Click + Add form field.
  3. On the General tab, in the Type field select Dropdown, then in the Name field type 'DocumentLanguage' (without quotes).
  4. In the Label field type any text, for example 'Document language'. The result looks like this:
    userprofiledocumentlanguage.png

      Important

    • The name DocumentLanguage (exact casing and without a space) is a reserved word within Templafy.
    • 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.
  5. On the Configuration tab, in the Options dropdown select Languages then in the Field to show field select Name. The result looks like this:
    userprofilelanguages.png
  6. Click Add field.
  7. 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

  Note

  • When in the binding the variable DocumentLanguage is omitted, the output still shows the correct value.
  • The binding {{FormatDateTime(Form.Date, "d MMMM yyyy", UserProfile.DocumentLanguage.Language)}} would also work, but would be unnecessarily long.
  • The binding {{FormatDateTime(Form.Date, "d MMMM yyyy", UserProfile.DocumentLanguage.Name)}} does not work - the output returns an empty value.

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:
dropdownmylanguage.png

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

  Note

  • When in the binding the language variable is omitted, the output is in English.
  • The binding {{FormatDateTime(Form.Date, "d MMMM yyyy", MyLanguage)}} does not work. The validation in Template Designer will show 'Unknown data reference'.
  • The binding {{FormatDateTime(Form.Date, "d MMMM yyyy", UserProfile.MyLanguage.Name)}} does not work - the output returns an empty value.

Example 3

In this example this data source is used:

translationssubject.png

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

  Note

  • When the binding the variable DocumentLanguage is omitted, the output still shows the correct value.
  • The binding {{Translate("Subject", UserProfile.DocumentLanguage.Language)}} would also work, but would be unnecessarily long.
  • The binding {{Translate("Subject", UserProfile.DocumentLanguage.Name)}} does not work, the output returns the value 'Subject' from the 'Name' column.

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

  Note

  • When the binding the language variable is omitted, the output is in English because the value of the 'Name' column is used.
  • The binding {{Translate("Subject", MyLanguage)}} does not work. The validation in Template Designer will show 'Unknown data reference'.
  • The binding {{Translate("Subject", UserProfile.MyLanguage.Name)}} does not work, the output returns the value 'Subject' from the 'Name' column.
User Profile active directory computed fields ad claim admin_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.