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

Time Zone abbreviations are not translated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u29
    • globalization

      FULL PRODUCT VERSION :
      java version "1.6.0_27"
      Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Time zone abbreviations provided by TimeZone.getDisplayName() are not internationalized. The long versions are, but the short versions are not. For instance in France "Central European Summer Time" is translated to "Heure d'été d'Europe centrale". The short version in english is "CEST", but in french it should be translated to "HAEC".

      After debugging through that library it appears its just getting the Time Zone display from Java's rt.jar. After looking inside there at the TimeZoneNames_fr.java this is what I am seeing (keep in mind some of this is speculation)

      String[] arrayOfString15 = { "Heure d'Europe centrale", "CET", "Heure d'été d'Europe centrale", "CEST" };

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      TimeZone tz = TimeZone.getTimeZone("Europe/Paris");
      System.out.println("Time Zone (Long English): " + tz.getDisplayName(true, 1));
      System.out.println("Time Zone (Short English): " + tz.getDisplayName(true, 0)); // Actual Code in third party library
      System.out.println("Time Zone (Long French): " + tz.getDisplayName(true, 1, Locale.FRANCE));
      System.out.println("Time Zone (Short French): " + tz.getDisplayName(true, 0, Locale.FRANCE));
      and the results:
      Time Zone (Long English): Central European Summer Time

      Time Zone (Short English): CEST

      Time Zone (Long French): Heure d'été d'Europe centrale

      Time Zone (Short French): CEST
      I ran also ran the same code snippet using the ICU4J 4.6.1 locale SPI provider and here's the output.

      Time Zone (Long English): Central European Summer Time
      Time Zone (Short English): CEST
      Time Zone (Long French): heure avancée d’Europe centrale
      Time Zone (Short French): HAEC

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Time Zone (Long English): Central European Summer Time
      Time Zone (Short English): CEST
      Time Zone (Long French): heure avancée d’Europe centrale
      Time Zone (Short French): HAEC
      ACTUAL -
      Time Zone (Long English): Central European Summer Time
      Time Zone (Short English): CEST
      Time Zone (Long French): Heure d'été d'Europe centrale
      Time Zone (Short French): CEST

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      TimeZone tz = TimeZone.getTimeZone("Europe/Paris");
      System.out.println("Time Zone (Long English): " + tz.getDisplayName(true, 1));
      System.out.println("Time Zone (Short English): " + tz.getDisplayName(true, 0)); // Actual Code in third party library
      System.out.println("Time Zone (Long French): " + tz.getDisplayName(true, 1, Locale.FRANCE));
      System.out.println("Time Zone (Short French): " + tz.getDisplayName(true, 0, Locale.FRANCE));
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround

            ljiang Leo Jiang (Inactive)
            peytoia Yuka Kamiya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: