共用方式為


Customize labels to support multiple languages

 

Applies To: Dynamics CRM 2013

When you create customizations in Microsoft Dynamics CRM, you can support multiple languages by using labels.

In This Topic

Using labels

Messages to use with labels

Customize labels in the base language

Translate customized entity and attribute text

Manage languages for your organization

Using labels

Labels are localized strings displayed to users in the client applications. They are implemented by using the 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 Microsoft Dynamics CRM.

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

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.

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 class 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

Description

ExportTranslationRequest

Exports all translations for a specific solution to a compressed file.

ImportTranslationRequest

Imports all translations from a compressed file.

RetrieveFormattedImportJobResultsRequest

Retrieves the results of an ImportJob as an XML document designed to be opened using Microsoft Office Excel.

RetrieveLocLabelsRequest

Retrieves the localized labels for the specified attribute.

SetLocLabelsRequest

Sets the localized labels for the specified attribute.

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 the 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 ExportTranslationRequest message.

Exported text is saved as a compressed file that contains a CrmTranslations.xml that you open by using Microsoft 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 ImportTranslationRequest message. 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

Microsoft Dynamics CRM 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 Microsoft Dynamics CRM with the base language set as your language preference. To verify that the translated text appears, you must change your language preference for the Microsoft Dynamics CRM user interface. To perform additional customization work, you must change back to the base language.

Manage languages for your organization

Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online enables 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 the Installing Guide, Install and deploy a language pack. 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 Execute method.

Message

Description

DeprovisionLanguageRequest

Contains the data needed to deprovision a language

ProvisionLanguageRequest

Contains the data needed to provision a new language.

RetrieveAvailableLanguagesRequest

Retrieves the list of available languages.

RetrieveDeprovisionedLanguagesRequest

Retrieves the list of language packs installed on the server that have been disabled.

RetrieveInstalledLanguagePacksRequest

Contains the data needed to retrieve the list of language packs installed on the server.

RetrieveInstalledLanguagePackVersionRequest

Contains the data needed to retrieve the version of an installed language pack.

RetrieveProvisionedLanguagesRequest

Retrieves the list of language packs installed on the server that are enabled.

RetrieveProvisionedLanguagePackVersionRequest

Retrieves the version of the language packs installed on the server.

See Also

Extend the metadata model
Developers guide to customization for Microsoft Dynamics CRM 2013
Modify the messages for an entity