* @param messageParameters can be the same as {@link com.atlassian.jira.util.I18nHelper#getText(String, Object)}
* */
public static String getText(@Nullable Locale locale, @Nullable User user, String textKey, Object... messageParameters) {
I18nHelper.BeanFactory factory = ComponentAccessor.getI18nHelperFactory();
if (factory == null) return textKey + ' ' + Arrays.toString(messageParameters);
I18nHelper i18nHelper = locale != null || user == null
? factory.getInstance(locale != null ? locale : getJiraDefaultLocale())
: factory.getInstance(user);
return i18nHelper.getText(textKey, messageParameters);
}