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

Swedish localization has incorrect am/pm markers in FormatData_sv

    Details

    • Subcomponent:
    • Resolved In Build:
      b33
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      Backports

        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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jtusla Jiri Tusla (Inactive)
                  Reporter:
                  tyao Ting-Yun Ingrid Yao (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: