src/java.base/macosx/native/libjava/java_props_macosx.c
changeset 51217 79926aa725f7
parent 50410 01e4ddc3c23f
child 52725 c470f977ade8
equal deleted inserted replaced
51216:e429a304c97d 51217:79926aa725f7
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    43     if (lc == NULL) return NULL;
    43     if (lc == NULL) return NULL;
    44     return strdup(lc);
    44     return strdup(lc);
    45 }
    45 }
    46 
    46 
    47 #define LOCALEIDLENGTH  128
    47 #define LOCALEIDLENGTH  128
       
    48 #ifndef kCFCoreFoundationVersionNumber10_11_Max
       
    49 #define kCFCoreFoundationVersionNumber10_11_Max 1299
       
    50 #endif
    48 char *getMacOSXLocale(int cat) {
    51 char *getMacOSXLocale(int cat) {
    49     const char* retVal = NULL;
    52     const char* retVal = NULL;
    50     char languageString[LOCALEIDLENGTH];
    53     char languageString[LOCALEIDLENGTH];
    51     char localeString[LOCALEIDLENGTH];
    54     char localeString[LOCALEIDLENGTH];
       
    55 
       
    56     // Since macOS 10.12, there is no separate language selection for
       
    57     // "format" locale, e.g., date format. Use the preferred language
       
    58     // for all LC_* categories.
       
    59     if (kCFCoreFoundationVersionNumber >
       
    60         kCFCoreFoundationVersionNumber10_11_Max) {
       
    61         cat = LC_MESSAGES;
       
    62     }
    52 
    63 
    53     switch (cat) {
    64     switch (cat) {
    54     case LC_MESSAGES:
    65     case LC_MESSAGES:
    55         {
    66         {
    56             // get preferred language code
    67             // get preferred language code