Interface I18nHelper

All Known Subinterfaces:
MessageUtil
All Known Implementing Classes:
A11yPersonalSettings, 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, AbstractFieldScreenSchemeAction, AbstractFieldScreenSchemeItemAction, AbstractFilterAction, AbstractImportEntity, AbstractImportIssue, AbstractIssueLinkAction, AbstractIssueSelectAction, AbstractManagableOptionsAction, AbstractManageIssueTypeOptionsAction, AbstractManagePrioritiesAction, AbstractPage, AbstractPermissionCheckAction, AbstractPluggableTabPanelAction, AbstractPrioritySchemesAction, AbstractProjectAction, AbstractProjectAndSchemeAwareAction, AbstractProjectImportProgress, AbstractProjectImportUsersMissing, AbstractProjectRole, AbstractRoleActorAction, 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, AddPriorityScheme, AddProjectCategory, AddScheme, AddScheme, AddScheme, AddScheme, AddUser, AddVersion, AddWebLink, AddWorkflowTransition, AddWorkflowTransitionCondition, AddWorkflowTransitionConditionParams, AddWorkflowTransitionFunctionParams, AddWorkflowTransitionPostFunction, AddWorkflowTransitionValidator, AddWorkflowTransitionValidatorParams, AdjustFavourite, AdminOnlyPermissionCheckAction, AdvancedApplicationProperties, AllUsersRememberMeCookies, AnonymizeUser, AnonymousSiteAccessPermissionCheckAction, ApplicationAccess, ArchiveIssue, ArchiveProject, AroundTheWorldPage, AssignIssue, AssociatedProjectsForCustomField, AssociatedScreensForCustomField, AssociateFieldToScreens, AssociateIssueTypeSchemes, AssociateIssueTypeSchemesWithDefault, AssociatePriorityScheme, AttachFile, AttachTemporaryFile, BackingI18n, BasicJiraCreditsPage, BrowseArchivedIssues, BrowseProjects, BulkArchive, BulkCancelWizard, BulkChooseOperation, BulkDelete, BulkEdit, BulkEdit1, BulkEditUserGroups, BulkMigrate, BulkMove, BulkOperationProgress, BulkUnwatch, BulkWatch, BulkWorkflowTransition, CantBrowseCreatedIssue, ChangePassword, ChangeSharedDashboardOwner, ChangeSharedFilterOwner, ClearRememberMeCookies, CloneIssueDetails, CloneWorkflow, CommentAssignIssue, CommittedResponseExceptionThrowingAction, ConfigureCrowdServer, ConfigureCustomField, ConfigureField, ConfigureFieldLayout, ConfigureFieldLayoutScheme, ConfigureFieldScreen, ConfigureFieldScreenScheme, ConfigureIssueTypeOptionScheme, ConfigureIssueTypeScreenScheme, ConfigureLogging, ConfigureOptionScheme, ConfigurePortalPages, ConfigurePriorityScheme, ConfigureReport, ConfirmNewInstallationWithOldLicense, ContactAdministrators, ConvertIssueToSubTask, ConvertSubTaskToIssue, CopyFieldLayout, CopyFieldLayoutScheme, CopyPriorityScheme, 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, DeletePriorityScheme, DeleteProject, DeleteProjectCategory, 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, EditAvatarSettings, EditComment, EditCrowdApplication, EditCustomField, EditCustomFieldDefaults, EditCustomFieldOptions, EditCustomFieldUserPickerFilter, EditDarkFeatures, EditDefaultDashboard, EditDefaultFieldLayoutItem, EditFieldLayout, EditFieldLayoutItem, EditFieldLayoutItemRenderer, EditFieldLayoutItemRendererConfirmation, EditFieldLayoutScheme, EditFieldScreen, EditFieldScreenScheme, EditFieldScreenSchemeItem, EditFilter, EditIndexRecoverySettings, EditIssue, EditIssueSecurities, EditIssueType, EditIssueTypeScreenScheme, EditLabels, EditLevel, EditLinkType, EditListener, EditLookAndFeel, EditNestedGroups, EditNotifications, EditPortalPage, EditPriority, EditPriorityScheme, EditProfile, EditProject, EditProjectCategory, EditProjectLeadAndDefaultAssignee, EditProjectRole, EditReplicationSettings, EditResolution, EditScheme, EditScheme, EditScheme, EditService, EditStatus, EditSubscription, EditSubTaskIssueTypes, EditTrustedApplication, EditUser, EditUserDefaultSettings, EditUserGroups, EditUserProjectRoles, EditUserProperties, EditUserProperty, EditVersionPickerCustomFieldOptionsOrder, EditWorkflow, EditWorkflowDispatcher, EditWorkflowScheme, EditWorkflowStep, EditWorkflowTransition, EditWorkflowTransitionConditionParams, EditWorkflowTransitionPostFunctionParams, EditWorkflowTransitionValidatorParams, EmailTemplatesSettings, Error404, Export, FavouriteFilters, FilterPickerPopup, FirstUseFlowAction, ForgotLoginDetails, GenericEditProfile, GlobalPermissions, GroupBrowser, GroupPickerBrowser, GroupRoleActorAction, I18nBean, IconPicker, ImportAll, ImportResult, ImportWorkflow, IndexAdminImpl, IndexOptimize, IndexProject, IntegrityChecker, IssueActionSupport, IssuePicker, JiraWebActionSupport, JiraWizardActionSupport, JmxMonitoringAction, LandingPage, LeaveAdmin, LegendOfJiraPage, LicensedOnlyPermissionCheckAction, LinkConfluencePage, LinkExistingIssue, LinkJiraIssue, ListEventTypes, ListWorkflows, Logout, MailQueueAdmin, ManageAttachments, ManageCacheInstrumentation, ManageConfigurationScheme, ManageFilters, ManageIssueTypeSchemes, ManageSubscriptions, ManageSubTasks, ManageTerminology, ManageWatchers, MapColumns, MapCustomFields, MapIssueTypes, MapPriorities, MapResolutions, MapStatuses, MapUsers, MapValidateImport, MessageUtilImpl, MigrateIssueTypes, MigratePrioritySchemeAction, MigratePrioritySchemeProgress, MockAbstractBrowser, MockI18nBean, MockI18nHelper, MockI18nHelper, MoveIssue, MoveIssueConfirm, MoveIssueSubtasks, MoveIssueUpdateFields, MoveIssueUpdateWorkflow, MoveSubTask, MoveSubTaskChooseOperation, MoveSubTaskParent, MyJiraHome, NoopI18nHelper, OldEditPermissions, PreparedReferenceAction, ProjectActionSupport, ProjectEmail, ProjectImportBackupOverviewProgress, ProjectImportMappingProgress, ProjectImportMissingMandatoryUsersCannotCreate, ProjectImportMissingMandatoryUsersExtMgmt, ProjectImportMissingOptionalUsersCannotCreate, ProjectImportMissingOptionalUsersExtMgmt, ProjectImportMissingUsersAutoCreate, ProjectImportProgress, ProjectImportResultsAction, ProjectImportSelectBackup, ProjectImportSelectProject, ProjectImportSummary, ProjectPermissions, ProjectRoleUsageAction, PublishDraftWorkflow, PulpRenderAction, QuickSearch, RecentIssueHistory, ReferenceAction, ReferenceComponentAction, ReferenceComponentImportAction, ReferenceModuleTypeAction, ReferenceResourceAction, ReferenceSoyAction, ReleaseNote, ReplicationSettings, ResetFailedLoginCount, ResetPassword, ResourcePhaseCheckpointsAction, RestoreDefaultDashboard, RestoreIssue, SchedulerAdmin, SchemeAwareIssueSecurityAction, SchemeAwareNotificationAction, SchemeAwarePermissionAction, SearchDescriptionEnabledAction, SelectComponentAssignees, SelectFieldLayoutScheme, SelectIssueTypeSchemeForProject, SelectIssueTypeScreenScheme, SelectProjectCategory, SelectProjectIssueSecurityScheme, SelectProjectPermissionScheme, SelectProjectScheme, SelectProjectSecuritySchemeStep2, SelectProjectWorkflowScheme, SelectProjectWorkflowSchemeStep2, SelectProjectWorkflowSchemeStep3, SendBulkMail, ServiceExecutor, SessionTimeoutMessage, SetGlobalEmailPreference, SetPassword, Settings, SetupAccount, SetupAdminAccount, SetupApplicationProperties, SetupComplete, SetupDatabase, SetupFinishing, SetupImport, SetupLicense, SetupMailNotifications, ShowConstantsHelp, ShowTimeTrackingHelp, Signup, SimpleWorkflowAction, SiteDarkFeatures, SystemAdminPermissionCheckAction, TerminologyHelp, TimeTrackingAdmin, TranslateCustomField, UnrestrictedAccessPermissionCheckAction, UpdateMyJiraHome, UpdateUserPreferences, UpdateWorklog, UploadXmlFile, UserBrowser, UserPickerBrowser, UserProperty, UserRememberMeCookies, UserRoleActorAction, VersionAction, ViewApplicationProperties, ViewAttachmentSettings, ViewAvatarSettings, ViewCacheDetails, ViewCachesByRequest, ViewCacheStats, ViewCustomFields, ViewDefaultProjectRoleActors, ViewEventAction, ViewFieldLayouts, ViewFieldScreens, ViewFieldScreenSchemes, ViewGroup, ViewInstrumentation, ViewIssueFields, ViewIssueTypes, ViewIssueTypeScreenSchemes, ViewKeyboardShortcuts, ViewLinkTypes, ViewListeners, ViewLogging, ViewMemoryInfo, ViewPriorities, ViewPrioritySchemes, ViewPrioritySchemesForPriority, ViewProfile, ViewProject, ViewProjectRoleActors, ViewProjectRoles, ViewProjects, ViewRecords, ViewResolutions, ViewSchemes, ViewSchemes, ViewSchemes, ViewSchemes, ViewSchemes, ViewServices, ViewSharedDashboards, ViewSharedFilters, ViewStatuses, ViewSubtaskFragmentAction, ViewSystemFields, ViewSystemInfo, ViewTranslations, ViewTrustedApplications, ViewUpgradeHistory, ViewUpgrades, ViewUris, 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:
  • Method Details

    • 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:
    • 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: