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

fix: /help, /me, and /p commands can't work in non-English languages #3039

Open
wants to merge 7 commits into
base: general-devel
Choose a base branch
from

Conversation

ACaiCat
Copy link

@ACaiCat ACaiCat commented Jul 31, 2024

When TShock runs in a non-English language, vanilla commands prefix will be localized.

eg.(Chinese) /help (English command prefix) => /帮助 (Chinese command prefix)

TShock.OnChat cannot correctly handle vanilla command prefixes

e.g.(Chinese) When a player use /help, TShock will execute /帮助 (causing the command to not be found).
image

Invalid command entered. Type /help for a list of valid commands.

This PR add EnglishLanguage.GetCommandPrefixByName to get English vanilla command prefix.

image

@ACaiCat
Copy link
Author

ACaiCat commented Jul 31, 2024

Solve #2914

@ACaiCat
Copy link
Author

ACaiCat commented Oct 26, 2024

Could someone review this PR?

@hakusaro
Copy link
Member

Can someone else look at this too?

@hakusaro hakusaro requested review from bartico6 and Arthri October 26, 2024 12:19
@sgkoishi
Copy link
Contributor

This is requesting the enUS locale as set earlier

LanguageManager.Instance.SetLanguage(GameCulture.FromCultureName(GameCulture.CultureName.English));

I guess the Clear was done for similar reason like my implementation (but I did set the _localizedCommands back after)
https://github.com/sgkoishi/yaaiomni/blob/debf82951dd84bd307fc7bce06a1c03160479976/Core/Enhancements.cs#L129

@bartico6
Copy link
Member

Can someone else look at this too?

I would, but I don't understand the issue very well.. Can you ELI5 what is wrong?

@sgkoishi
Copy link
Contributor

Can someone else look at this too?

I would, but I don't understand the issue very well.. Can you ELI5 what is wrong?

Terraria will translate chat commands into command id. TShock translate them back to keep the command working.
However, when the server and the client have different locale, a enUS player send /help will be sent as CommandId: Help and a deDE server will translate it back to /hilfe, thus the command is broken.

Copy link
Contributor

@Arthri Arthri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and can confirm that it works as intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants