...
As easy as conditionals are to use inside a Tapestry template, sometimes it's even easier to do it in Java code.
Missing Keys
If you reference a key that is not in the message catalog, Tapestry does not throw an exception (because that would make initially developing an application very frustrating). When a key can not be located, a "placeholder" message is generated, such as "\[\[missing key: key-not-found\]\]". Wiki Markup
Reloading
If you change a property file in a message catalog, you'll see the change immediately, just as with component classes and component templates (provided you're not running in production mode).
...
The PersistentLocale service can be used to programmatically override the locale. Note: You should be careful to only set the persistent locale to a supported locale.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Inject private PersistentLocale persistentLocale; void onActionFromLocaleToggle() { if ("en".equalsIgnoreCase(persistentLocale.get().getLanguage())) { persistentLocale.set(new Locale("de")); } else { persistentLocale.set(new Locale("en")); } return this; } public String getDisplayLanguage() { return persistentLocale.get().getDisplayLanguage(); } |
...
Fortunately, Tapestry uses all the same mechanisms for its own locale support as it provides for your application. So, to support other locales, just translate the built-in message catalog (property) files yourself:
Wiki Markup |
---|
{html |
} <style type="text/css">table.sectionMacro { width: auto; }</style> {html} |
Section | |||||||
---|---|---|---|---|---|---|---|
| |||||||
|
...