-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33291 from cincuranet/fix-local-locale
Forcibly sets "en-US" locale. * English locale is needed for comparisons, string to number parsing, etc. operations to succeed. * It does not deal with locale on the database side, which might result in i.e. different sorting and hence tests failing.
- Loading branch information
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Globalization; | ||
using System.Runtime.CompilerServices; | ||
|
||
internal static class ModuleInitializer | ||
{ | ||
[ModuleInitializer] | ||
internal static void Initialize() | ||
{ | ||
InitializeLocale(); | ||
} | ||
|
||
private static void InitializeLocale() | ||
{ | ||
var culture = new CultureInfo("en-US"); | ||
CultureInfo.DefaultThreadCurrentCulture = culture; | ||
CultureInfo.DefaultThreadCurrentUICulture = culture; | ||
Thread.CurrentThread.CurrentCulture = culture; | ||
Thread.CurrentThread.CurrentUICulture = culture; | ||
} | ||
} |