8065077: MethodTypes are not localized

Reviewed-by: ksrini
This commit is contained in:
Bhavesh Patel 2015-05-12 12:02:48 -07:00
parent bd394344b3
commit a33f1ed55d
4 changed files with 38 additions and 23 deletions

View File

@ -119,7 +119,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
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 abstract class SubWriterHolderWriter extends HtmlDocletWriter {
*/
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;
}

View File

@ -465,10 +465,10 @@ public class HtmlWriter {
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 @@ public class HtmlWriter {
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);

View File

@ -150,6 +150,13 @@ doclet.constructors=constructors
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

View File

@ -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 @@ package com.sun.tools.doclets.internal.toolkit.util;
* @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 @@ public enum MethodTypes {
return value;
}
public String text() {
return text;
public String resourceKey() {
return resourceKey;
}
public String tabId() {