I am using JSF and I want to use message bundles so I added the XML configuration below. Now I wonder if someone could write some experiences they had when using them. Is it best practice to have one big properties file that contain all translation on the page, if so how do you name your keys. If not, then I guess you have multiple resource files, how do you structure them – what part of the page do they provide messages for? – and any naming practices?
I know this may be subjective but it could be valuable insights for me anyway.
<application>
<resource-bundle>
<base-name>com.myapp.blah</base-name>
<var>msgs</var>
</resource-bundle>
</application>
I suggest you begin with the single File approach, one per language. If it grows in a level that you simply can’t manage anymore, thousands of lines, than you might split it.
Then you can internationalize your pages using a template that will have:
and you can enable a select component to hold the available languages for the users to switch:
and in faces-config.xml:
then you shall have one file per language:
ApplicationResources.properties
ApplicationResources_en.properties
ApplicationResources_pt_BR.properties