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

Java does not set the default format locale correctly on mac10.13

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 10.0.1, 11
    • Fix Version/s: tbd_update
    • Component/s: core-libs
    • Labels:

      Description

      JDK: jdk 11 build 20
      Env: Mac10.11, 10.12, 10.13
      Setting locale steps:
      Open Languages&Region, preferred languages select "Chinese, Simplified", region select "China".

      Run following test on Mac 10.11, 10.12, 10.13 with zh_CN locale, but got different results.
      public class Test4 {
          public static void main(String[] args){
              System.out.println(Locale.getDefault());
              System.out.println("Format locale: " + Locale.getDefault(Locale.Category.FORMAT));
              System.out.println("Display locale: " + Locale.getDefault(Locale.Category.DISPLAY));
          }
      }

      Output:
      Mac 10.11:
      zh_CN_#Hans
      Format locale: zh_CN_#Hans
      Display locale: zh_CN_#Hans

      Mac 10.12:
      zh_CN_#Hans
      Format locale: zh_CN_#Hans
      Display locale: zh_CN_#Hans

      Mac 10.13:
      zh_CN_#Hans
      Format locale: en_CN_#Hans
      Display locale: zh_CN_#Hans

      On Mac 10.13, Java format locale is "en_CN_#Hans". It seems like Java does not setting the default format locale correctly on mac10.13.

      For the format locale of mac 10.11, open Language&Region-->Advanced, there is a format language selection, refer to attachment advanced_10.11.png.

      But for mac 10.12 and 10.13, there is no format language selection, refer to attachment "advanced_10.13.png". It seems like mac OS uses the "Preferred languages" as the format language. Java format locale on mac 10.12 is "zh_CN_#Hans", but on 10.13 is "en_CN_#Hans".

      On mac 10.13, input "locale" in the command line, the output please refer to "locale10.13.png".

      I also test with JDK 10.0.1+10 with de_DE locale on mac 10.13, the format locale is "en_DE".

        Attachments

          Activity

            People

            • Assignee:
              naoto Naoto Sato
              Reporter:
              dzhou Dora Zhou
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: