Change Locale getting Reset

  

Hi,

I have made my application multi lingual. I have different tenants for different countries, each tenant is linked to a default language. 

When a session is started I identify the tenant and change the Locale using the SetCurrentLocale action, everything is good until this point. I can navigate between pages and there is no problem.

The problem comes whenever I save or edit something, at first the locale is not changed I guess because it's an ajax refresh, but if I were to refresh or go to another screen it goes back to the Default Application Locale which is english.

I have set breakpoints where I set the locale, and it is not hitting them, so I don't know what is causing my session locale to get reset.

If anyone has any input I would really appreciate it.

Hi Andres,

    usually location is not related to tenant. The OS application supply the language according the language set in the browser. 

   The tenant is only an option to "reset" the database for new users (tenants).

At least, this is my understanding.

Luck

Luciano Schiavo wrote:

Hi Andres,

    usually location is not related to tenant. The OS application supply the language according the language set in the browser. 

   The tenant is only an option to "reset" the database for new users (tenants).

At least, this is my understanding.

Luck

Hi Luciano,

Thanks for the response.

Yes, but it happens to be that for my application each country will be a tenant (they have their own data), that is why I am able to default the language based on that. 

The main problem is that even if I Set the Locale to a different one using a Language Bar, after I do any kind of save if I refresh it goes to English.


Hi Andres,

  have you tried to use the TenantSwitch ? It will do all job regarding the Site.TenantId that must be associated to the user after login.


Hello,

I'm Having the exactly same problem!

I save the language chosen by the user in Data Base and when it logins I set the Locale.

However every time I do a submit the language goes to Default!


Have you found a solution?

Hi Raphael,

    you need to set the language (SetCurrentLocale) in the login according to the user or tenant preference.


Have anybody find a solution for this issue?

We are encountering this issue, after we do an ajax refresh it goes back to english. 

we have a layout espace and a sessionB espace, in the sessionB espace, we have the session locale stored.  The functions setCurrentLocale and setCurrentlangauge resides in sessionB.

Layout espace contains the layout webblocks for the rest of the espaces within the application. So we set the locale on the Layout_Normal, etc, web-blocks that are being used by the other web-blocks and webpages in other espaces. For some reason it defaults to english when doing an ajax refresh.

has someone find a solution for this?


Alexei...

Try to call SetLocale on the OnBeginWebRequest action.


This solved for me.


Raphael,


Thanks for your reply, It did not work for me. Let me provide a graphical representation of how we have our pages structured below:

To pin point when and where exactly the locale is being default to English I debugged the action that uses an ajax submit. 

What I found out is that  when using an  control on a container or a table it defaults that part of the screen that is being refreshed to English.  

I have managed to find a possible solution, which to me is not the best solution, which is:

1. I call a function that I created that gets the selected user language from an espace that we are using to store the selected user language in a session variable. This function is being used also in the OnSessionStart event of the layout espace.

2. Then call the system action setCurrentLocale to set the language again. Which has already been done in the layout Espaces, because you are using the layout web-blocks from which the layout of the pages consists of.


This is not the best option, because:

1.  I will need to go through the whole application and call that function prior doing an ajax refresh on a part of the screen.

Do you know another option to fix this, without doing the solution I have found above?


thanks,


Alexei

===== UPDATE====

It is not the Ajax refresh that is causing the language to default to english but the refersh data.

In actions that uses the ajax submit method and uses the Refresh data is causing that, because on other actions that uses the ajax submit as a method, and don't have the refresh data, but have the ajax refresh it works well. 


===============



Alexei wrote:


Raphael,


Thanks for your reply, It did not work for me. Let me provide a graphical representation of how we have our pages structured below:

To pin point when and where exactly the locale is being default to English I debugged the action that uses an ajax submit. 

What I found out is that  when using an control on a container or a table it defaults that part of the screen that is being refreshed to English.  

I have managed to find a possible solution, which to me is not the best solution, which is:

1. I call a function that I created that gets the selected user language from an espace that we are using to store the selected user language in a session variable. This function is being used also in the OnSessionStart event of the layout espace.

2. Then call the system action setCurrentLocale to set the language again. Which has already been done in the layout Espaces, because you are using the layout web-blocks from which the layout of the pages consists of.


This is not the best option, because:

1.  I will need to go through the whole application and call that function prior doing an ajax refresh on a part of the screen.

Do you know another option to fix this, without doing the solution I have found above?


thanks,


Alexei