Class DefaultI18NBean
java.lang.Object
com.atlassian.confluence.util.i18n.DefaultI18NBean
- All Implemented Interfaces:
I18NBean
Responsible for fetching internationalised text given a key.
By default, this will only search the default resource bundle for ConfluenceActionSupport.class
To access i18n keys in resource bundles for other classes: specify these classes in a list (use fully qualified class names)
-
Field Summary
Fields inherited from interface com.atlassian.confluence.util.i18n.I18NBean
DEFAULT_RESOURCE_BUNDLE
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultI18NBean
(Locale locale, com.atlassian.plugin.PluginAccessor pluginAccessor, I18nModeManager modeManager) Deprecated.since 5.2.DefaultI18NBean
(Locale locale, com.atlassian.plugin.tracker.PluginModuleTracker<TranslationTransform, TranslationTransformModuleDescriptor> pluginModuleTracker, I18nModeManager modeManager, List<ResourceBundle> resourceBundles) Deprecated.since 5.2. -
Method Summary
Modifier and TypeMethodDescriptionGet the i18n text for a particular key.Get the i18n text for a particular key, formatted through MessageFormat with the given arguments.Gets the i18n text for the specified message, formatting the message's value and arguments withMessageFormat
.Get the i18n text for a particular key, formatted through MessageFormat with the given arguments.getTextStrict
(String i18nKey) Needed for text that should not be marked up (for example, values for the 'accessKey' attribute in an input element)getTranslationsForPrefix
(String prefix) Gets a map of all keys that start with the given prefix, and their corresponding localised text, suitable for rendering withMessageFormat
.Same asI18NBean.getText(String)
but does not apply anyTranslationTransform
s.
-
Constructor Details
-
DefaultI18NBean
@Deprecated public DefaultI18NBean(Locale locale, com.atlassian.plugin.PluginAccessor pluginAccessor, I18nModeManager modeManager) Deprecated.since 5.2. Don't construct these directly, useDefaultI18NBeanFactory.getI18NBean(java.util.Locale)
-
DefaultI18NBean
@Deprecated public DefaultI18NBean(Locale locale, com.atlassian.plugin.tracker.PluginModuleTracker<TranslationTransform, TranslationTransformModuleDescriptor> pluginModuleTracker, I18nModeManager modeManager, List<ResourceBundle> resourceBundles) Deprecated.since 5.2. Don't construct these directly, useDefaultI18NBeanFactory.getI18NBean(java.util.Locale)
-
-
Method Details
-
getText
Get the i18n text for a particular key. -
getText
Get the i18n text for a particular key, formatted through MessageFormat with the given arguments. Works similarly toActionSupport.getText(String, java.util.List)
, but the array form is necessary to work well with Velocity.- Specified by:
getText
in interfaceI18NBean
- Parameters:
key
- the key to retrieve the i18n text forargs
- an array of arguments to be passed in to the MessageFormat#format for this text- Returns:
- the appropriate i18n text, formatted with the supplied arguments
- See Also:
-
ActionSupport.getText(String, java.util.List)
MessageFormat
-
getText
Get the i18n text for a particular key, formatted through MessageFormat with the given arguments. Works similarly toActionSupport.getText(String, java.util.List)
, but the array form is necessary to work well with Velocity.- Specified by:
getText
in interfaceI18NBean
- Parameters:
key
- the key to retrieve the i18n text forargs
- an array of arguments to be passed in to the MessageFormat#format for this textonlyRawValue
- identify the need of processing the value of the key, like escape and format- Returns:
- the appropriate i18n text, formatted with the supplied arguments
- See Also:
-
ActionSupport.getText(String, java.util.List)
MessageFormat
-
getUntransformedRawText
Description copied from interface:I18NBean
Same asI18NBean.getText(String)
but does not apply anyTranslationTransform
s.- Specified by:
getUntransformedRawText
in interfaceI18NBean
- Parameters:
key
- the key of the i18n message- Returns:
- the un-formatted text or the key itself if no i18n message can be found
-
getText
-
getText
Description copied from interface:I18NBean
Gets the i18n text for the specified message, formatting the message's value and arguments withMessageFormat
. -
getTextStrict
Needed for text that should not be marked up (for example, values for the 'accessKey' attribute in an input element)- Specified by:
getTextStrict
in interfaceI18NBean
- Parameters:
i18nKey
- the key to retrieve localised text for- Returns:
- text for i18nKey (and excludes markup regardless of settings)
-
getResourceBundle
- Specified by:
getResourceBundle
in interfaceI18NBean
-
getTranslationsForPrefix
Description copied from interface:I18NBean
Gets a map of all keys that start with the given prefix, and their corresponding localised text, suitable for rendering withMessageFormat
. It is strongly recommended that plugin developers not use this, as its performance is not guaranteed. Instead, apply translations for specific keys (e.g. via the jsI18n web resource transformer).- Specified by:
getTranslationsForPrefix
in interfaceI18NBean
-