webtier@glassfish.java.net

faces-config locales not working anything like expected

From: <webtier_at_javadesktop.org>
Date: Sun, 30 May 2010 03:01:37 PDT

I've just done a test on the locale mechanism in faces-config and all is not well.
I've specified english as the default-locale, with both english and french as supported locales. Both the .properties files exist and are accessible. In the browser I set my language preferences to english, then french, in that order,
taking care to use the "en" and "fr" designations in both browser and faces-config.

What happens is that as long as these lines are present in faces-config:

<resource-bundle>
     <base-name>uk.co.sportquest.jsfbeans.messages_fr</base-name>

...then the french properties file is used. I've got the default-locale set to english,
english is ahead of french in my browser settings, and furthermore I can delete
the <supported-locale>fr ... line and it still uses the french version. This works
the same in both IE8 and Google Chrome, so it's not a browser issue (or if it is they're both affected - unlikely).

Perhaps I can write a custom view handler, unless I'm doing something wrong?
can't see it though.

Here's my faces-config.xml:

...
<locale-config>
            <default-locale>en</default-locale>
            <supported-locale>en</supported-locale>
            <supported-locale>fr</supported-locale>
        </locale-config>
        <resource-bundle>
            <base-name>uk.co.sportquest.jsfbeans.messages_en</base-name>
            <var>msgs</var>
        </resource-bundle>
        <resource-bundle>
            <base-name>uk.co.sportquest.jsfbeans.messages_fr</base-name>
            <var>msgs</var>
        </resource-bundle>
...

Regards,
Brendan.
[Message sent by forum member 'healeyb']

http://forums.java.net/jive/thread.jspa?messageID=471999