Skip to content
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

Unable to detect system locale #2957

Open
sgkoishi opened this issue Jun 13, 2023 · 0 comments
Open

Unable to detect system locale #2957

sgkoishi opened this issue Jun 13, 2023 · 0 comments

Comments

@sgkoishi
Copy link
Contributor

TShock supports automatic language detection based on your system regional settings. If you want to override this, set the `TSHOCK_LANGUAGE` environment variable to a different language, or pass the `-lang` command line argument to change the language.

Theoretically TShock will detect the locale, but Terraria.Program.RunGame (orig_RunGame for OTAPI) calls LanguageManager.SetLanguage(GameCulture.DefaultCulture), which indirectly overwrite the CurrentUICulture to enUS.

Thus, the I18n.TranslationCultureInfo is always enUS if no TSHOCK_LANGUAGE, -lang or -language.

return CultureInfo.CurrentUICulture;

The call of SetLanguage happens before TShock and plugins, so the original value of CurrentUICulture is no longer available.

Some potential fix:

  • Set the (private) field CultureInfo.s_currentThreadUICulture to null.
  • Read the (private) property CultureInfo.GetUserDefaultCulture.
  • Read the public property CultureInfo.InstalledUICulture.
sgkoishi added a commit to sgkoishi/yaaiomni that referenced this issue Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant