JDK-6355363 : Sample code in localized API Doc for DecimalFormat class is very ugly.
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-11-25
  • Updated: 2010-07-29
  • Resolved: 2006-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0u7 b02Fixed
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]);
==================================================================================

Comments
EVALUATION Localized API docs for some other classes (e.g. MessageFormat, Enumeration) have the same problem.
28-11-2005

EVALUATION Will plan to fix in 5.0 web document.
28-11-2005