Open sgkoishi opened 1 year ago
https://github.com/Pryaxis/TShock/blob/a7360b635a38b57b11236f7386ab8532d0374ce4/docs/lang.md?plain=1#L1
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.
Terraria.Program.RunGame
orig_RunGame
LanguageManager.SetLanguage(GameCulture.DefaultCulture)
CurrentUICulture
enUS
Thus, the I18n.TranslationCultureInfo is always enUS if no TSHOCK_LANGUAGE, -lang or -language. https://github.com/Pryaxis/TShock/blob/a7360b635a38b57b11236f7386ab8532d0374ce4/TShockAPI/I18n.cs#L63
I18n.TranslationCultureInfo
TSHOCK_LANGUAGE
-lang
-language
The call of SetLanguage happens before TShock and plugins, so the original value of CurrentUICulture is no longer available.
SetLanguage
Some potential fix:
CultureInfo.s_currentThreadUICulture
CultureInfo.GetUserDefaultCulture
CultureInfo.InstalledUICulture
https://github.com/Pryaxis/TShock/blob/a7360b635a38b57b11236f7386ab8532d0374ce4/docs/lang.md?plain=1#L1
Theoretically TShock will detect the locale, but
Terraria.Program.RunGame
(orig_RunGame
for OTAPI) callsLanguageManager.SetLanguage(GameCulture.DefaultCulture)
, which indirectly overwrite theCurrentUICulture
toenUS
.Thus, the
I18n.TranslationCultureInfo
is alwaysenUS
if noTSHOCK_LANGUAGE
,-lang
or-language
. https://github.com/Pryaxis/TShock/blob/a7360b635a38b57b11236f7386ab8532d0374ce4/TShockAPI/I18n.cs#L63The call of
SetLanguage
happens before TShock and plugins, so the original value ofCurrentUICulture
is no longer available.Some potential fix:
CultureInfo.s_currentThreadUICulture
to null.CultureInfo.GetUserDefaultCulture
.CultureInfo.InstalledUICulture
.