Docs (4.0.0)
Text formatting

class LazyString

An object that encapsulates a string, evaluated only when needed.

class LazyString
extends String

Description

This class is primarily used for string formatting and localization, usually as the result of a call to strf or to process string-formatted bindings.

Constructor

Static Members

Instance Members

  • toStringReturns a string value, i.e. the result of evaluating the encapsulated string.
  • getFormatArgs()Returns the arguments that were (last) passed to format, or an empty array.
  • getOriginal()Returns the original (untranslated and unformatted) string or LazyString instance.
  • cache()Caches the result after evaluating it once.
  • translate()Translates the string using the current I18n provider.
  • format(…args)Replaces placeholders in the string with string-formatted values.

Related