8065077: MethodTypes are not localized
authorbpatel
Tue, 12 May 2015 12:02:48 -0700
changeset 30528 dadaac1f5cc2
parent 30412 8ffdeabc7c2b
child 30529 f0f03398adb4
8065077: MethodTypes are not localized Reviewed-by: ksrini
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Jul 05 20:32:48 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Tue May 12 12:02:48 2015 -0700
@@ -119,7 +119,7 @@
             Content captionSpan;
             Content span;
             if (type.isDefaultTab()) {
-                captionSpan = HtmlTree.SPAN(new StringContent(type.text()));
+                captionSpan = HtmlTree.SPAN(configuration.getResource(type.resourceKey()));
                 span = HtmlTree.SPAN(type.tabId(),
                         HtmlStyle.activeTableTab, captionSpan);
             } else {
@@ -142,7 +142,7 @@
      */
     public Content getMethodTypeLinks(MethodTypes methodType) {
         String jsShow = "javascript:show(" + methodType.value() +");";
-        HtmlTree link = HtmlTree.A(jsShow, new StringContent(methodType.text()));
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getResource(methodType.resourceKey()));
         return link;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Wed Jul 05 20:32:48 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Tue May 12 12:02:48 2015 -0700
@@ -465,10 +465,10 @@
         for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
             vars.append(sep);
             sep = ",";
-            vars.append("\"");
-            vars.append(entry.getKey());
-            vars.append("\":");
-            vars.append(entry.getValue());
+            vars.append("\"")
+                    .append(entry.getKey())
+                    .append("\":")
+                    .append(entry.getValue());
         }
         vars.append("};").append(DocletConstants.NL);
         sep = "";
@@ -476,11 +476,19 @@
         for (MethodTypes entry : methodTypes) {
             vars.append(sep);
             sep = ",";
-            vars.append(entry.value()).append(":");
-            vars.append("[").append("\"").append(entry.tabId());
-            vars.append("\"").append(sep).append("\"").append(entry.text()).append("\"]");
+            vars.append(entry.value())
+                    .append(":")
+                    .append("[")
+                    .append("\"")
+                    .append(entry.tabId())
+                    .append("\"")
+                    .append(sep)
+                    .append("\"")
+                    .append(configuration.getText(entry.resourceKey()))
+                    .append("\"]");
         }
-        vars.append("};").append(DocletConstants.NL);
+        vars.append("};")
+                .append(DocletConstants.NL);
         addStyles(HtmlStyle.altColor, vars);
         addStyles(HtmlStyle.rowColor, vars);
         addStyles(HtmlStyle.tableTab, vars);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Wed Jul 05 20:32:48 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Tue May 12 12:02:48 2015 -0700
@@ -150,6 +150,13 @@
 doclet.Constructors=Constructors
 doclet.methods=methods
 doclet.Methods=Methods
+doclet.All_Methods=All Methods
+doclet.Static_Methods=Static Methods
+doclet.Instance_Methods=Instance Methods
+doclet.Abstract_Methods=Abstract Methods
+doclet.Concrete_Methods=Concrete Methods
+doclet.Default_Methods=Default Methods
+doclet.Deprecated_Methods=Deprecated Methods
 doclet.annotation_type_optional_members=optional elements
 doclet.Annotation_Type_Optional_Members=Optional Elements
 doclet.annotation_type_required_members=required elements
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java	Wed Jul 05 20:32:48 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java	Tue May 12 12:02:48 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,22 +31,22 @@
  * @author Bhavesh Patel
  */
 public enum MethodTypes {
-    ALL(0xffff, "All Methods", "t0", true),
-    STATIC(0x1, "Static Methods", "t1", false),
-    INSTANCE(0x2, "Instance Methods", "t2", false),
-    ABSTRACT(0x4, "Abstract Methods", "t3", false),
-    CONCRETE(0x8, "Concrete Methods", "t4", false),
-    DEFAULT(0x10, "Default Methods", "t5", false),
-    DEPRECATED(0x20, "Deprecated Methods", "t6", false);
+    ALL(0xffff, "doclet.All_Methods", "t0", true),
+    STATIC(0x1, "doclet.Static_Methods", "t1", false),
+    INSTANCE(0x2, "doclet.Instance_Methods", "t2", false),
+    ABSTRACT(0x4, "doclet.Abstract_Methods", "t3", false),
+    CONCRETE(0x8, "doclet.Concrete_Methods", "t4", false),
+    DEFAULT(0x10, "doclet.Default_Methods", "t5", false),
+    DEPRECATED(0x20, "doclet.Deprecated_Methods", "t6", false);
 
     private final int value;
-    private final String text;
+    private final String resourceKey;
     private final String tabId;
     private final boolean isDefaultTab;
 
-    MethodTypes(int v, String t, String id, boolean dt) {
+    MethodTypes(int v, String k, String id, boolean dt) {
         this.value = v;
-        this.text = t;
+        this.resourceKey = k;
         this.tabId = id;
         this.isDefaultTab = dt;
     }
@@ -55,8 +55,8 @@
         return value;
     }
 
-    public String text() {
-        return text;
+    public String resourceKey() {
+        return resourceKey;
     }
 
     public String tabId() {