public abstract class LocalizedString extends 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 "sí";
else
return "yes";
}
};
EMPTY_STRINGNOTHING| Constructor and Description |
|---|
LocalizedString() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAsString()
Returns the
String representation of this model. |
abstract String |
getLocalizedString(Locale locale) |
public String getAsString() throws TemplateModelException
TemplateScalarModelString representation of this model. Returning null is illegal, and may cause
exception in the calling code. (Except, in classic-compatible mode the engine will convert null into
empty string.)getAsString in interface TemplateScalarModelTemplateModelExceptionpublic abstract String getLocalizedString(Locale locale) throws TemplateModelException
TemplateModelException