Hello,

I know that the persistent locale is encoded in the URL's.

When I go to a page of our application and the url does not contain the locale 
string, the loaded page defaults to the language the browser would like to see, 
e.g. "en".

We want to prevent this. If a user types in a URL of our web app without a 
locale, it should not default to the browser settings, but to a specific locale 
we specify. How do I manage this?

persistentLocale is set when the url contains a locale, and returns the locale 
in the URL.
An injected currentLocale on a page accessed with a locale-less URL enables one 
to read the locale set in the browser settings.
localizationSetter.setLocaleFromLocaleName() sets some locale but didn't help, 
either.

@SetupRender
public Object setDefaultLocale() {
if (!persistentLocale.isSet()) {
localizationSetter.setLocaleFromLocaleName(Locale.GERMANY.toString());
return this;
       }
       return true;
}

I don't necessarily want the url to already contain the default locale, I just 
want the default locale to affect the messages on the page. When are the 
messages chosen? When would I have to set the default locale?

Regards,
Daniel P.

Reply via email to