Multi-language support for custom solutions in Dynamics CRM

By | July 6, 2016

For as long as I remember Microsoft Dynamics CRM has always provided support for multiple languages. This means that labels throughout CRM would appear in the language of your choice. You can have multiple languages installed in CRM apart from the base language. Each user has the choice to choose the language of their choice from the installed languages in CRM. While this has been there forever, never really had a chance to explore this in depth with regards to the customizations done. Recently we have had requests for multi-language support for our ISV solutions, and this made me take a look at how this works in Dynamics CRM.

For the purpose of this blog CRM Online (v8.1.x) has been used. There might be behavioural differences in the earlier or later versions of CRM.

How do you support multiple languages?

If you review the customizations closely, you would notice CRM components have the concept of LocalizedLabels. This has been observed when working with optionset values. The labels in the optionset can also be localized to each language.

Localizing Entities:

I followed the steps below to get the fields and view labels translated

  1. Create a solution and include the components that you would like included in the solution for multi-language support.
  1. Install the Language Packs for the languages you want to provide support. Languages can be installed by navigating to Settings → Administration → Languagesmulti lang support
  1. Check the languages you want to install and click apply.
  1. Once the languages have been installed use the Export Translations button on the solution to export the translations to an archived file.
  1. Extract the contents of the downloaded CrmTranslations_<solutionname>_1_0.zip. This will extract two files,multi language support
  1. Open the CrmTranslations.xml in excel and enable editing of the file.
  1. You will find columns for each of the languages you have deployed.
  1. Fill in the translations for each language for each of the options available and re-import the translations to the same solution using the Import translations button.Dynamics CRM multi lang support

Note: You can only import the translations back to the same organization from where it had been exported. So you cannot export the translations from your dev org and import directly to prod org. You will need to go the solution path to move the translations.

Exporting Translations through Managed Solutions

Now that the translations have been done, it is time to export the solution and test it from another org. As an ISV I would like to include the translations of all the languages in a single solution and not really manage multiple solution copies per language. But it is also important that importing of this solution in an organization that does not have these language pack should not cause the solution import to fail.

Let us test this out

  1. Importing this solution in organization that only has English language installed and set as the base language does not fail but does show a warningExporting Translations through Managed Solutions
  1. Since the translations for French and German could not be imported, even after installing the German Language pack, no translations appear.
  2. Here is where I thought the option to allow the Import Translations button on the solution would have been a huge help. But like stated earlier, translations can only be imported to the organization from where they had been exported.
  1. So the step to get the translations for the newly installed languages is to “Re-Import” the solution. This time when you try to import, it would indicate that there is an update that you are installingsolution information
  1. Once the solution is re-imported. Change the language to German and you will see the entity labels in Germanreimporting solution

Get the Ribbon Button Labels translated:

Now that we have the entities translated, let us now focus on get the button labels translated.

  1. Create a solution and add the components that have the ribbon buttons added, it could be on the entity or perhaps global application ribbon.
  2. Export the translations, edit the file and provide the translations for the languages and re-import.

How to translate the custom HTML Web Resources?

This is a little tricky and not really an easy and OOB way to get these translated just like the above. While checking for options available for storing translations of custom labels and dialogs on web resources as part of the solution, we came across Messages. When you edit an OOB entity like Account, you see a section for Messages that lists out a list of strings. These are strings that is used within Dynamics CRM to display messages on dialogs or other places within the application. While these can be downloaded through translations and edited to a custom text, new messages cannot be added.

The only option then available is too store the translations either in a custom entity by the language code or maintain the details in a webresource by the language code.

In case of the entity option perhaps create an entity with the following fields

Language Code

Key

Text

Within the web resource read the label text using the key and the language code. You can use getUserLcid() to get the current users language and then lookup the text appropriate to the language.

The other solution could be to create language resources and store them as xml web resources. You can read the content of a web resource through the script and then lookup the text for the key and set it appropriately in the web resource.

Conclusion:

Apart from the web resources that is missing an easy way to add translations and perhaps an extension in the XRM API to read the translations defined for web resources, it isn’t really that difficult to get your solution mulit-language compatible. The toughest part though… find the right translations in each language that you don’t even know 🙂

Note: I wouldn’t depend on translation sites on the web since though they translate the text, it might not be the right translation for the word in the context in which you would like to use it. Burnt our fingers there before.

Free 70% of storage space in CRM with Attachment Management Apps!

Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.