Interface L10N.Context

Enclosing interface:
L10N

public static interface L10N.Context
The represents current localization context. This includes information about the available locales, the fallback locale and some generic further categorisation through tags (e.g. "web" for both the public web site and the admin app).
  • Method Details

    • name

      String name()
      Get the name of the context
      Returns:
      The name of the context.
    • availableLocales

      Set<Locale> availableLocales()
      Get the set of available locales for this context.
      Returns:
      The set of available locales.
    • fallbackLocale

      Locale fallbackLocale()
      Get the fallback locale for this context. This is the locale to be used if none of the requested locales is acceptable.
      Returns:
      The fallback locale.
    • tags

      Set<String> tags()
      Get the tags of this context. The returned set is not modifiable.
      Returns:
      A set of tags of this context.
    • bestLocaleFor

      Locale bestLocaleFor(List<Locale> requested)
      Determine the best available locale for this context from a list of requested locales. The list is expected to be ordered by preference, the most preferred locale first.
      Parameters:
      requested - A list of requested/acceptable locales.
      Returns:
      The best matching locale.
    • using

      Invoker using(Locale locale)
      Get an Invoker using the specified locale. TODO: Make sure that the specified locale is available (maybe using bestLocaleFor(List))
      Parameters:
      locale - The locale to be used.
      Returns:
      An invoker that runs code using the specified locale.