I'm new here

Browser language integration into FirstSpirit templates

Currently, we wonder:

- how to integrate the current browser language into the FirstSpirit templates

- depending on the browser language, let the page being displayed

The browser language could be determined via the following JavaScript code:

<script type="text/javascript">

if (navigator.language.indexOf("en") > -1) {


} else if (navigator.language.indexOf("de") > -1) {





- is it the preferred way to do it?

- might there be a special CMS-tag, that should be used?

- do you prefer any other solutions?

0 Kudos
3 Replies
I'm new here

This shouldn't be the way of choice, since your java-script code is s client-side action.

Browsers usually add the currently used language to the request header (user-agent), so you could write a small servlet to read the data and then redirects/forwards to the designated web page.

Your code is much simplier of course.

0 Kudos
Community Manager

Here's an interesting approach that uses an AJAX call to a small webapplication to get the Accept-Language header information. Unfortunately, that header field isn't available within javascript, so you need to rely on a server side language to get it.

0 Kudos
Crownpeak employee

Hello Mr. King,

if you are using an apache webserver, you can just use the multiview feature of this server. On FirstSpirit side you just have to activate the multiview url path generation feature within the generate action.

See chapter "Execute generation of the Manual for Administrators" [page 303] of the Manual for Administrators

User: FIRSTDoku

Pass: FSdown_V2

Best regards,

  Holger Höbbel

0 Kudos