freemarker.template
Class LocalizedString
java.lang.Object
freemarker.template.LocalizedString
- TemplateModel, TemplateScalarModel
public abstract class LocalizedString
extends java.lang.Object
An abstract base class for scalars that vary by locale.
Here is a silly usage example.
TemplateScalarModel localizedYes = new LocalizedString() {
public String getLocalizedString(java.util.Locale locale) {
String lang = locale.getLanguage();
if "fr".equals(lang)
return "oui";
else if "de".equals(lang)
return "s?";
else
return "yes";
}
};
getAsString
public String getAsString()
throws TemplateModelException
Returns the string representation of this model. In general, avoid
returning null. In compatibility mode the engine will convert
null into empty string, however in normal mode it will
throw an exception if you return null from this method.
- getAsString in interface TemplateScalarModel