0

I am trying to implement following example into my jsf2 app:

http://www.mkyong.com/jsf2/jsf-2-internationalization-example/

But I don't understand how the app knows what property-file belongs to what language.

May you pls explain :-)

Donato Szilagyi
  • 4,279
  • 4
  • 36
  • 53
Sven
  • 6,288
  • 24
  • 74
  • 116
  • possible duplicate of [JSF2 Interantionalization example question](http://stackoverflow.com/questions/4667537/jsf2-interantionalization-example-question) – Michael Borgwardt Jan 12 '11 at 10:13

1 Answers1

3

That's done by ResourceBundle API, not by JSF. The resource bundle filename should adhere the following pattern name_ll_CC.properties. The _ll part should be the lowercase ISO 693-1 language code. It is optional and only required whenever the _CC part is present. The _CC part should be the uppercase ISO 3166-1 Alpha-2 country code. It is optional and often only used to distinguish between country-specific language dialects, like American English (_en_US) and British English (_en_UK).

The right file is determined based on the Locale of the current request. JSF will pass the one of UIViewRoot#getLocale() to ResourceBundle. If the name_ll_CC.properties file is absent, then the ResourceBundle will scan for name_ll.properties file. If it is absent as well, then the ResourceBundle will fallback to the default properties file whose locale you can specify as <default-locale> entry in faces-config.xml. If an entry is absent as well, then it will finally scan for name.properties instead.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555