-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add ICU App-Local support on Mono #37037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| { | ||
| private static bool GetInvariantSwitchValue() => | ||
| GetSwitchValue("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linker will need a bool method which it can transform to false to disable ICU support at app build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the existing GlobalizationMode.get_Invariant property work for this? (It would need to be tranformed to true.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, we're still doing something similar:
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
Lines 17 to 32 in b0ed2bd
| bool invariantEnabled = GetInvariantSwitchValue(); | |
| if (!invariantEnabled) | |
| { | |
| if (TryGetAppLocalIcuSwitchValue(out string? icuSuffixAndVersion)) | |
| { | |
| LoadAppLocalIcu(icuSuffixAndVersion, suffixWithSeparator: true); | |
| } | |
| else if (Interop.Globalization.LoadICU() == 0) | |
| { | |
| string message = "Couldn't find a valid ICU package installed on the system. " + | |
| "Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support."; | |
| Environment.FailFast(message); | |
| } | |
| } | |
| return invariantEnabled; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vargaz does this look good, or is there any action I should take?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged this, but if something else need to happen here, I'm happy to put up a follow up PR.
src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.CoreCLR.cs
Outdated
Show resolved
Hide resolved
CoffeeFlux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime changes look good to me, thanks!
jkotas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds AppLocalIcu switch support on Mono. I also refactored GlobalizationMode to share the sources in between Mono and CoreCLR to avoid duplicating all the AppLocal and UseNls switches logic.
cc: @jkotas @thaystg @akoeplinger @tarekgh @ericstj