You are on page 1of 4

POC: Translation Framework

Problem Statement: Need to implement translations for all the PCF Controls used in KornFerry
Project.

Microsoft Dynamics Suggested Solution: Making separate resource files for all PCF Controls
which cannot be altered after the package has been imported into the solution.

Here we need to use individual .resx (resource) files, wherein we maintain XML entries for all
languages. For each language, we create individual resource files and for each control, this
method was not very convenient, as managing these many resource files would be very difficult.

Key Shortcomings Of This Approach:


● Individual Resource Files for each PCF control.
● The translation resource file cannot be updated once the PCF control is imported
into the Solution.
● Updating the translations for Client would be a hectic task if we used this
approach and the client wanted that he could update the translation without re-
importing the control.
● Also one resource file per language per PCF Control would also pose a
challenge when managing the Resources.

Key Findings:
● There are ways by which a web resource can be dynamically uploaded to
Dynamics CRM
● Similar to the Resource File approach suggested by dynamics, we can use any
XML file to read the translations and update the web page according to the
language of the system.
● In MS-Dynamics, there is a Language ID set for each language and it gets
updated when a user switches to any other language.
● It is possible to dynamically fetch a web resource and parse its data internally in
a PCF Control.

Then all these findings were used to get a solution which would not require resource files inbuilt
in PCF Controls but would retrieve them dynamically and work as required.

Approach Used to tackle the Shortcomings:


1. First of all we created one xml resource file per language for all the PCF Controls.
2. Then we wrote a code to upload and publish that file dynamically via another PCF
Control.
3. Then we placed a translation upload button on the settings page of the CRM.
4. After that we wrote a code to retrieve the language id currently used in the system.
5. Then the translation file according to the language id was dynamically retrieved and the
values of data were taken from that translation file.
6. We set default translations too in each pcf control in english which would be
automatically used if the resource file is not found in the system due to any
circumstances.
Upload Menu:

Uploaded:
German Resource File:

English Resource File:


Switching Languages:

Conclusion: Here we developed a new approach of implementing translation localization in


Microsoft Dynamics PCF Controls as the suggested approach was not feasible to the client.
In this the task was done according to the requirements of the client and at the end it worked the
way it was needed and all the shortcomings were fixed. Also this framework can be reused in
any PCF Control to translate that control in any language.

References:

https://dynamicsninja.blog/2020/01/21/pcf-localization/
https://community.dynamics.com/
https://docs.microsoft.com/en-us/dynamics365

You might also like