public class ResourceBundleHelper extends LocaleAwareValueHelper
First register the helper instance:
MustacheEngineBuilder.newBuilder().registerHelper("msg", new ResourceBundleHelper("msg")).build();
Than use the helper in the template:
{{msg "my.key"}}
The key need not be a string literal:
{{msg foo.key}}
You may also override the default baseName:
{{msg "my.key" baseName="messages"}}
And also use Formatter or MessageFormat:
{{msg "my.key" format="printf"}}
See also ResourceBundleHelper.Format for more info about formats.LocaleSupport| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceBundleHelper.Format |
VALUE_TAG_TYPESHELPER_TAG_TYPES| Constructor and Description |
|---|
ResourceBundleHelper(String defaultBaseName) |
ResourceBundleHelper(String defaultBaseName,
ResourceBundleHelper.Format defaultFormat) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Options options)
Execute the helper.
|
getCurrentLocale, initallowedTagTypesnumberOfRequiredParameters, validateappend, getHashValue, isSection, isUnescapeVariable, isVariablegetConfigurationKeysclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfigurationKeyspublic ResourceBundleHelper(String defaultBaseName)
defaultBaseName - public ResourceBundleHelper(String defaultBaseName, ResourceBundleHelper.Format defaultFormat)
defaultBaseName - defaultFormat - Copyright © 2014. All Rights Reserved.