What I want to achieve is loading my community page with the current browser or local selected language.

So far I have different page variations for each language, so I want to load the language corresponding to the browser/local language or (if there is not translated language for the current browser language) load a default language. All this without having to redirect the user once the page has already load with the default language.

Is there a way to achieve this?


1 Answer 1


I have used custom labels while using sites. To determine the browser language you can use Accept-Language.

language = ApexPages.currentPage().getHeaders().get('Accept-Language').substring(0,2);
  • Thanks for your answer, but I think that does not work for Lighning Communities, do you know a way to do it with Communitites? Commented Jun 1, 2018 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .