Class ResourceBundleModel

java.lang.Object
freemarker.ext.beans.BeanModel
freemarker.ext.beans.ResourceBundleModel
All Implemented Interfaces:
WrapperTemplateModel, AdapterTemplateModel, TemplateHashModel, TemplateHashModelEx, TemplateMethodModel, TemplateMethodModelEx, TemplateModel, TemplateModelWithAPISupport

public class ResourceBundleModel extends BeanModel implements TemplateMethodModelEx

A hash model that wraps a resource bundle. Makes it convenient to store localized content in the data model. It also acts as a method model that will take a resource key and arbitrary number of arguments and will apply MessageFormat with arguments on the string represented by the key.

Typical usages:

  • bundle.resourceKey will retrieve the object from resource bundle with key resourceKey
  • bundle("patternKey", arg1, arg2, arg3) will retrieve the string from resource bundle with key patternKey, and will use it as a pattern for MessageFormat with arguments arg1, arg2 and arg3