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

i18n: Remove our awkward &-escape support, except in [DesktopUI] #19218

Merged
merged 1 commit into from
May 31, 2024

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented May 31, 2024

Windows supports adding "&" before a text character in a string, and using that as an accelerator key. To actually produce a "&", you need to use "&&". This is mainly used in window menus and in classic win32 dialog boxes. Elsewhere in the app, it's not used. The Win32 "DrawText" API supports discarding & for drawing, and we've stuck to that standard for all the text backends, leading to awkward workarounds.

So, to simplify the code (before improving our text rendering code in other ways) let's get rid of it almost everywhere (except in win32 menus).

@hrydgard hrydgard added the Code Cleanup Cleanup to make future work easier. Needs to be done sometimes. label May 31, 2024
@hrydgard hrydgard added this to the v1.18.0 milestone May 31, 2024
@hrydgard hrydgard force-pushed the text-remove-ampersand-replacement branch from b2da337 to e23a026 Compare May 31, 2024 07:07
@hrydgard hrydgard force-pushed the text-remove-ampersand-replacement branch from e23a026 to 5999690 Compare May 31, 2024 07:46
@hrydgard hrydgard merged commit 7547126 into master May 31, 2024
18 checks passed
@hrydgard hrydgard deleted the text-remove-ampersand-replacement branch May 31, 2024 07:58
@@ -268,8 +268,7 @@ UI::EventReturn SavedataPopupScreen::OnDeleteButtonClick(UI::EventParams &e) {
}

static std::string CleanSaveString(const std::string &str) {
std::string s = ReplaceAll(str, "&", "&&");
s = ReplaceAll(s, "\n", " ");
std::string s = ReplaceAll(s, "\n", " ");
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably should look like this

std::string s = ReplaceAll(str, "\n", " ");

Copy link
Owner Author

Choose a reason for hiding this comment

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

Indeed, thanks!

Copy link
Owner Author

Choose a reason for hiding this comment

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

Fixed in eb31737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup Cleanup to make future work easier. Needs to be done sometimes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants