fabiorocha
fabiorocha

Reputation: 150

How do I support multiple locales for the same language in JSF?

I'm trying to make my jsf application support resources from multiple locales.

I've already created the contents on the resources folder and that works fine when I have the following on my faces.config:

<supported-locale>en</supported-locale>

<supported-locale>fr</supported-locale>

However, I'd like to support US English, Canadian English and UK English, for instance.

How do I go about doing that?

<supported-locale>en_CA</supported-locale>
<supported-locale>en_US</supported-locale>

The above doesn't seem to work. Any suggestions are highly appreciated! Thanks.

Upvotes: 0

Views: 161

Answers (2)

fabiorocha
fabiorocha

Reputation: 150

The supported locales actually work as described above:

<supported-locale>en_CA</supported-locale>
<supported-locale>en_US</supported-locale>

My problem was that en_CA and en_US should not be inside the "en" folder in the resources folder. They should be subfolders of resources.

.resources
..en
..en_CA
..en_US

Rather ugly but I guess that's how JSF wants it. Nested folders would be more elegant in my opinion.

Upvotes: 2

blitzen12
blitzen12

Reputation: 1390

have you read the oracle documentation? It's Chapter 17 about Internationalization and Localizing Web Applications from here. just read and follow the documentation and I'm sure it will work.

Upvotes: 0

Related Questions