Class TranslateBundleFunction
java.lang.Object
com.github.mustachejava.functions.TranslateBundleFunction
- All Implemented Interfaces:
TemplateFunction,Function<String,String>
Mustache.java translation function based on localized ResourceBundles.
Usage code with a class:
public class ... {
TemplateFunction trans = new TranslateBundleFunction("com.project.locale", Locale.US);
...
}
Usage code with a Map:
HashMap<String, Object> scopes = new HashMap<String, Object>();
scopes.put("trans", new TranslateBundleFunction("com.project.locale", Locale.US));
...
Usage in template:
... {{#trans}}TranslatedLabel1{{/trans}} ...
... {{#trans}}TranslatedLabel2 param1=newparam1 param2=newparma2{{/trans}}
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTranslateBundleFunction(String bundle, Locale locale) Constructor for a Mustache.java translation function. -
Method Summary
-
Field Details
-
res
-
-
Constructor Details
-
TranslateBundleFunction
Constructor for a Mustache.java translation function.- Parameters:
bundle- resource bundle namelocale- translation locale
-
-
Method Details