struts-config and message-resources : one Generic or one foreach langage

389 views Asked by At

I supposed it is a quite easy question but I never receive any clear answer.

I'am currently handling the internationalization of a struts application. After a long research, i found out that I was missing something int the struts-config.xml : the message-resources.

<struts-config>
    ...
    <message-resources parameter="my.bundle"/>
</struts-config>

I wanted to know if I need to add a per langage ? Something like :

<struts-config>
    ...
    <message-resources parameter="my.bundle"/>
    <message-resources parameter="my.bundle_en"/>
    <message-resources parameter="my.bundle_it"/>
</struts-config>

or maybe struts will link the default bundle with all its versions ?

1

There are 1 answers

0
berus97 On BEST ANSWER

No you need only definition of your default resources for example

<message-resources parameter="com.bundle" null="false" />

and in your "res" directory create package "com" and put into it *.properties files for every language.

bundle.properties
bundle_en.properties
bundle_de.properties

Default properties is use for your default language. And for situation, that any key isn't find in any language, struts use key from default bundle.