diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2021-10-30 22:37:05 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2021-10-30 22:37:05 +0300 |
commit | e9bbfd0c8c7a508d220bf355722ff03f91e93183 (patch) | |
tree | 1230f26bc82f24547aeccbaa7fcd6d3db2655fd3 /intern/locale/osx_user_locale.mm | |
parent | 1aa953bd1913c81b22c80a00edbf4ad88a32c52f (diff) | |
parent | 03a962d8cab44221650f59eb223cb0a767e05b2b (diff) |
Merge branch 'master' into soc-2020-io-performancesoc-2020-io-performance
Diffstat (limited to 'intern/locale/osx_user_locale.mm')
-rw-r--r-- | intern/locale/osx_user_locale.mm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/intern/locale/osx_user_locale.mm b/intern/locale/osx_user_locale.mm index e2f65d39df9..ce694b5fc1e 100644 --- a/intern/locale/osx_user_locale.mm +++ b/intern/locale/osx_user_locale.mm @@ -14,7 +14,17 @@ const char *osx_user_locale() CFLocaleRef myCFLocale = CFLocaleCopyCurrent(); NSLocale *myNSLocale = (NSLocale *)myCFLocale; [myNSLocale autorelease]; - NSString *nsIdentifier = [myNSLocale localeIdentifier]; + + // This produces gettext-invalid locale in recent macOS versions (11.4), + // like `ko-Kore_KR` instead of `ko_KR`. See T88877. + // NSString *nsIdentifier = [myNSLocale localeIdentifier]; + + const NSString *nsIdentifier = [myNSLocale languageCode]; + const NSString *const nsIdentifier_country = [myNSLocale countryCode]; + if ([nsIdentifier length] != 0 && [nsIdentifier_country length] != 0) { + nsIdentifier = [NSString stringWithFormat:@"%@_%@", nsIdentifier, nsIdentifier_country]; + } + user_locale = ::strdup([nsIdentifier UTF8String]); [pool drain]; |