Add support for internationalising macro enum type parameter values

XMLWordPrintable

    • 1
    • 1

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      The macro enum type parameter currently does not support the internationalisation of its values.

      macro-browser-fields.js:331-333

      ...
      $(param.enumValues).each(function() {
          input.append(AJS.$("<option/>").attr("value", this).html("" + this));
      });
      ...
      

      The data is coming from a JSON response of /plugins/macrobrowser/browse-macros.action, see macro-browser.js (data.macros):1060-1063

      ...
      url: AJS.params.contextPath + "/plugins/macrobrowser/browse-macros.action",
      success: function(data) {
          t.initData = data;
          t.loadModel(data.macros);
      ...
      

      and the corresponding server-side action, com.atlassian.confluence.macro.browser.actions.BrowseMacrosAction leading to com.atlassian.confluence.plugin.descriptor.MacroMetadataParser.parseParameter(String, String, Element) and com.atlassian.confluence.macro.browser.beans.MacroParameter. For the i18n to achieve there, the enumValues field should be changed from a List<String> to a Map<String, Message> where String is a specific value and Message is the convention established for resolving the translation. See also e.g. com.atlassian.confluence.macro.browser.beans.MacroParameter.getDescription()):173

      return Message.getInstance(pluginKey + "." + macroName + ".param." + name + ".desc");
      

      Suggested convention would be

      pluginKey + "." + macroName + ".param." + name + ".value." + value
      

      where value is the key of the enumValues map. The implementation of the map should be a java.util.LinkedHashMap, so that the order from the XML is maintained.

            Assignee:
            Unassigned
            Reporter:
            fabs (Inactive)
            Votes:
            47 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: