0 Replies Latest reply on May 28, 2011 3:56 AM by 865098

    Time Zone Abbreviations Internationalized in Java?

      I'm trying to fgure out if anyone knows if Java provides time zone abbreviations (specifically) internationalized. We have a third party library that we are using to retrieve the abbreviated time zone display for the current locale (France). We get the correct time zone returned, "CEST" (Central European Summer Time), but as I understand it "CEST" is the english translation of that time zone and the French version is "HAEC" which stands for "heure d'été d'Europe centrale".

      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" };

      To me this looks like Java can return the internationalized version of the full time zone name, but we are going to get the english translation of the abbreviation.

      Would anyone be able to confirm this for me?

      Here is a test I mocked up:

      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