anelk
I'm new here

Browser language

Jump to solution

Hi Community,

I would like to ask is it possible in FirstSpirit (page template for example) to get language of browser?

When user come to page, I need to detect his browser language, and regarding that information I need to display site in that language (or default if language of his browser is not supported in FS).

Any kind of help will be appreciated.

Kind regards,
Anel

1 Solution

Accepted Solutions
jan_bogutzki
I'm new here

Hi Anel,

when generating your site, include all available translations as

<link rel="alternate" hreflang="de-DE" href="https://www.domain.tld/site/">

On your site include a javascript that check the browser.language and match against the hreflang values. When you have found a page, ask your user if he would like to switch to that page.

Maybe there is a better solution for this.

best regards

Jan Bogutzki

View solution in original post

3 Replies
jan_bogutzki
I'm new here

Hi Anel,

when generating your site, include all available translations as

<link rel="alternate" hreflang="de-DE" href="https://www.domain.tld/site/">

On your site include a javascript that check the browser.language and match against the hreflang values. When you have found a page, ask your user if he would like to switch to that page.

Maybe there is a better solution for this.

best regards

Jan Bogutzki

Hi Anel,

like Jan already said you need a solution extended from FirstSpirit (JavaScript for example). Because FirstSpirit is pre-generating the website you have no browser information in FirstSpirit.

Best regards

Jan

Hi guys,

thank you for answers, I tought that we have something in FirstSpirit which can be used in this case.

Anyway, old good friend JavaScript will do the job. Smiley Happy

Kind regards,
Anel

0 Kudos