JDK-6509039 : Swedish localization has incorrect am/pm markers in FormatData_sv
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2007-01-03
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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.
JDK 6 JDK 7 Other
6u10Fixed 7 b33Fixed OpenJDK6Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b91)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b91, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Suse 10.1 Linux 2.6.16.21-0.25-default i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Using a formatter set to Swedish locale outputs am/pm as time markers. While most people understand this, the correct values are fm./em.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a formatter, format  ("Time %tp", System.currentTimeMillis()) and print result.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Time fm.
 or
Time em.
ACTUAL -
Time am
 or
Time pm

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.Formatter;
import java.util.Locale;

public class F {
        public static void main(String args[]) {
                StringBuilder sb = new StringBuilder();
                Formatter f = new Formatter(sb, new Locale("sv"));
                f.format("Time %tp", System.currentTimeMillis());
                System.out.println(sb);
        }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Have special case for locale "sv", or apply this diff:

Index: trunk/j2se/src/share/classes/sun/text/resources/FormatData_sv.java
===================================================================
--- trunk/j2se/src/share/classes/sun/text/resources/FormatData_sv.java  (revision 52)
+++ trunk/j2se/src/share/classes/sun/text/resources/FormatData_sv.java  (arbetskopia)
@@ -88,6 +88,12 @@
                     "l\u00f6" // abb Saturday
                 }
             },
+            { "AmPmMarkers",
+                new String[] {
+                    "fm.", // am marker
+                    "em." // pm marker
+                }
+            },
             { "NumberElements",
                 new String[] {
                     ",", // decimal separator

Comments
EVALUATION Using reference: http://unicode.org/cldr/repository/common/main/sv.xml?rev=1.108&content-type=text/vnd.viewcvs-markup <am>fm</am> <am alt="proposed-x1001" draft="unconfirmed">f.m.</am> <pm>em</pm> <pm alt="proposed-x1001" draft="unconfirmed">e.m.</pm> fixing: j2se:src/share/classes/sun/text/resources/FormatData_sv.java ------- FormatData_sv.java ------- 106a107,112 > { "AmPmMarkers", > new String[] { > "fm", // am marker > "em" // pm marker > } > },
17-09-2007

EVALUATION Well, it is sometimes good to leave it for a while... Now in CLDR 1.5 there are requested data as valid entries. Could be fixed as requested.
03-09-2007

EVALUATION This bug has not been fixed in any J2SE build. There is a little conflict because according the CLDR data: http://unicode.org/cldr/repository/common/main/sv.xml?rev=1.95&content-type=text/vnd.viewcvs-markup the data are unconfirmed: <am draft="unconfirmed">fm</am> <pm draft="unconfirmed">em</pm> Which in fact means that it should not be implemented in J2SE. I will let the CR opened and would like to ask submitter to try to find and supply some documents from Swedish language institute. Having this as a reference will allow me to implement the fix. Thanks.
18-05-2007

EVALUATION ###@###.### can investigate the bug and may be this problem has been fixed in coming 6.0 update.
15-01-2007