Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how could I do to get the jira language with scriptRunner

yundong.li
Contributor
February 16, 2022

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?

2 answers

2 accepted

2 votes
Answer accepted
Fabio Racobaldo _Herzum_
Community Champion
February 16, 2022

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

yundong.li
Contributor
February 16, 2022

hi @Fabio Racobaldo _Herzum_ 

Thank you very much.

it works very good!

Like • Fabio Racobaldo _Herzum_ likes this
1 vote
Answer accepted
Mohamed Benziane
Community Champion
February 16, 2022

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

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!
AUG Leaders

Atlassian Community Events