Skip to content

LanguageComponent

Jens Kooij edited this page Mar 25, 2018 · 3 revisions

LanguageComponent

Overview

The LanguageComponent is used for detecting the client's language.

Sitemap Compatible Application Compatible Parameters
true true defaultLanguage, acceptedLanguages, languageParameterName, forceRedirect

Parameters

defaultLanguage

[Optional]

By default defaultLanguage is set to 'en', for English. This is the default language to be used.

acceptedLanguages

[Optional]

By default acceptedLanguages is set to null, which means all languages are accepted. Alternatively you can specify a comma separated list of languages that are accepted. If none of the accepted languages was detected, it will use the defaultLanguage.

languageParameterName

[Optional]

By default languageParameterName is set to "language", meaning that in the template the variable $language contains the detected language.

forceRedirect

[Optional]

By default forceRedirect is set to false, meaning that the language will be detected, but no action is taken. If set to true, a redirect will take place to the correct language prefix. For example a French person requesting /, will be redirected to /fr/ and a Enlish person requesting /fr/something will be redirected to /en/something.

Example sitemap item

Title URL Regex Component Template Parameters
Lang /^/(.*)/ true LanguageComponent base defaultLanguage: "nl"
acceptedLanguages: "nl,en,fr"
forceRedirect: "true"

Parent

None