When creating the resource files for each language there are few points that need to be remembered. In the web resource, you’ll need to include the numeric language code in the Name as well as specify the Language type in the Content settings. In this example, 1033 is English and 1036 is French. Also, make sure the key is the same in each file – example “Greeting.”
In this example, Visual Studio is being used to create the RESX files but under the hood, they are just XML files. The schema is a bit complex so if possible use a tool to create them rather than doing it manually.
In order to get a localized value from one of these files you can use the new “Xrm.Utility.getResourceString” method. The first parameter is the first part of the web resource Name including the prefix. The second is the key from the RESX file. The specific language is not defined anywhere. The result will come from the RESX file that matches the logged in user’s default language. If it doesn’t exist, it will fall back to the organization’s base language.
Once the setup is complete, you can bind scripts to form events as you normally would.
The resulting alert displays the value based on the logged in user’s language selection with is found under the user options.
When the language is set to English, the result comes from the English RESX file.
When the language is set to French, the result comes from the French RESX file.
There you have it! For more helpful Dynamics 365 tips and tricks check out our blog.
Happy Dynamics 365’ing!