Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Open page with respect to Client browser's Language

Avatar

Level 10

Hi,

We need a requirement like, CQ page must open in the Client browser's language. Suppose for example, if someone from Spain open the site, it must shown in the Spanish language. If for some odd-reason, client browser's language is unavailable, it must directs to English.

Can anyone, please let me know, how to achieve for this requirement.

Thanks,
Ratna Kumar.

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi Ratna,

The ideal solution would be to use apache rewrite rules to redirect sites based on language. I am not very sure if Internationalization could solve your problem. Internationalization is basically to render content based on key & native language.

it is like Java Resource bundle API. Pass the key & get the appropriate message.

You might have different domains for different language so apache rewrite to identify user language (From http request, accept-language parameter) and then redirect to respective domain.

--

Jitendra

View solution in original post

4 Replies

Avatar

Correct answer by
Level 9

Hi Ratna,

The ideal solution would be to use apache rewrite rules to redirect sites based on language. I am not very sure if Internationalization could solve your problem. Internationalization is basically to render content based on key & native language.

it is like Java Resource bundle API. Pass the key & get the appropriate message.

You might have different domains for different language so apache rewrite to identify user language (From http request, accept-language parameter) and then redirect to respective domain.

--

Jitendra

Avatar

Level 10

Hi Jitendra,

Actual requirement is this

"By default it uses the client browser’s language and it select the appropriate language. If for some odd-reason the client browser’s language is unavailable it defaults to “English".

Thanks,
Ratna Kumar.

Avatar

Level 9

Ratna,

Still not very clear how are you want to use that browser language. Do you want that at the server side or client side?.

In order to get language at client side, use navigator.language.And, at the server side, you can get it from http request header (i.e accept-language).

--

jitendra