Interface Question.I18nLookupFunction

Enclosing class:
Question
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Question.I18nLookupFunction

A functional interface for returning translated strings for a question.

  • Method Summary

    Modifier and Type
    Method
    Description
    apply(Question question, String suffix, Locale locale)
    Lookup a string for a question.
  • Method Details

    • apply

      Optional<String> apply(Question question, String suffix, Locale locale)

      Lookup a string for a question. No MessageSource argument is given - it is expected that the function will 'close over' one to use as a source of translations.

      Parameters:
      question - the question that needs a translation
      suffix - some discriminator that identifies the kind of text we're looking up,e.g. title or description - it is expected that this gets used to build a key when doing an i18n, but it could also be used in a case statement (I guess?)
      locale - the locale that the user is in
      Returns:
      a translated string, or null if nothing is present.