TemplateModel
, TemplateScalarModel
ResourceBundleLocalizedString
public abstract class LocalizedString extends java.lang.Object implements TemplateScalarModel
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 "ja";
else
return "yes";
}
};
NOTHING
EMPTY_STRING
Constructor | Description |
---|---|
LocalizedString() |
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
getAsString() |
Returns the string representation of this model.
|
abstract java.lang.String |
getLocalizedString(java.util.Locale locale) |
public java.lang.String getAsString() throws TemplateModelException
TemplateScalarModel
null
, as that will cause exception.
(In classic-compatible mode the engine will convert null
into empty string, though.)getAsString
in interface TemplateScalarModel
TemplateModelException
public abstract java.lang.String getLocalizedString(java.util.Locale locale) throws TemplateModelException
TemplateModelException