问题
Two questions, hopefully with similar answers.
I'll be releasing a JavaScript package in my solution where the error messages are to be displayed. The problems is that I'll be targeting German, English and French. Possibly, also a fourth language TBD. What would be the nicest way to resolve this?
The label names should definitely be localized. Is there a built-in approach to that in CRM 2011? Like a resource table or something like that?
My current solution for (1) is to keep an extra web resource with the strings and distributing a different file for each language. I may rebuild it and distribute all the languages at once and only use a parameter, possibly settable from the GUI if I create a settings-entity. A bit cumbersome.
My current solution for (2) involves a lot of praying and a divine act of some sort. :)
回答1:
To determine current CRM user language dynamically from Javascript you can use
window.USER_LANGUAGE_CODE
(this variable exists on all CRM pages) - for example it will be equal1033
for English. Than based on that info, you can pick needed string resources from your file. Also in forms context there are two predefined functions, which return current Organization language code and current User language code:Xrm.Page.context.getOrgLcid()
andXrm.Page.context.getUserLcid()
.If you are talking about custom entities and fields, you can easily add localized display names for them via your solution. You need to edit
customizations.xml
file from your unzipped solution. For each attribute there you will find such XML containing display names:<displaynames> <displayname description="Created By" languagecode="1033" /> </displaynames>
You can just add new display names for each language you need there.
P.S. If someone interested in different aspects of multilangual support for Dynamics CRM 2011 solutions, I strongly recommend to review this page, also here and here is a very helpful reading.
来源:https://stackoverflow.com/questions/14068562/multilingual-solution