changeset 51843:0058ffa0a922

8206886: Java does not set the default format locale correctly on mac10.13 Reviewed-by: rriggs
author naoto
date Thu, 19 Jul 2018 11:15:38 -0700
parents 17148c9457a6
children 2ba54f0eac90 0ca747fdb96c 2d358556e7c4 be0c7dc1329a 8cf728154f91 f40e8d475819 ffdc48f1ef31 cb88ea642a41 7410cb248bbf
files src/java.base/macosx/native/libjava/java_props_macosx.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Jul 19 10:53:38 2018 -0700
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Jul 19 11:15:38 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,11 +45,22 @@
 }
 
 #define LOCALEIDLENGTH  128
+#ifndef kCFCoreFoundationVersionNumber10_11_Max
+#define kCFCoreFoundationVersionNumber10_11_Max 1299
+#endif
 char *getMacOSXLocale(int cat) {
     const char* retVal = NULL;
     char languageString[LOCALEIDLENGTH];
     char localeString[LOCALEIDLENGTH];
 
+    // Since macOS 10.12, there is no separate language selection for
+    // "format" locale, e.g., date format. Use the preferred language
+    // for all LC_* categories.
+    if (kCFCoreFoundationVersionNumber >
+        kCFCoreFoundationVersionNumber10_11_Max) {
+        cat = LC_MESSAGES;
+    }
+
     switch (cat) {
     case LC_MESSAGES:
         {