com.atlassian.bitbucket.i18n.I18nService |
Serves localized text from properties files.
Using property files for localization is described in Internationalising your plugin.
Fallback messages should never be specified by internal developers. All internal messages should be added to properties files for translation. The variants accepting a fallback message are intended for external plugin developers only. Internal developers should use:
Plugin developers are also encouraged to use properties files but the ability to specify the message directly in the call is provided as a convenience, especially for in-house plugins which will only be used by speakers of a single language.Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Given a property key and a list of arguments, it returns:
| |||||||||||
Given a property key prefix, this method will return all translations where the key starts with the given prefix as key ->
value mappings.
| |||||||||||
Given a property key prefix, this method will return all translations where the key starts with the given prefix as key ->
value mappings using the current locale.
| |||||||||||
Given a property key, a fallback message and a list of arguments, it returns:
| |||||||||||
Given an
I18nKey it returns:
| |||||||||||
Given a locale, a property key and a list of arguments, it returns:
| |||||||||||
Given a
key it returns:
| |||||||||||
Given a property key and a list of arguments, it returns:
| |||||||||||
Given a locale and a property key it returns:
| |||||||||||
Given a property key it returns:
| |||||||||||
Given a property key and the fallback text message, it returns:
| |||||||||||
Given a property key, the fallback text message and a list of arguments, it returns:
| |||||||||||
Given a property key, a locale, a fallback text message and a list of arguments, it returns:
|
Given a property key and a list of arguments, it returns:
KeyedMessage
that composes the localized and formatted message for the current locale,
the localized and formatted message for the root locale and the original key for the message. Otherwise...The KeyedMessage returned is useful for priming Exceptions where the localized and non-localized messages need to differ to ensure the end use sees the message localized in their language but the logs record the message for the root locale.
key | the key for the i18ned message |
---|---|
arguments | optional list of arguments for the message. |
Given a property key prefix, this method will return all translations where the key starts with the given prefix as key -> value mappings.
prefix | the prefix for a particular key to start with. Empty string will match everything, which may be
slow. Throws NullPointerException if null . |
---|---|
locale | the locale for which to lookup translations. Throws NullPointerException if null . |
NullPointerException | if prefix or link are null
|
---|
Given a property key prefix, this method will return all translations where the key starts with the given prefix as key -> value mappings using the current locale. The current locale used is the one for the request currently in scope or the default locale if that is not available.
prefix | the prefix for a particular key to start with. Empty string will match everything, which may be
slow. Throws NullPointerException if null . |
---|
NullPointerException | if link is null
|
---|
Given a property key, a fallback message and a list of arguments, it returns:
KeyedMessage
that composes the localized and formatted message for the current locale,
the localized and formatted message for the root locale and the original key for the message. Otherwise...The KeyedMessage returned is useful for priming Exceptions where the localized and non-localized messages need to differ to ensure the end user sees the message localized in their language but the logs record the message for the root locale.
key | the key for the i18ned message |
---|---|
fallbackMessage | the optional message to fallback to if lookup fails |
arguments | optional list of arguments for the message. |
Given an I18nKey
it returns:
KeyedMessage
that composes the localized and formatted message for the current locale,
the localized and formatted message for the root locale and the original key for the message. Otherwise...
The KeyedMessage returned is useful for priming Exceptions where the localized and non-localized messages
need to differ to ensure the end use sees the message localized in their language but the logs record the
message for the root locale.
The result of this method should be the same as calling #createKeyedMessage(i18nKey.getKey(), i18nKey.getArguments())
i18nKey | the key for the i18ned message |
---|
Given a locale, a property key and a list of arguments, it returns:
locale | the locale for the lookup |
---|---|
key | the key for the i18ned message |
arguments | optional list of arguments for the message. |
Given a key
it returns:
key | the key for the i18ned message |
---|
Given a property key and a list of arguments, it returns:
key | the key for the i18ned message |
---|---|
arguments | optional list of arguments for the message. |
Given a locale and a property key it returns:
locale | the locale for the lookup |
---|---|
key | the key for the i18n pattern |
java.text.MessageFormat
or with AJS.format()
Given a property key it returns:
key | the key for the i18n pattern |
---|
java.text.MessageFormat
or with AJS.format()
Given a property key and the fallback text message, it returns:
key | the key for the i18n pattern |
---|---|
fallbackPattern | the optional pattern to fallback to if lookup fails |
java.text.MessageFormat
or with AJS.format()
Given a property key, the fallback text message and a list of arguments, it returns:
key | the key for the i18ned message |
---|---|
fallbackMessage | the optional message to fallback to if lookup fails |
arguments | optional list of arguments for the message. |
Given a property key, a locale, a fallback text message and a list of arguments, it returns:
locale | the locale for the lookup |
---|---|
key | key for the i18ned message |
fallbackMessage | the optional message to fallback to if lookup fails |
arguments | optional list of arguments for the message. |