Okay, with the commit (ugly) it seems to work as expected… so I guess this will also work for your case? In your case you’ll have a drop down with the available languages and an on change event that triggers a similar NF I guess.
Setup:
Login screen which accepts anonymous users and contains translated text (and a translated button) in three languages (Dutch, German, English). To switch languages, the user can click a button. Buttons are inside a Dataview that uses a microflow to fetch the language of the current user (to hide a language button if the current language is the one from the button).
Each button triggers a NF that does the following:
- calls a MF that retrieves a System.Language object by language code (nl_NL, en_US, de_DE, etc).
- if this language is different than the current language, the language is set for the current user (and committed)
- if the language was different, the JavaScript mx.ReloadWithState() is called
The result:
Using an answer field to be able to add an attachment, but it’s really a comment…
As you can see, it doesn’t always work as intended ;-)
Setup:
Simple login screen
Button which switches language on the current anonymous user (retrieves a language entity by language code and sets that on the current user).
If the language was detected to be different than before, we call mx.ReloadWithState() and the page gets reloaded
Debug text shows what should be expected.
1) When the screen is first shown to the user, it’s in Dutch (as expected)
2) When we press the button to switch to English, this time around, it’s all English (so as expected)
3) When we switch back to Dutch, the detected language shows nl_NL (Dutch), which is as expected, however, all text is still in English.
4) If we continue this way, sometimes the text will match the language, sometimes not...
Hi ,
Create a JavaScript Action with a Code as mx.reloadWithState and call it in the Nanoflow .
Use the Nanoflow under the Button you want to Switch Language . It will work for sure .
it works for me for one of the App
I’m also having this problem. I’m working with 9.18.0.
But local or on DEV, no problems, it only occurs on ACC en PRD where we have more users. It appears there’s a delay.
In my case, all the text and buttons on the screen change perfectly (with htmlsnippet, with mx.reloadWithState()).. But the buttons where you choose the language sometimes don’t change with it and the apperance is dependent on $currentuser/language. Also when this happens the first error messages aren’t translated as well.
Page in Dutch, error in German.