1

In the JSF app I'm working on we use message bundles and locales extensivelly. Nearly all labels are defined in a set of *.properties file, there is one file for each language, etc. This works great, whenever the user changes its language preferences on the browser and refreshes the page, those labels change accordingly.

The only labels that do not change are the 'native' JSF validation messages. Those messages are always on the language defined in the JVM during server startup (we use JBoss 7.1 and eap 6.3). So, for example, if in the startup script the this is defined: -Duser.language=en the validation messages will always be in English.

example: Validation Error: Value is required.

If, however we change the property to -Duser.language=pt the validation messages will come up in portuguese.

example: Erro de validação: Valor é necessário.

All the other labels do not have that behavior, so they do change according to the browser's language preference.

We did not specify custom validation messages anywhere.

In faces-config.xml we have the following:

    <locale-config>
        <default-locale>pt</default-locale>
        <supported-locale>pt</supported-locale>
        <supported-locale>en</supported-locale>
    </locale-config>
felipe_gdr
  • 1,088
  • 2
  • 11
  • 27

1 Answers1

0

If I understand what you're asking right, it sounds like what you're wanting is message bundles.

A message bundle works like a resource bundle does, except they apply to warnings and errors.

I believe the following answer will help you: https://stackoverflow.com/a/2668602/4042348

Community
  • 1
  • 1
  • thanks for your answer. I'm familiar with message bundle. This particular app does not customize messages. The bundles are 'built-in' the jsf jar. The problem is that the text is not being translate into the proper language, according to browser preferences. – felipe_gdr Jan 14 '16 at 18:37