Know what is the language of the current page
Permalink
How to know if the current page is in french or english for instance, in order to display specific things (a flag for instance ...) in the php template ??
My understanding of the question is that yukulelix is trying to figure out the language of the currently displayed page and not just the preferred language of the browser.
The code for that would be:
The code for that would be:
Loader::model('section', 'multilingual'); $lang = MultilingualSection::getCurrentSection()->getLanguage();
I was unaware of this model in internationalization. This is a cleaner solution and will give the same result as the current page. Thanks for informing me about this as well, PatrickHeck.
You can also find a full Language information (instead of en => en_GB)
Loader::model('section', 'multilingual'); $lang = strtolower(MultilingualSection::getCurrentSection()->getLocale());
Let me know if you need more help