com.atlassian.jira.util
Interface I18nHelper

All Known Implementing Classes:
AboutPage, AbstractAddScheme, AbstractAddWorkflowTransitionDescriptor, AbstractAddWorkflowTransitionDescriptorParams, AbstractAdministerFilter, AbstractBrowser, AbstractBulkOperationAction, AbstractBulkOperationDetailsAction, AbstractBulkWatchOperationAction, AbstractCommentableAssignableIssue, AbstractCommentableIssue, AbstractConfigureFieldLayout, AbstractConstantAction, AbstractConvertIssue, AbstractCopyScheme, AbstractDashboardAdministration, AbstractDeleteConstant, AbstractDeleteScheme, AbstractDeleteWorkflowTransitionDescriptor, AbstractEditConfigurationItemAction, AbstractEditConstant, AbstractEditFieldLayoutItem, AbstractEditFieldLayoutSchemeAction, AbstractEditScheme, AbstractEditWorkflowTransitionDescriptorParams, AbstractFieldLayoutAction, AbstractFieldScreenAction, AbstractFieldScreenSchemeAction, AbstractFieldScreenSchemeItemAction, AbstractFilterAction, AbstractImportEntity, AbstractImportIssue, AbstractIssueLinkAction, AbstractIssueSelectAction, AbstractManageIssueTypeOptionsAction, AbstractPluggableTabPanelAction, AbstractProjectAction, AbstractProjectAndSchemeAwareAction, AbstractProjectImportProgress, AbstractProjectImportUsersMissing, AbstractProjectRole, AbstractRoleActorAction, AbstractRoleActors, AbstractSchemeAware, AbstractSchemeAwareAction, AbstractSelectProjectScheme, AbstractSetupAction, AbstractTrustedApplicationAction, AbstractViewConstants, AbstractViewIssue, AbstractViewSchemes, AbstractWorkflowAction, AbstractWorkflowDraftResultAction, AbstractWorkflowStep, AbstractWorkflowTransition, AbstractWorkflowTransitionAction, AbstractWorklogAction, AcknowledgeTask, AddComment, AddComponent, AddFieldConfiguration, AddFieldConfigurationScheme, AddFieldScreenSchemeItem, AddIssueSecurity, AddIssueTypeScreenScheme, AddIssueTypeScreenScreenSchemeAssociation, AddIssueTypeToFieldConfigurationAssociation, AddNewIssueTypeToScheme, AddNotification, AddPermission, AddPortalPage, AddProject, AddProjectCategory, AddScheme, AddScheme, AddScheme, AddScheme, AddUser, AddVersion, AddWebLink, AddWorkflowTransition, AddWorkflowTransitionCondition, AddWorkflowTransitionConditionParams, AddWorkflowTransitionFunctionParams, AddWorkflowTransitionPostFunction, AddWorkflowTransitionValidator, AddWorkflowTransitionValidatorParams, AdjustFavourite, AdvancedApplicationProperties, AllUsersRememberMeCookies, AssignIssue, AssociateFieldToScreens, AssociateIssueTypeSchemes, AssociateIssueTypeSchemesWithDefault, AttachFile, AttachScreenshot, AttachTemporaryFile, BackingI18n, BrowseProjects, BulkCancelWizard, BulkChooseOperation, BulkDelete, BulkEdit, BulkEdit1, BulkEditUserGroups, BulkMigrate, BulkMove, BulkOperationProgress, BulkUnwatch, BulkWatch, BulkWorkflowTransition, CantBrowseCreatedIssue, ChangePassword, ChangeSharedDashboardOwner, ChangeSharedFilterOwner, CleanData, ClearRememberMeCookies, CloneIssueDetails, CloneWorkflow, CommentAssignIssue, ConfigureCrowdServer, ConfigureCustomField, ConfigureFieldLayout, ConfigureFieldLayoutScheme, ConfigureFieldScreen, ConfigureFieldScreenScheme, ConfigureIssueTypeOptionScheme, ConfigureIssueTypeScreenScheme, ConfigureLogging, ConfigureOptionScheme, ConfigurePortalPages, ConfigureReport, ConfirmNewInstallationWithOldLicense, ContactAdministrators, ConvertIssueToSubTask, ConvertSubTaskToIssue, CopyFieldLayout, CopyFieldLayoutScheme, CopyScheme, CopyScheme, CopyScheme, CopyScheme, CreateCustomField, CreateDraftWorkflow, CreateIssue, CreateIssueDetails, CreateSubTaskIssue, CreateSubTaskIssueDetails, CreateWorklog, CurrentUsersList, Dashboard, DeleteAttachment, DeleteComment, DeleteCustomField, DeleteFilter, DeleteGroup, DeleteIssue, DeleteIssueSecurity, DeleteIssueSecurityLevel, DeleteIssueType, DeleteJobRunner, DeleteLink, DeleteLinkType, DeleteNotification, DeleteOptionScheme, DeletePermission, DeletePortalPage, DeletePriority, DeleteProject, DeleteProjectCategory, DeleteProjectEntity, DeleteProjectRole, DeleteRemoteIssueLink, DeleteResolution, DeleteScheme, DeleteScheme, DeleteScheme, DeleteScheme, DeleteScheme, DeleteSharedDashboard, DeleteSharedFilter, DeleteStatus, DeleteSubTaskIssueType, DeleteTrustedApplication, DeleteUser, DeleteUserProperty, DeleteWorkflowStep, DeleteWorkflowTransitionCondition, DeleteWorkflowTransitionPostFunction, DeleteWorkflowTransitions, DeleteWorkflowTransitionValidator, DeleteWorklog, DisableSubTasks, EditAnnouncementBanner, EditApplicationProperties, EditAttachmentSettings, EditComment, EditCrowdApplication, EditCustomField, EditCustomFieldDefaults, EditCustomFieldOptions, EditCustomFieldUserPickerFilter, EditDarkFeatures, EditDefaultDashboard, EditDefaultFieldLayoutItem, EditFieldLayout, EditFieldLayoutItem, EditFieldLayoutItemRenderer, EditFieldLayoutItemRendererConfirmation, EditFieldLayoutScheme, EditFieldScreen, EditFieldScreenScheme, EditFieldScreenSchemeItem, EditFilter, EditIndexRecoverySettings, EditIssue, EditIssueSecurities, EditIssueType, EditIssueTypeScreenScheme, EditLabels, EditLinkType, EditListener, EditLookAndFeel, EditNestedGroups, EditNotifications, EditPermissions, EditPortalPage, EditPriority, EditProfile, EditProject, EditProjectCategory, EditProjectLeadAndDefaultAssignee, EditProjectRole, EditResolution, EditScheme, EditScheme, EditScheme, EditService, EditStatus, EditSubTaskIssueTypes, EditTrustedApplication, EditUser, EditUserDefaultSettings, EditUserGroups, EditUserProjectRoles, EditUserProperties, EditUserProperty, EditWorkflow, EditWorkflowDispatcher, EditWorkflowScheme, EditWorkflowStep, EditWorkflowTransition, EditWorkflowTransitionConditionParams, EditWorkflowTransitionPostFunctionParams, EditWorkflowTransitionValidatorParams, Error404, FavouriteFilters, FilterPickerPopup, FilterSubscription, FirstUseFlowAction, ForgotLoginDetails, GenericEditProfile, GlobalPermissions, GroupBrowser, GroupPickerBrowser, GroupRoleActorAction, I18nBean, IconPicker, ImportAll, ImportResult, ImportWorkflow, IndexAdminImpl, IndexOptimize, IndexProject, IntegrityChecker, IssueActionSupport, IssuePicker, JiraActionSupport, JiraCreditsPage, JiraWebActionSupport, JiraWizardActionSupport, LeaveAdmin, LicenseRoles, LinkConfluencePage, LinkExistingIssue, LinkJiraIssue, ListEventTypes, ListWorkflows, Logout, MailQueueAdmin, ManageAttachments, ManageConfigurationScheme, ManageFilters, ManageIssueTypeSchemes, ManageSubscriptions, ManageSubTasks, ManageWatchers, MapColumns, MapCustomFields, MapIssueTypes, MapPriorities, MapResolutions, MapStatuses, MapUsers, MapValidateImport, MigrateIssueTypes, MockAbstractBrowser, MockI18nBean, MockI18nHelper, MockI18nHelper, MoveIssue, MoveIssueConfirm, MoveIssueSubtasks, MoveIssueUpdateFields, MoveIssueUpdateWorkflow, MoveSubTask, MoveSubTaskChooseOperation, MoveSubTaskParent, MyJiraHome, NoopI18nHelper, PreparedReferenceAction, ProjectActionSupport, ProjectEmail, ProjectImportBackupOverviewProgress, ProjectImportMappingProgress, ProjectImportMissingMandatoryUsersCannotCreate, ProjectImportMissingMandatoryUsersExtMgmt, ProjectImportMissingOptionalUsersCannotCreate, ProjectImportMissingOptionalUsersExtMgmt, ProjectImportMissingUsersAutoCreate, ProjectImportProgress, ProjectImportResultsAction, ProjectImportSelectBackup, ProjectImportSelectProject, ProjectImportSummary, ProjectRoleUsageAction, PublishDraftWorkflow, QuickSearch, RecentIssueHistory, ReferenceAction, ReferenceComponentAction, ReferenceComponentImportAction, ReferenceModuleTypeAction, ReferenceResourceAction, ReferenceSoyAction, ReleaseNote, ResetFailedLoginCount, ResetPassword, RestoreDefaultDashboard, SaveAsFilter, SaveFilter, SchedulerAdmin, SchemeAwareIssueSecurityAction, SchemeAwareNotificationAction, SchemeAwarePermissionAction, SearchDescriptionEnabledAction, SelectComponentAssignees, SelectFieldLayoutScheme, SelectIssueTypeSchemeForProject, SelectIssueTypeScreenScheme, SelectProjectCategory, SelectProjectIssueSecurityScheme, SelectProjectPermissionScheme, SelectProjectScheme, SelectProjectSecuritySchemeStep2, SelectProjectWorkflowScheme, SelectProjectWorkflowSchemeStep2, SelectProjectWorkflowSchemeStep3, SendBulkMail, ServiceExecutor, SessionTimeoutMessage, SetGlobalEmailPreference, SetPassword, SetSelectedIssue, SetupAdminAccount, SetupApplicationProperties, SetupBonfire, SetupComplete, SetupDatabase, SetupGreenHopper, SetupImport, SetupLicense, SetupMailNotifications, ShowConstantsHelp, ShowTimeTrackingHelp, Signup, SimpleWorkflowAction, SiteDarkFeatures, TimeTrackingAdmin, TranslateCustomField, UpdateMyJiraHome, UpdateUserPreferences, UpdateWorklog, UploadXmlFile, UserBrowser, UserPickerBrowser, UserProperty, UserRememberMeCookies, UserRoleActorAction, VersionAction, ViewApplicationProperties, ViewAttachmentSettings, ViewCustomFields, ViewDefaultProjectRoleActors, ViewFieldLayouts, ViewFieldScreens, ViewFieldScreenSchemes, ViewGroup, ViewInstrumentation, ViewIssueFields, ViewIssueTypes, ViewIssueTypeScreenSchemes, ViewKeyboardShortcuts, ViewLicense, ViewLinkTypes, ViewListeners, ViewLogging, ViewMemoryInfo, ViewPriorities, ViewProfile, ViewProject, ViewProjectRoleActors, ViewProjectRoles, ViewProjects, ViewResolutions, ViewSchemes, ViewSchemes, ViewSchemes, ViewSchemes, ViewSchemes, ViewServices, ViewSharedDashboards, ViewSharedFilters, ViewStatuses, ViewSubtaskFragmentAction, ViewSystemInfo, ViewTranslations, ViewTrustedApplications, ViewUpgradeHistory, ViewUser, ViewUserDefaultSettings, ViewUserHover, ViewUserPreferences, ViewUserProjectRoles, ViewVoters, ViewWorkflowsForStatus, ViewWorkflowStep, ViewWorkflowStepMetaAttributes, ViewWorkflowSteps, ViewWorkflowTransition, ViewWorkflowTransitionConditionalResult, ViewWorkflowTransitionMetaAttributes, ViewWorkflowXml, VoteOrWatchIssue, WebSudoAuthenticate, WikiRendererHelpAction, WorkflowUIDispatcher, XmlBackup, XsrfErrorAction

@PublicApi
@InjectableComponent
public interface I18nHelper

I18nHelper is the main interface for finding internationalised text in JIRA.

Since JIRA 6.0 you can have an I18nHelper injected directly into any JIRA or plugin component (this will use the locale if the currently logged in user, or the default locale if there is no logged in user).

In versions prior to 6.0 you should only use the i18nHelper in your code which generally you get from JiraAuthenticationContext.getI18nHelper() or I18nHelper.BeanFactory. Both of these are available in PICO to be dependency injected or available from ComponentAccessor.getI18nHelperFactory() or ComponentAccessor.getJiraAuthenticationContext().

You MUST never directly instantiate the underlying I18nBean. You will get it wrong and miss out on cool stuff like flyweight caching. You SHOULD NOT hold onto this Helper for any extended period of time for 2 reasons. Firstly you will be using a cached Locale and values, so the Locale is now locked in for the duration of holding onto the helper. Secondly you are holding onto a large memory resource for longer than needed. Instead you should keep hold of the JiraAuthenticationContext or the I18nHelper.BeanFactory and retrieve the helper when needed.

See Also:
JiraAuthenticationContext.getI18nHelper(), I18nHelper.BeanFactory

Nested Class Summary
static interface I18nHelper.BeanFactory
          Ths BeanFactory is used to instantiate I18nHelper instances for a specific Locale or User.
 
Method Summary
 ResourceBundle getDefaultResourceBundle()
          Returns the default ResourceBundle within JIRA, which does not include translations provided by plugins.
 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 getUnescapedText(String) but does not apply any TranslationTransforms.
 boolean isKeyDefined(String key)
          

For the given key, checks whether such a key is defined in the locale context represented by this helper instance.

 

Method Detail

getLocale

Locale getLocale()
Returns:
the Locale that is associated with this I18nHelper

getDefaultResourceBundle

ResourceBundle getDefaultResourceBundle()
Returns the default ResourceBundle within JIRA, which does not include translations provided by plugins. For use cases where non-English translations are required, call getResourceBundle() instead.

Returns:
a non-null bundle
See Also:
getResourceBundle()

getUnescapedText

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

Parameters:
key - the key of the i18n message
Returns:
the un-formatted, translated, text or the key itself if no i18n message can be found

getUntransformedRawText

String getUntransformedRawText(String key)
Same as getUnescapedText(String) but does not apply any TranslationTransforms.

Parameters:
key - the key of the i18n message
Returns:
the un-formatted text or the key itself if no i18n message can be found

isKeyDefined

boolean isKeyDefined(String key)

For 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 getUntransformedRawText(String), whereby if this method returns false, getUntransformedRawText(String) will return the key provided as an argument, and if this method returns true, getUntransformedRawText(String) will generally return the translation, which in some very unlikely cases may be equal to the key.

Parameters:
key - translation key
Returns:
true, if any translation for such key exists, false otherwise

getText

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

Parameters:
key - the key of the i18n message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
value8 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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

Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
value8 - a value to be substituted into the message
value9 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

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.

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.

Parameters:
key - the key of the i18n message
parameters - This can be an Array, a List and Array or a single object parameter
Returns:
the formatted text or the key itself if no i18n message can be found

getKeysForPrefix

Set<String> getKeysForPrefix(String prefix)
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.

Parameters:
prefix - The prefix for i18n keys. May not be null
Returns:
An immutable set of translation keys that start with the prefix specified.
Since:
4.0.1

getResourceBundle

ResourceBundle getResourceBundle()
Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.

Returns:
a non-null bundle
See Also:
getDefaultResourceBundle()


Copyright © 2002-2014 Atlassian. All Rights Reserved.