United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6509039 : Swedish localization has incorrect am/pm markers in FormatData_sv

Details
Type:
Bug
Submit Date:
2007-01-03
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
globalization
OS:
linux
Sub-Component:
translation
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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

###@###.### can investigate the bug and may be this problem has been fixed in coming 6.0 update.
                                     
2007-01-15
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.
                                     
2007-05-18
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.
                                     
2007-09-03
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
>                 }
>             },
                                     
2007-09-17



Hardware and Software, Engineered to Work Together