Perspective - Detect browser language

Is there an easy way to detect the client browser language ?

session.props.browserLocale

Update:
session.props.locale is what you should use. session.props.browserLocale is an old property from probably before the 8.0.0 release that has just hung around in my project.

Wow, I didn’t see that!!!

Thanks

I don’t have session.props.browserLocale!

Oh, you’re right, that property was re-named and still exists in my project since it’s been around forever. session.props.locale should provide what you’re looking for.

Is this local.prop.session initially set up by the browser or does it set up the browser?

I want to make sure this variable is set by the browser and not the other way around.

It looks like even if I modify that within the Designer new sessions will set the value to the locale in use by the browser.

Steps:

  1. I set the locale to fr-FR within the project.
  2. I placed a Label, and bound the label to session.props.locale`.
  3. Label displayed “fr-FR”.
  4. I saved the project.
  5. I opened a new session to the View which contained the Label.
  6. The Label displayed “en-US”.

I’m pretty sure that value can be used to SET the locale at runtime, but on session load I believe it will always pick up what the browser is using. If you modify the value after that then you’ve defined the locale to use yourself.

OK, thanks