Detect the default locale name during startup on Apple platforms#68706
Detect the default locale name during startup on Apple platforms#68706steveisok merged 8 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsThis change adds a function to lookup the current Fixes #68321
|
This change adds a function to lookup the current NSLocale and extract the language + country code to load into ICU by default. Previously, we would defer to uloc_getDefault in ICU, which would return a value we would ignore (en_US_POSIX) and result in falling back to invariant mode. Fixes dotnet#68321
7ee4f55 to
2f780a4
Compare
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| return strdup([localeName UTF8String]); | ||
| } | ||
|
|
||
| if ([currentLocale.languageCode length] > 0 && [currentLocale.countryCode length] > 0) |
There was a problem hiding this comment.
It's possible if it grabs the localeIdentifier property.
https://developer.apple.com/documentation/foundation/nslocale/1416263-localeidentifier?language=objc
There was a problem hiding this comment.
great, I would suggest getting localeIdentifier then normalize it to the .NET culture name form.
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
|
|
||
| [Fact] | ||
| [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] |
There was a problem hiding this comment.
Is this not going to pass on windows and Linux too?
There was a problem hiding this comment.
It is possible to fail on Linux and Windows. On Windows it is unlikely the users will set the user locale to Invariant but it is possible. For Linux, some distros set the locale to "C" which we replace it with Invariant. That means it is likely to fail on Linux.
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
b08d2af to
5f367d5
Compare
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@tarekgh can you please give this another review? |
8200a40 to
28cd339
Compare
|
Failure is unrelated #68932 |
|
/backport to release/6.0 |
|
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2278294189 |
This change adds a function to lookup the current
NSLocaleand extract the language + country code to load into ICU by default. Previously, we would defer to uloc_getDefault in ICU, which would return a value we would ignore (en_US_POSIX) and result in falling back to invariant mode.Fixes #68321