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 auto translate mode for items in PopupMenu and OptionButton #103848

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timothyqiu
Copy link
Member

Make i18n for popup menus easier if only some items need auto translation. Similar to #97519 and #97353.

For example, the Editor / Layout submenu has to translate shortcut names (Save Layout, Load Layout, etc) but should not translate custom layout names. Currently, all items in this submenu are not translated as a result of #99158.

Also made some common popup menus in the editor to better utilize (per-item) auto translation mode.

@timothyqiu timothyqiu added bug enhancement topic:editor topic:gui cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release topic:i18n labels Mar 9, 2025
@timothyqiu timothyqiu added this to the 4.x milestone Mar 9, 2025
@timothyqiu timothyqiu requested review from a team as code owners March 9, 2025 04:36
@@ -612,6 +613,7 @@ ShaderCreateDialog::ShaderCreateDialog() {
// Modes.

mode_menu = memnew(OptionButton);
mode_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
Copy link
Member

Choose a reason for hiding this comment

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

The modes could be translated tbh.
But right now there is no way to expose them for translation.

@KoBeWi
Copy link
Member

KoBeWi commented Mar 9, 2025

Button text does not respect item auto-translation:

godot.windows.editor.dev.x86_64_1Uk3TJF0UH.mp4

@timothyqiu
Copy link
Member Author

Button text does not respect item auto-translation

Added virtual String _get_translated_text(const String &p_text) const to Button so that subclasses can customize how the button text should be translated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release enhancement topic:editor topic:gui topic:i18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants