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

Locale.getDisplayScript() (no args) does not honor default DISPLAY locale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 7
    • core-libs
    • b04
    • generic
    • generic

    Description

      The code snippet below illustrates the issue.

      Locale loc = Locale.forLanguageTag("zh-Hans-CN");

      // Set default locale to en-US
      Locale.setDefault(Locale.US);

      System.out.println("Default Locale: en-US");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      // Set DISPLAY locale to zh-Hans-CN
      Locale.setDefault(Category.DISPLAY, loc);

      System.out.println("Default DISPLAY Locale: zh-Hans-CN");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      // Set default locale to zh-Hans-CN
      Locale.setDefault(loc);

      System.out.println("Default Locale: zh-Hans-CN");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      This code prints out -

      Default Locale: en-US
      langauge: Chinese
      script: Simplified Han
      Default DISPLAY Locale: zh-Hans-CN
      langauge: ¿¿
      script: Simplified Han
      Default Locale: zh-Hans-CN
      langauge: ¿¿
      script: ¿¿¿¿

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              naoto Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: