public abstract class AbstractI18nResolver extends Object implements I18nResolver
I18nResolver
, which host applications can use to get started.
Subclasses should only need to implement the abstract methods resolveText(String, java.io.Serializable[])
,
resolveText(Locale, String, Serializable[])
, I18nResolver.getRawText(String)
and
I18nResolver.getRawText(java.util.Locale, String)
.Constructor and Description |
---|
AbstractI18nResolver() |
Modifier and Type | Method and Description |
---|---|
Message |
createMessage(String key,
Serializable... arguments)
Creates an instance of Message.
|
MessageCollection |
createMessageCollection() |
String |
getText(Locale locale,
Message message)
Given a
Message this method:
returns the i18ned text formatted with the message arguments if the message key can be resolved.
Otherwise, returns the message key (formatted with the message arguments).
|
String |
getText(Locale locale,
String key)
Does the same as
I18nResolver.getText(Locale, String, java.io.Serializable...) however it is needed for velocity. |
String |
getText(Locale locale,
String key,
Serializable... arguments)
Given a key and a list of arguments:
this method returns the i18ned text formatted with the arguments if the key can be resolved.
otherwise, the key itself will be returned (after formatting).
Arguments may also be of the form
Message which means they will be resolved as well before
being included as an argument. |
String |
getText(Message message)
Given a
Message this method:
returns the i18ned text formatted with the message arguments if the message key can be resolved.
Otherwise, returns the message key (formatted with the message arguments).
Uses the default locale. |
String |
getText(String key)
Does the same as
I18nResolver.getText(String, java.io.Serializable...) however it is needed for velocity. |
String |
getText(String key,
Serializable... arguments)
Given a key and a list of arguments:
this method returns the i18ned text formatted with the arguments if the key can be resolved.
otherwise, the key itself will be returned (after formatting).
Arguments may also be of the form
Message which means they will be resolved as well before
being included as an argument. |
abstract String |
resolveText(Locale locale,
String key,
Serializable[] arguments)
Subclasses should implement this method to dispatch to a matching language in the given locale.
|
abstract String |
resolveText(String key,
Serializable[] arguments)
Subclasses should implement this method to dispatch to a matching language in (in order of preference):
the user's locale
the application's configured locale, or
the system default locale
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllTranslationsForPrefix, getAllTranslationsForPrefix, getRawText, getRawText
public String getText(String key, Serializable... arguments)
I18nResolver
Message
which means they will be resolved as well before
being included as an argument. Uses the default locale.getText
in interface I18nResolver
key
- key for the i18ned messagearguments
- Optional list of arguments for the message.public String getText(Locale locale, String key, Serializable... arguments)
I18nResolver
Message
which means they will be resolved as well before
being included as an argument.getText
in interface I18nResolver
locale
- the locale to use for the i18ned textkey
- key for the i18ned messagearguments
- Optional list of arguments for the message.public String getText(String key)
I18nResolver
I18nResolver.getText(String, java.io.Serializable...)
however it is needed for velocity.getText
in interface I18nResolver
key
- key for the i18ned messagepublic String getText(Locale locale, String key)
I18nResolver
I18nResolver.getText(Locale, String, java.io.Serializable...)
however it is needed for velocity.getText
in interface I18nResolver
locale
- the locale to use for the i18ned textkey
- key for the i18ned messagepublic String getText(Message message)
I18nResolver
Message
this method:
getText
in interface I18nResolver
message
- The message to i18npublic String getText(Locale locale, Message message)
I18nResolver
Message
this method:
getText
in interface I18nResolver
locale
- the locale to use for the i18ned textmessage
- The message to i18npublic abstract String resolveText(String key, Serializable[] arguments)
key
- the key to translate.arguments
- the arguments to be inserted into the translated string.public abstract String resolveText(Locale locale, String key, Serializable[] arguments)
locale
- the locale to translate into.key
- the key to translate.arguments
- the arguments to be inserted into the translated string.public Message createMessage(String key, Serializable... arguments)
I18nResolver
createMessage
in interface I18nResolver
key
- The message keyarguments
- The arguments to interpolatepublic MessageCollection createMessageCollection()
createMessageCollection
in interface I18nResolver
Copyright © 2015 Atlassian. All rights reserved.