Setting language for anonymous user

0
Hi community,   I'm developing an application that shall be used by anonymous users only. The language of the application shall be given by URL parameter. I've already a Javascript action with which I'm able to read this parameter. The application starts with a nano flow (there is a landing page that only contains a data view with the nano flow as source). In this nanoflow I read the language from the URL and then want to set this language as current application language. Currently I'm doing that with this microflow:    In the debugger, I can see that the language of the currentUser object is changed (gets a different ID in the User_Language property). But this doesn't seem to apply; the application is always German, although when I'm setting the en_US language.   Do you have an idea what I'm missing? Or is there another (simple) solution to achieve my goal?   Thanks! Holger
asked
6 answers
0

Hi Holger,

i have just done some search on this in forum, i got this one  which seems to me will work, check this out once

https://community.mendix.com/link/space/microflows/questions/113987

Regards

 

answered
0

I just noticed that I can simplify the micro flow. But this doesn't change the behaviour, unfortunately.

 

SUB_SetLanguage2.jpg

answered
0

Hi Holger,

I also faced this previously as i was doing refresh only as you are , it got solved on committing the current user account along with refresh.

also don't refresh inside the loop as it will cause performance issue, put it outside of the loop as in the 1st image you posted.

Try this Let me know if you still face this issue.

 

Good luck!

answered
0

Hi Holger,

Maybe we have to refresh 1 more time in order to reflect the language properly , you can try 1 thing , in the same dataview add the microflow timer widget and inside timer widget call microflow or nanoflow and refresh the account entity or dataview entity whichever works best and you can set time as 1 sec or 2 sec and make execute once as yes.

Let me know if it works or not

Good luck!

answered
0

Hm, somehow I don't get it running... :-(

I've tried several things right now, beside what you've suggested. The behaviour stays the same (as before).

 

Last thing I've tried is to show another empty page with only a data view and a nanoflow call on it. In that nanoflow, I call the microflow in which I simply do a commit on the currentUser object. After that, the nanoflow redirects to the real page I want to show.

Is doing a commit (with "refresh in client" again) the correct way to do the refresh?

answered
0

Hi Sharad,

 

finally, I got it working!

I already had played around with reloading the page after having changed the language. "Best" result was an infinite loop, as the reload triggered the timer / nanoflow source of a data view again.

 

Checking in the nanoflow if the language actually has changed did the trick.

 

Downside is, that the page is somewhat "flickering", when the language changes. You can see the original language very shortly before the page reloads. For now, I will live with it, though.

Anyway, I will mark your last answer as "accepted".

 

Thank you very much for your help!

 

Best,

Holger

answered