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.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.