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 @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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It seems that you can use this method to get this information:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.