TContext - the same class as TContext for
I18nHandlerInContext subclass being usedpublic class I18nItemInContextAny<TContext> extends I18nItemInContext<TContext>
A class that implements multi-locale resource in
MessageFormat style with arbitrary number of
arguments, to be used together with I18nHandlerInContext
subclasses.
Allowing an arbitrary number of arguments has a disadvantage that
compile-time argument type consistency is not available. With this in mind
fixed-arguments-number classes I18nItemInContext1,
I18nItemInContext2 and I18nItemInContext3 may be preferable
whenever possible.
See package info for a usage example.
| Constructor and Description |
|---|
I18nItemInContextAny(LocalizedMessage... data)
The public constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
s(TContext contextData,
Object... args)
The method to obtain a formatted message in a locale that is best
preferred for the current user.
|
getBestLanguage, getBestLocaleAndMessage, getBestLocaleTag, obtainMessageFormatgetBestLanguage, getBestLocaleAndMessage, getBestLocaleTag, obtainMessageFormatpublic I18nItemInContextAny(LocalizedMessage... data)
data - a varargs array of translations for a message to various
localespublic String s(TContext contextData, Object... args)
contextData - an instance of context-specific data to retrieve user
preferences fromargs - a varargs array of message formatting arguments