Interface L10N.Context

Enclosing interface:

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
      The name of the context.
    • availableLocales

      Set<Locale> availableLocales()
      Get the set of available locales for this context.
      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.
      The fallback locale.
    • tags

      Set<String> tags()
      Get the tags of this context. The returned set is not modifiable. TODO: Make a case-insensitive set?
      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.
      requested - A list of requested/acceptable locales.
      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))
      locale - The locale to be used.
      An invoker that runs code using the specified locale.