Customize labels to support multiple languages

Applies to Dynamics 365 for Customer Engagement apps version 9.x

When you create customizations in Dynamics 365 for Customer Engagement apps, you can support multiple languages by using labels.

Using labels

Microsoft.Xrm.Sdk.dll Web API
Label class Label ComplexType
LocalizedLabel class LocalizedLabel ComplexType

Labels are localized strings displayed to users in the client applications. They are implemented by using Label (Label ComplexType or Label class), which supports language packs. Strings that are displayed to users, such as entity display names or options in an option set, can be stored in multiple languages. Users can select which language they want displayed in forms and views in Dynamics 365 for Customer Engagement apps.

The following table lists all of the metadata that uses the Label.

Metadata property Description
AttributeMetadata.Description Description for an attribute.
AttributeMetadata.DisplayName Display name for an attribute.
EntityMetadata.Description Description for an entity.
EntityMetadata.DisplayCollectionName Plural display name for an entity.
EntityMetadata.DisplayName Display name for an entity.
AssociatedMenuConfiguration.Label Label used for an entity in an entity relationship.
OptionMetadata.Label Label used for an option in a picklist, state, or status attribute.

The Label can store one string for each installed language. This array is the LocalizedLabels property. There must always be a label stored for the base language. The labels for other languages can be null. If the user wants to display the user interface in a language and a label does not have a string for that language, the label for the base language is used.

You can use the UserLocalizedLabel property to retrieve the label for the language chosen by the user.

Messages to use with labels

The following table lists the messages you can use to work with localized labels to support multiple languages. When you import translations you can generate a report based on the import Jjob in the same way you can when importing a solution. For more information, see Install or Upgrade a Solution.

Message Web API Operation SDK Assembly
ExportTranslation
Exports all translations for a specific solution to a compressed file.
ExportTranslation Action ExportTranslationRequest
ImportTranslation
Imports all translations from a compressed file.
ImportTranslation Action ImportTranslationRequest
RetrieveFormattedImportJobResults
Retrieves the results of an ImportJob as an XML document designed to be opened using Office Excel.
RetrieveFormattedImportJobResults Function RetrieveFormattedImportJobResultsRequest
RetrieveLocLabels
Retrieves the localized labels for the specified attribute.
RetrieveLocLabels Function RetrieveLocLabelsRequest
SetLocLabels
Sets the localized labels for the specified attribute.
SetLocLabels Action SetLocLabelsRequest

Customize labels in the base language

The customization tools provide ways to edit entity display names and you can customize these properties programmatically. You can also edit entity messages. But not every message is exposed. Another way to locate and customize text used in the application is to export the translations, edit the values for the base language and import the translations again. Although this is not the intended purpose of this feature it is a supported way to identify and customize text used in the application. For more information, see Modify Messages for an Entity.

Translate customized entity and attribute text

Because you can only perform customizations in the application by using the base language, when you want to provide localized labels for these customizations you must export the text of the labels so that they can be localized for any other languages enabled for the organization.

Export customized text for translation

You can export the translations in the Web application or by using the ExportTranslation message (ExportTranslation Action or ExportTranslationRequest class).

Exported text is saved as a compressed file that contains a CrmTranslations.xml that you open by using Office Excel. You can send this file to a linguistic expert, translation agency, or localization firm.

For more information, see Office 2003 XML Reference Schemas.

Import translated text

After you have exported the customized entity or attribute text and had it translated, you can import the translated text strings in the Web application by using the ImportTranslation message (ImportTranslation Action or ImportTranslationRequest class). The file that you import must be a compressed file that contains the CrmTranslations.xml and the [Content_Types].xml file just as they were exported.

After you import the completed translations, customized text appears for users who work in the languages that you had the text translated into.

Note

Dynamics 365 for Customer Engagement apps cannot import translated text that is over 500 characters long. If any of the items in your translation file are longer than 500 characters, the import process will fail. If the import process fails, review the line in the file that caused the failure, reduce the number of characters, and try to import again.

Because customization is supported only in the base language, you may be working in Dynamics 365 for Customer Engagement apps with the base language set as your language preference. To verify that the translated text appears, you must change your language preference for the Dynamics 365 for Customer Engagement apps user interface. To perform additional customization work, you must change back to the base language.

Manage languages for your organization

Dynamics 365 for Customer Engagement apps enable you to install multiple language packs on a server and allows the user to select a language pack. For more information about how to install language packs, see Enable Languages. This section contains information about messages used to manage languages installed for your organization.

The following table lists the messages that you use to work with language packs. Use these messages with the IOrganizationService.Execute method.

Message Web API Operation SDK Assembly
DeprovisionLanguage
Contains the data needed to deprovision a language
DeprovisionLanguage Action DeprovisionLanguageRequest
ProvisionLanguage
Contains the data needed to provision a new language.
ProvisionLanguage Action ProvisionLanguageRequest
RetrieveAvailableLanguages
Retrieves the list of available languages.
RetrieveAvailableLanguages Function RetrieveAvailableLanguagesRequest
RetrieveDeprovisionedLanguages
Retrieves the list of language packs installed on the server that have been disabled.
RetrieveDeprovisionedLanguages Function RetrieveDeprovisionedLanguagesRequest
RetrieveInstalledLanguagePacks
Contains the data needed to retrieve the list of language packs installed on the server.
RetrieveInstalledLanguagePacks Function RetrieveInstalledLanguagePacksRequest
RetrieveInstalledLanguagePackVersion
Contains the data needed to retrieve the version of an installed language pack.
RetrieveLicenseInfo Function RetrieveInstalledLanguagePackVersionRequest
RetrieveProvisionedLanguages
Retrieves the list of language packs installed on the server that are enabled.
RetrieveProvisionedLanguages Function RetrieveProvisionedLanguagesRequest
RetrieveProvisionedLanguagePackVersion
Retrieves the version of the language packs installed on the server.
RetrieveProvisionedLanguagePackVersion Function RetrieveProvisionedLanguagePackVersionRequest

See also

Extend the Metadata Model for Dynamics 365 for Customer Engagement apps
Customize Dynamics 365 for Customer Engagement apps
Modify Messages for an Entity
AttributeMetadata
EntityMetadata
OptionMetadata