If you just need a resource file to be selected as default simply omit the language code in the file name:
Texts_en_GB.properties
Texts_pt_BR.properties
Texts.propertiers ( <-- this one will be selected when no resources for requested language could be found)
EDIT:
There is a bug in Struts 1.x regarding default messages handling if you define your messages in default mode (which will be choosed if you omit the mode
property):
<message-resources key="Texts" parameter="com.mycompany.Texts" null="false"/>
and the default locale is not the same language as in the properties without postfix: Texts.properties
.
Let's say our Texts.properties
file will contain English text. Additionally there is a German translation: Texts_de.properties
. Our default system locale is French because we're running on a French server (and we didn't set it explicitly).
If your first request after server startup requests the German translation of a page all subsequent requests of the same page will be served in German if there is no explicit properties file for the requested language code.
If the first request asks for a English page every subsequent requests of the same page will be served in English if there is no explicit properties file for the requested language code (which is what we want).
The solution for this problem is to set the mode property for every message resource declaration:
<message-resources key="Texts" parameter="com.mycompany.Texts" null="false">
<set-property key="mode" value="JSTL" />
</message-resources>