public class MessageUtilImpl extends Object implements MessageUtil
MessageUtil.FactoryI18nHelper.BeanFactory| Modifier and Type | Method and Description |
|---|---|
String |
getAnchorTagWithInternalLink(String keyOfLink)
Get a
String representation of an anchor tag with an internal link and link text. |
URI |
getBaseUri() |
String |
getBaseUrl() |
String |
getCanonicalBaseUrl() |
ResourceBundle |
getDefaultResourceBundle()
Returns the default
ResourceBundle within JIRA, which does not include translations provided by plugins. |
HelpUrl |
getDefaultUrl()
Returns a
HelpUrl that can be used for generic JIRA help. |
String |
getExternalLink(String key)
Get the external link for the specified key.
|
String |
getExternalLink(String key,
Object parameters)
Get the external link for the specified key with the specified parameters formatted into the link.
|
String |
getExternalLink(String key,
String value1)
Get the external link for the specified key with the specified parameter formatted into the link.
|
String |
getExternalLink(String key,
String value1,
String value2)
Get the external link for the specified key with the specified parameters formatted into the link.
|
String |
getExternalLink(String key,
String value1,
String value2,
String value3)
Get the external link for the specified key with the specified parameters formatted into the link.
|
String |
getExternalLink(String key,
String value1,
String value2,
String value3,
String value4)
Get the external link for the specified key with the specified parameters formatted into the link.
|
Set<String> |
getKeysForPrefix(String prefix)
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.
|
Locale |
getLocale() |
ResourceBundle |
getResourceBundle()
Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.
|
String |
getText(String key)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object parameters)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found.
|
String |
getText(String key,
Object value1,
Object value2,
Object value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6,
Object value7)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6,
Object value7,
Object value8)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4,
String value5,
String value6,
String value7)
Called to return the formatted text of the specified i18n key
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4,
String value5,
String value6,
String value7,
String value8,
String value9)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getUnescapedText(String key)
Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getUntransformedRawText(String key)
Same as
I18nHelper.getUnescapedText(String) but does not apply any TranslationTransforms. |
HelpUrl |
getUrl(String key)
Returns a
HelpUrl associated with the passed key. |
Set<String> |
getUrlKeys()
Return all the keys that have an associated
HelpUrl. |
boolean |
isKeyDefined(String key)
For the given key, checks whether such a key is defined in the locale context represented by this helper
instance.
|
<I,O> O |
runWithStaticBaseUrl(I input,
com.google.common.base.Function<I,O> runnable)
Run the passed function in an environment where JIRA's configured
baseURL is always used. |
@Nonnull public HelpUrl getUrl(String key)
MessageUtilHelpUrl associated with the passed key. The MessageUtil.getDefaultUrl()
URL is returned if the key has no associated URL.getUrl in interface MessageUtilkey - the key to search for.HelpUrlHelpUrls.getUrl(String)@Nonnull public HelpUrl getDefaultUrl()
MessageUtilHelpUrl that can be used for generic JIRA help. It commonly points at
the JIRA help index/landing page.getDefaultUrl in interface MessageUtilHelpUrl for this instance.HelpUrls.getDefaultUrl()@Nonnull public Set<String> getUrlKeys()
MessageUtilHelpUrl.getUrlKeys in interface MessageUtilHelpUrl.HelpUrls.getUrlKeys()public String getExternalLink(String key)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.ExternalLinkUtil.getProperty(String)public String getExternalLink(String key, String value1)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.value1 - specified parameter.ExternalLinkUtil.getProperty(String, String)public String getExternalLink(String key, String value1, String value2)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.value1 - first specified parameter.value2 - second specified parameter.ExternalLinkUtil.getProperty(String, String, String)public String getExternalLink(String key, String value1, String value2, String value3)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.value1 - first specified parameter.value2 - second specified parameter.value3 - third specified parameter.ExternalLinkUtil.getProperty(String, String, String, String)public String getExternalLink(String key, String value1, String value2, String value3, String value4)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.value1 - first specified parameter.value2 - second specified parameter.value3 - third specified parameter.value4 - third specified parameter.ExternalLinkUtil.getProperty(String, String, String, String, String)public String getExternalLink(String key, Object parameters)
MessageUtilgetExternalLink in interface MessageUtilkey - of the external link.parameters - specified parameters, typically a List of parameters.ExternalLinkUtil.getProperty(String, Object)public String getAnchorTagWithInternalLink(String keyOfLink)
MessageUtilString representation of an anchor tag with an internal link and link text. The internal link would
be the JIRA base url with the path of the specified key appended.
Example for default implementation:
#Config internal-help-paths.properties:
app_access_local.path=/secure/admin/ApplicationAccess.jspa
app_access_local.title=application.access.configuration.title
#Config JiraWebActionSupport.properties:
application.access.configuration.title=Application Access
#Usage:
messageUtil.getAnchorTagWithInternalLink("app_access_local");
#Result:
Application access
getAnchorTagWithInternalLink in interface MessageUtilkeyOfLink - the key for the internal link to be appended with the base URL.String representation of an anchor tag with an internal link and link text.I18nHelperpublic Locale getLocale()
getLocale in interface I18nHelperLocale that is associated with this I18nHelperpublic ResourceBundle getDefaultResourceBundle()
I18nHelperResourceBundle within JIRA, which does not include translations provided by plugins.
For use cases where non-English translations are required, call I18nHelper.getResourceBundle() instead.getDefaultResourceBundle in interface I18nHelperI18nHelper.getResourceBundle()public String getUnescapedText(String key)
I18nHelpergetUnescapedText in interface I18nHelperkey - the key of the i18n messagepublic String getUntransformedRawText(String key)
I18nHelperI18nHelper.getUnescapedText(String) but does not apply any TranslationTransforms.getUntransformedRawText in interface I18nHelperkey - the key of the i18n messagepublic boolean isKeyDefined(String key)
I18nHelperFor the given key, checks whether such a key is defined in the locale context represented by this helper instance. Note that the actual translation may be in the 'fallback' default locale rather than the current locale.
The contract of this is method is correlated with I18nHelper.getUntransformedRawText(String), whereby if this
method returns false, I18nHelper.getUntransformedRawText(String) will return the key provided as an
argument, and if this method returns true, I18nHelper.getUntransformedRawText(String) will generally
return the translation, which in some very unlikely cases may be equal to the key.
isKeyDefined in interface I18nHelperkey - translation keytrue, if any translation for such key exists, false otherwisepublic String getText(String key)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagepublic String getText(String key, String value1)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagepublic String getText(String key, String value1, String value2)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagevalue6 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagevalue6 - a value to be substituted into the messagevalue7 - a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagevalue6 - a value to be substituted into the messagevalue7 - a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7, Object value8)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagevalue6 - a value to be substituted into the messagevalue7 - a value to be substituted into the messagevalue8 - a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9)
I18nHelpergetText in interface I18nHelperkey - the key of the i18n messagevalue1 - a value to be substituted into the messagevalue2 - a value to be substituted into the messagevalue3 - a value to be substituted into the messagevalue4 - a value to be substituted into the messagevalue5 - a value to be substituted into the messagevalue6 - a value to be substituted into the messagevalue7 - a value to be substituted into the messagevalue8 - a value to be substituted into the messagevalue9 - a value to be substituted into the messagepublic String getText(String key, Object parameters)
I18nHelper
The object passed in can be an array, a List} or a single parameter object. It will be then
used as substitution parameters within the message.
getText in interface I18nHelperkey - the key of the i18n messageparameters - This can be an Array, a List and Array or a single object parameterpublic Set<String> getKeysForPrefix(String prefix)
I18nHelpergetKeysForPrefix in interface I18nHelperprefix - The prefix for i18n keys. May not be nullpublic ResourceBundle getResourceBundle()
I18nHelpergetResourceBundle in interface I18nHelperI18nHelper.getDefaultResourceBundle()@Nonnull public String getBaseUrl()
getBaseUrl in interface BaseUrl@Nonnull public String getCanonicalBaseUrl()
getCanonicalBaseUrl in interface BaseUrlpublic URI getBaseUri()
getBaseUri in interface BaseUrlBaseUrl.getCanonicalBaseUrl()@Nullable public <I,O> O runWithStaticBaseUrl(@Nullable I input, @Nonnull com.google.common.base.Function<I,O> runnable)
BaseUrlbaseURL is always used. This basically
makes the passed function ignore any smart baseURL that can be generated from the request associated
with the calling thread.runWithStaticBaseUrl in interface BaseUrlinput - input to pass to the function.runnable - the function to execute.Copyright © 2002-2019 Atlassian. All Rights Reserved.