How to get current page language from Java
#1 by aakrzhes on Feb 15, 2017 3:49:00 PM

I'm trying to implement a custom authentication module (tested with the travel-demo site), but have encountered some i18n problems.

What is the right way to get current page language from Java code? As I can see, MgnlContext.getLocale() & MgnlContext.getWebContextOrNull().getAggregationState().getLocale() for the anonymous user returns locale, set up in his profile, not a page locale. Previous version (4.X) worked differently.

Also, I'm trying to get i18n-ed messages, using a "new" scheme with a SimpleTranslator injection, and when
calling the i18n.translate() method, it always returns "en" version of message bundle strings, disregarding profile settings and page language.
(my message bundle contains three properties files with "en", "ru" and "de" versions). And there are no errors in the log. At the same time Java native "old" scheme shows messages correctly.

Magnolia 5.5.1 EE Standard (set up from all-in-one bundle)

Any help will be appreciated,

Thank you