8020663: Restructure some properties to facilitate better translation
authorjjg
Tue, 20 Aug 2013 14:46:54 -0700
changeset 19510 d2afcb89b0e7
parent 19509 fb622612d5df
child 19511 59a48a75fac7
8020663: Restructure some properties to facilitate better translation Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Tue Aug 20 14:15:45 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Tue Aug 20 14:46:54 2013 -0700
@@ -176,25 +176,32 @@
 doclet.0_and_1={0} and {1}
 
 #Documentation for Enums
-doclet.enum_values_doc=\n\
+doclet.enum_values_doc.main=\n\
  Returns an array containing the constants of this enum type, in\n\
  the order they are declared.  This method may be used to iterate\n\
  over the constants as follows:\n\
  <pre>\n\
  for ({0} c : {0}.values())\n\
  &nbsp;   System.out.println(c);\n\
- </pre>\n\
- @return an array containing the constants of this enum type, in\n\
- the order they are declared
+ </pre>
 
-doclet.enum_valueof_doc=\n\
+doclet.enum_values_doc.return=\n\
+ an array containing the constants of this enum type, in the order they are declared
+
+doclet.enum_valueof_doc.main=\n\
  Returns the enum constant of this type with the specified name.\n\
  The string must match <i>exactly</i> an identifier used to declare an\n\
  enum constant in this type.  (Extraneous whitespace characters are \n\
- not permitted.)\n\
- \n\
- @param name the name of the enum constant to be returned.\n\
- @return the enum constant with the specified name\n\
- @throws IllegalArgumentException if this enum type has no constant\n\
-         with the specified name\n\
- @throws NullPointerException if the argument is null
+ not permitted.)
+
+doclet.enum_valueof_doc.param_name=\
+ the name of the enum constant to be returned.
+
+doclet.enum_valueof_doc.return=\
+ the enum constant with the specified name
+
+doclet.enum_valueof_doc.throws_ila=\
+ if this enum type has no constant with the specified name
+
+doclet.enum_valueof_doc.throws_npe=\
+ if the argument is null
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Aug 20 14:15:45 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Aug 20 14:46:54 2013 -0700
@@ -667,16 +667,28 @@
         for (int j = 0; j < methods.length; j++) {
             MethodDoc currentMethod = methods[j];
             if (currentMethod.name().equals("values") &&
-                currentMethod.parameters().length == 0) {
-                currentMethod.setRawCommentText(
-                    configuration.getText("doclet.enum_values_doc", classDoc.name()));
+                    currentMethod.parameters().length == 0) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
+                sb.append("\n@return ");
+                sb.append(configuration.getText("doclet.enum_values_doc.return"));
+                currentMethod.setRawCommentText(sb.toString());
             } else if (currentMethod.name().equals("valueOf") &&
-                currentMethod.parameters().length == 1) {
+                    currentMethod.parameters().length == 1) {
                 Type paramType = currentMethod.parameters()[0].type();
                 if (paramType != null &&
-                    paramType.qualifiedTypeName().equals(String.class.getName())) {
-                    currentMethod.setRawCommentText(
-                        configuration.getText("doclet.enum_valueof_doc"));
+                        paramType.qualifiedTypeName().equals(String.class.getName())) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
+                sb.append("\n@param name ");
+                sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
+                sb.append("\n@return ");
+                sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
+                sb.append("\n@throws IllegalArgumentException ");
+                sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
+                sb.append("\n@throws NullPointerException ");
+                sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
+                currentMethod.setRawCommentText(sb.toString());
                 }
             }
         }