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 https://scriptrunner.adaptavist.com/latest/jira/fragments/WebItem.html 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 (https://scriptrunner.adaptavist.com/latest/jira/fragments/WebItemProvider.html). 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.
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);
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.