I want to get the jira language used by the current user through the Behaviour's Initialiser of scriptRunner,How can I achieve this, can someone help?
Hi,
It seems that you can use this method to get this information:
https://docs.atlassian.com/software/jira/docs/api/7.0.6/com/atlassian/jira/config/LocaleManager.html#getLocale-java.lang.String-
Hi @yundong.li ,
here code to retrieve logged in language :
import com.atlassian.jira.component.ComponentAccessor;import com.atlassian.jira.security.JiraAuthenticationContext;import com.atlassian.jira.user.ApplicationUser;import com.atlassian.jira.user.UserLocaleStore;JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getJiraAuthenticationContext();UserLocaleStore localeStore = ComponentAccessor.getComponentOfType(UserLocaleStore.class);ApplicationUser loggedUser = jiraAuthenticationContext.getLoggedInUser();Locale locale = localeStore.getLocale(loggedUser);String language = locale.getDisplayLanguage();
This should work.
Regards,
Fabio
hi @Fabio Racobaldo _Catworkx_
Thank you very much.
it works very good!
It looks like you're new here. Sign in or register to get started.