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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0u7
    • Component/s: globalization
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      generic
    • OS:
      generic

      Description

      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]);
      ==================================================================================

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: