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

Add hint for percent escape in translatable values #1750

Closed
Dahesor opened this issue Feb 10, 2025 · 1 comment · Fixed by #1754
Closed

Add hint for percent escape in translatable values #1750

Dahesor opened this issue Feb 10, 2025 · 1 comment · Fixed by #1754
Assignees

Comments

@Dahesor
Copy link

Dahesor commented Feb 10, 2025

Image

In the above situation, the % is just a part of the text. This is accepted by the game, but Spyglass marks it as an error and expects a following s.

@SPGoding
Copy link
Member

SPGoding commented Feb 11, 2025

Percent signs in translatable text should be escaped by using %% instead of %. The fact that the game does not complain loudly about the use of a single % does not mean it's good practice (as something like You have a %s % chance would not work -- the first %s would not be treated as a placeholder by the game. I suspect the game just gives up on formatting correctly when it encounters a single %), and in general we tend to be stricter than the game itself in our checking to encourage good practice and avoid common pitfalls.

Image

I think one potential improvement we could make is to update the error message to mention the fact that literal percent signs should be escaped as %% though.

@SPGoding SPGoding changed the title Not all "%" in language files marks a variable Add hint for percent escape in translatable values Feb 11, 2025
@SPGoding SPGoding self-assigned this Feb 11, 2025
@SPGoding SPGoding added ✨ feature New feature or request 💬 better error labels Feb 11, 2025
@SPGoding SPGoding removed the ✨ feature New feature or request label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants