Interface LocalizedTextResolver

All Known Subinterfaces:
ViewElementBuilderContext
All Known Implementing Classes:
DefaultViewElementBuilderContext, IteratorViewElementBuilderContext, MessageCodeSupportingLocalizedTextResolver

public interface LocalizedTextResolver
Interface defining a contract for localizing strings, usually for translation purposes. The default implementation is the MessageCodeSupportingLocalizedTextResolver that supports regular strings (which will be left untouched) and message code based strings (eg. #{my.code=My default text.}) whose message code will be resolved instead.
Since:
2.1.0
Author:
Arne Vandamme
  • Method Details

    • resolveText

      String resolveText(String text)
      Localize the text using the Locale attached to the current thread.
      Parameters:
      text - to localize
      Returns:
      localized text
    • resolveText

      String resolveText(String text, Locale locale)
      Localize the text using the Locale specified.
      Parameters:
      text - to localize
      locale - to use
      Returns:
      localized text
    • resolveText

      String resolveText(String text, String defaultValue)
      Localize the text using the Locale attached to the current thread.
      Parameters:
      text - to localize
      defaultValue - to return if resolved value is null
      Returns:
      localized text
    • resolveText

      String resolveText(String text, String defaultValue, Locale locale)
      Localize the text using the Locale specified.
      Parameters:
      text - to localize
      defaultValue - to return if resolved value is null
      Returns:
      localized text