403
Views
6
Comments
GetCurrentLocale()  always returns "en_US" not user's current language

I'm using the GetCurrentLocale() function to check the language of a user's pc. but the function always returns en-US and the pc is fully in pt-PT. Does anyone know the reason?

2022-09-01 09-52-33
Carlos Rodrigues

Hello Bruno, 

I think that that action is returning the language of the application and not the language of an user pc. 

You can see more information here: 

https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Multilingual_Reactive_Web_and_Mobile_Apps/Translate_your_app 

Best Regards,

Carlos 

UserImage.jpg
Bruno Guerra

Hello Carlos,


Thanks for the answer, but the default language of the application(Traditional) is Portuguese. If I put a label with the GetCurrentLocale() function (in test mode) the result displayed is en-us 

Best Regards,

Bruno

2022-09-01 09-52-33
Carlos Rodrigues


To set a locale you may use the system action SetCurrentLocale. If by default you want another language other than english you could for instance use the SetCurrentLocale on the OnSessionStart system action. That way any time a user starts a new session the "default" locale will be set.

UserImage.jpg
Bruno Guerra


In this app it is necessary have 2 languages (Portuguese and English). The default language of the application is Portuguese. In case there are 2 users (one with the pc in Portuguese and the other in English) the application adjusts itself to the language of the pc.

This is what I thought to solve the problem:

in the OnSessionStart system action 

in case the language is English (check on the if by getcurrentLocale) make a set for "en-001"

in case the pc is in Portuguese it does nothing because the default language is Portuguese

Problem:

the getcurrentlocale() function always returns "en-us" even if the pc is completely in portuguese

2022-09-01 09-52-33
Carlos Rodrigues

Can you show me where you define the application's default language?

2019-09-09 12-23-19
Tyler Cools

Good morning,

In our application, we run into this exact same problem, where we have some users where the default locale is always en-US. The strange thing is that their laptop language is fully set to Dutch (both the browser and Operating system), but still the locale is defined as en-US. However on other laptops where the laptop language is fully set to English, the locale is display correct in nl-NL (Dutch). I am curious how the locale is defined and how this can be changed. We are building an ERP system so ideally we don't use the OnApplicationReady in every end user layer, but rather understand why this difference in behavior occurs.

Thanks in advance!

Kind regards,

Tyler

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.