class DeferredString
An object that encapsulates a string, evaluated only when needed.
class DeferredString extends String;
Description
This class is primarily used for string formatting and localization, usually as the result of a call to fmt or to process string-formatted bindings.
Each instance encapsulates an input string, possibly with format placeholders. The string is translated if possible, and cached until the cache is invalidated (e.g. when the application I18n provider is changed).
The format() method returns a new instance, where the input string is formatted with the provided values before caching.
Constructor
new DeferredString()
Creates a new lazily evaluated string instance.
Type members
interface DeferredString.I18nProvider static
An interface that provides functionality for translating and formatting strings.
Static members
DeferredString.setI18nInterface() static
Sets the current I18n provider.DeferredString.setErrorHandler() static
Sets the current error handler.
Instance members
toString()
Returns a string value, i.e. the result of evaluating the encapsulated string.format()
Returns a (lazily) formatted string incorporating the provided values.getFormatArgs()
Returns the arguments that were (last) passed toformat, or an empty array.getOriginal()
Returns the original (untranslated and unformatted) string or DeferredString instance.
Related
function fmt()
Returns a (lazily) formatted string incorporating the provided values.Binding.fmt() static
Creates a new binding for a string-formatted value.
