Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6355363

Sample code in localized API Doc for DecimalFormat class is very ugly.

XMLWordPrintable

    • b02
    • generic
    • generic

      Sample code in class description is very ugly. It appears that this document was localized without understanding the meaning of <pre></pre> and no one has reviewed the formatted text after localization.

      Original(English): (http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html)
      ==================================================================================
       <blockquote><pre>
       <strong>// Print out a number using the localized number, integer, currency,
       // and percent format for each locale</strong>
       Locale[] locales = NumberFormat.getAvailableLocales();
       double myNumber = -1234.56;
       NumberFormat form;
       for (int j=0; j<4; ++j) {
           System.out.println("FORMAT");
           for (int i = 0; i < locales.length; ++i) {
               if (locales[i].getCountry().length() == 0) {
                  continue; // Skip language-only locales
               }
      ==================================================================================

      Translation(Japanese): (http://java.sun.com/j2se/1.5.0/ja/docs/ja/api/java/text/DecimalFormat.html)
      ==================================================================================
      <blockquote>
       <pre>
       <strong>// Print out a number using the localized number, integer, currency, // and percent format for each locale</strong> Locale[] locales = NumberFormat.getAvailableLocales();
       double myNumber = -1234.56;
       NumberFormat form;
       for (int j=0;
       j<4;
       ++j) { System.out.println("FORMAT");
       for (int i = 0;
       i < locales.length;
       ++i) { if (locales[i].getCountry().length() == 0) { continue;
       // Skip language-only locales } System.out.print(locales[i].getDisplayName());
       switch (j) { case 0:
       form = NumberFormat.getInstance(locales[i]);
      ==================================================================================

            duke J. Duke
            peytoia Yuka Kamiya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: