Using multiple deployment, we can set user language for each deployment.
config: {
...
getUserLanguage: function (callback) {
callback("en-US"); // for Japanese; ja-JP
}
}
Can we call getUserLanguage from outside of "framework.js"?
If we can, please tell me how to call function.
Could you explain what you mean by calling getUserLanguage from outside of "framework.js"? Are you trying to pass the user language value to the host/parent page via postMessage API? Or are you trying to pass the language data from the host page to the embedded client via a URL parameter?
It is good if either of the two methods is possible.
Instead of directly describing the language (such as "en-US" or "ja-JP") in "framework.jp", I would like to set it according to the user's usage environment (such as the language on the CRM side).
I replaced the getUserLanguage function when loading the screen,
I tried to get the url parameter of the screen and write the code to pass to framework.js, but it is not working well.
You should be able to pass the language information as a URL parameter from the parent to the embedded client page, read the URL parameter value inside the getUserLanguage, and pass it to its callback function.
Also, it might be helpful to know that the client caches the user language in the local storage using a key called userLanguage, so you may want to clear the cache manually during development.