Search code examples
javajsflocale

Configured default locale not taken into account?


I configured a default locale, and set up a text.properties + text_de.properties.

<application>
    <locale-config>
        <default-locale>en</default-locale>
    </locale-config>
    <resource-bundle>
        <base-name>text</base-name>
        <var>text</var>
    </resource-bundle>
</application>

Now, if I go to the website with german locale settings, the text is taken from text_de! Even though it is not configured as supported language!?

It that intended by jsf?


Solution

  • Here is the precedence list of JSF local sources:

    • Search for a match between request locales (Header Accept-Language) and supported locales
    • Application default locale of the faces config file
    • JVM default locale

    (From here: http://www.i-coding.de/www/en/jsf/application/locale.html)

    Note that request local has a highere precedence than default locale, and - as it seems - there is no need to put it into the support locales node.