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 Summary
Modifier and TypeMethodDescriptionGet the set of available locales for this context.bestLocaleFor
(List<Locale> requested) Determine the best available locale for this context from a list of requested locales.Get the fallback locale for this context.name()
Get the name of the contexttags()
Get the tags of this context.Get anInvoker
using the specified locale.
-
Method Details
-
name
String name()Get the name of the context- Returns:
- The name of the context.
-
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
Get the tags of this context. The returned set is not modifiable.- Returns:
- A set of tags of this context.
-
bestLocaleFor
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
Get anInvoker
using the specified locale. TODO: Make sure that the specified locale is available (maybe usingbestLocaleFor(List)
)- Parameters:
locale
- The locale to be used.- Returns:
- An invoker that runs code using the specified locale.
-