freemarker.template

## Class LocalizedString

- java.lang.Object
- - freemarker.template.LocalizedString

All Implemented Interfaces:
  TemplateModel, TemplateScalarModel

Direct Known Subclasses:
  ResourceBundleLocalizedString

    public abstract class LocalizedString
    extends Object
    implements TemplateScalarModel

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"; } };`

### Field Summary

### Fields inherited from interface freemarker.template.TemplateScalarModel

`EMPTY_STRING`

### Fields inherited from interface freemarker.template.TemplateModel

`NOTHING`

### Constructor Summary

Constructors
Constructor and Description
`LocalizedString()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`String` `getAsString()` Returns the string representation of this model.
`abstract String` `getLocalizedString(Locale locale)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### LocalizedString

    public LocalizedString()

### Method Detail

#### getAsString

    public String getAsString()
                       throws TemplateModelException

Description copied from interface: `TemplateScalarModel`
Returns the string representation of this model. Don't return `null`, as that will cause exception. (In classic-compatible mode the engine will convert `null` into empty string, though.)

Objects of this type should be immutable, that is, calling `TemplateScalarModel.getAsString()` should always return the same value as for the first time.

Specified by:
  `getAsString` in interface `TemplateScalarModel`
Throws:
  `TemplateModelException`

#### getLocalizedString

    public abstract String getLocalizedString(Locale locale)
                                       throws TemplateModelException

Throws:
  `TemplateModelException`