tags:

views:

157

answers:

2

Hi, I'm trying to set up a norwegian version of a site built with JSF. I know how to display my own messages based on what locale is set to, but I'm having trouble with the default messages (eg. when a form input is invalid). As far as I can tell, norwegian is not supported.

Does anyone know how I could overcome this? e.g. by translating some property file myself

Thanks!

+3  A: 

You're doing almost the right thing, you just need to use the right property keys. The default messages.properties file is located in jsf-impl.jar (in the javax.faces package).

This contains all the messages, such as:

javax.faces.component.UIInput.CONVERSION=Conversion error occurred.
javax.faces.component.UIInput.REQUIRED=Validation Error: Value is required.
javax.faces.component.UISelectOne.INVALID=Validation Error: Value is not valid
javax.faces.component.UISelectMany.INVALID=Validation Error: Value is not valid

If you specify your own custom message file and use those same property keys, it will override the JSF defaults.

(See this blog post for more detail)

Phill Sacre
A: 

This is covered in detail in the JSF specification (section 2.5.2.4 in JSF 1.2). It provides a complete list of resource keys and details the mechanisms for providing your own translations.

McDowell