Language Resolution

Last modified by Eleni Cojocariu on 2026/09/08 22:24

Explanation

XWiki resolves the language of every request the same way: it walks an ordered list of candidates and stops at the first one it can use. Knowing that order explains why a wiki whose default language is French can still greet a reader in English, and why setting a default language sometimes appears to have no effect.

The order of the candidates

What each candidate is:

  1. The locale already resolved for the request. Whatever settled the language earlier in the same request keeps it.
  2. The wiki default locale, for a wiki that is not multilingual. There is no choice to offer, so no other candidate is examined. The default locale is the "Default Language" of the wiki administration, or English when that field is empty.
  3. The language parameter of the request. This is what a language switch in the interface sends. The value default selects the wiki default locale and forgets the reader's earlier choice; any other value is remembered in a language cookie.
  4. The language cookie, which is how that choice survives the following requests.
  5. The wiki default locale, when it is preferred. This candidate exists only if xwiki.language.preferDefault or preferDefaultLanguage is enabled, and it is skipped for a reader who has asked for a language explicitly. See Language Parameters.
  6. The locales of the browser's Accept-Language header, in the order the browser sent them.
  7. The wiki default locale, as the final fallback.

Languages outside the supported list

xwiki.language.forceSupported cuts across all of it. While it is enabled, which is the default, a candidate that is not one of the wiki's supported languages is not used: the resolution simply moves on to the next candidate. A reader whose browser asks for a language the wiki does not support therefore sees the wiki default language rather than an untranslated interface.

FAQ

How long does the language cookie last?

Ten years, so a reader's choice effectively lasts until they switch language again or clear the cookie.

Where do I change the wiki default language?

In the wiki administration, see Set the Default Language for the Entire Wiki.

Related

Get Connected