Joined: 10/01/2008 08:20:15
OBS: Mentawai i18n files are auto-reloadable, in other words, from time to time the file is checked for modifications. If it was modified it is reloaded. That means you do NOT have to restart your web container each time you change some text inside your i18n file.
When the user is authenticated, you set his locale:
Then all you have to do is create a directory i18n and place one file per language in there. Example:
Then in the JSP you can do:
To better organize your text file you can use prefixes. Example:
Then in the JSP you do:
If you have a text that is global, for example, the title of all pages, you can skip the prefix by doing:
An in the JSP:
And there is much more:
You can have localized texts inside your actions.
If the user is not logged, you can pick a locale based on browser request, cookie, etc.
You can use placeholders to help the designer:
You can configure what to do if the key is not found: show the default locale translation or show the key with exclamation marks around it so someone can spot the problem and fix it. (good for QA)