Change the default language for anonymous user

2
Hello, I have two languages in my project Arabic and English. Is there a way to change the default language for anonymous users to Arabic? I want when anyone hits the URL to display it in Arabic.   Note: changing the default language to Arabic is not solving the problem.
asked
6 answers
1

As your role-based homepage for anonymous users, I would select a microflow that does something like this:

 

image.png

 

After that you can navigate to whatever page is currently your homepage. If it doesn't directly show the page in arabic, you may have to force a reload in the flow.

answered
1

Hey folks! Sorry for necroing the topic, but I think I found a solution (after googling the problem and finding this topic).


The key is to have a Microflow that runs for anonymous users (eg. I placed one as a data source for a Data view in my page template, so it runs for everyone); you can retrieve the System.User object with the [System.Session_User = $currentSession] XPath constraint, then add a decision that checks if the user is anonymous and has their language set to something other then the "forced default" language of your choice (Hungarian / hu_HU in my example, for OP's case it should be ar_something):


$currentUser/IsAnonymous

and $currentUser/System.User_Language/System.Language/Code != 'hu_HU'


...if that is true, you can add an activity to retrieve a single System.Language object from the database using an Xpath constraint along the lines of [( Code = 'hu_HU' )] and subsequently add a Change object activity which updates the previously retrieved System.User object with the retrieved System.Language. I added commit & refresh in client for good measure, I'm not sure if the latter is necessary/ideal, I'm still pretty novice in Mendix.


UPDATE: I switched to using a Nanoflow which calls the Microflow if language is not set to the "forced" one, then calls the Atlas_Core/LanguageSelector/ReloadWithState JavaScript action to quickly reload. It flashes a bit, so not perfect, but I think it's acceptable.

answered
0

I assume you already set the default language here by the way?

 

image.png

answered
0

Hi Mohamed ElNady,

 

Setting Default language as your language can solve this problem. 

as Shown in the below Image.

Screenshot (1381).png

Further, if you have more Clarification go through the following document to get an idea.

Default Language

answered
0

I have the same Problem here.

It seems like a bug in Mendix to me.

Instead of selecting the default language, the system language is selected for an anonymous user.

I think this should not be the behaviour of the Default language setting.

answered
0

The login page is affected by your broswer language.

answered