Skip to content

Commit

Permalink
macOS: reload locale only if no language set
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeboboliu committed Nov 22, 2023
1 parent 4700d2b commit d13a091
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ static void Main(string[] args)
{
UserSettings.LoadSettings();

if (!string.IsNullOrWhiteSpace(UserSettings.language))
{
CultureInfo.CurrentUICulture = new CultureInfo(UserSettings.language);
}
#if NET8_0_OR_GREATER
// 为 macOS 载入正确的 locale
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var asp = new Process
{
Expand All @@ -51,12 +55,7 @@ static void Main(string[] args)
catch (Exception e) {}

Check warning on line 55 in Program.cs

View workflow job for this annotation

GitHub Actions / build (linux-x64)

The variable 'e' is declared but never used

Check warning on line 55 in Program.cs

View workflow job for this annotation

GitHub Actions / build (linux-x64)

The variable 'e' is declared but never used

Check warning on line 55 in Program.cs

View workflow job for this annotation

GitHub Actions / build (osx-x64)

The variable 'e' is declared but never used

Check warning on line 55 in Program.cs

View workflow job for this annotation

GitHub Actions / build (osx-x64)

The variable 'e' is declared but never used
}
#endif

if (!string.IsNullOrWhiteSpace(UserSettings.language))
{
CultureInfo.CurrentUICulture = new CultureInfo(UserSettings.language);
}


// 本地化设置
if (CultureInfo.CurrentUICulture.Name == "zh-CN" && TimeZoneInfo.Local.Id == "China Standard Time")
{
Expand Down

0 comments on commit d13a091

Please sign in to comment.