Skip to content

Commit

Permalink
Merge pull request #3056 from sgkoishi/pr3056
Browse files Browse the repository at this point in the history
Automatic language detection
  • Loading branch information
hakusaro authored Jan 26, 2025
2 parents c6dfb97 + c4a1413 commit f71f3b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions TShockAPI/I18n.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static CultureInfo Redirect(CultureInfo cultureInfo)
}
}

if (LanguageManager.Instance.ActiveCulture == GameCulture.DefaultCulture)
{
var bf = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static;
// LanguageManager.SetLanguage will change this so we need to reset it back to null
typeof(CultureInfo).GetField("s_currentThreadUICulture", bf)?.SetValue(null, null);
}
return CultureInfo.CurrentUICulture;
}
}
Expand Down

0 comments on commit f71f3b8

Please sign in to comment.