Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner: Translate menu text of custom web item depending on users locale

Hello community,

I use scriptrunner to automate a lot of processes in Jira. Thanks a lot for this great addon to Jira.

But now I come up with a question: I want to add a new web item (with a web section and more web items) in the top navigation menu.

I used the tutorial to do this and it works perfectly. But now I want to translate the menu text depending on the users locale.

So my next try was to use the Web Item Provider Built-In Script ( I can code the label depending on the user setting, but now I cannot choose the created web item as parent for the web section (the dropdown doesn't list the key from the web item provider).

So either I use the web item but without menu text translation or I use the web item provider with menu text translation but without any chance to integrate further items (here: web section) as children of the web item.

My problem is, I need both :) Do you have any ideas?

I use Jira 8.13.3 (Server / self hosted) and Scriptrunner 6.18.0.

Thank you for your replies.

2 answers

1 accepted

0 votes
Answer accepted

I solved the problem by duplicating the Web Item, Web Section and Web Item Provider. I use the condition to check the users locale and to decide which option to go for.

My condition is:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.user.preferences.PreferenceKeys;

ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
String userLocale = ComponentAccessor.getUserPreferencesManager().getExtendedPreferences(loggedInUser).getString(PreferenceKeys.USER_LOCALE)

return "de_DE".equals(userLocale);

Any news on this topic? Thanks in advance.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you