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

[proof-of-concept] Add translation_context to Control nodes #4

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

Conversation

jkirsteins
Copy link
Owner

@jkirsteins jkirsteins commented Feb 20, 2025

Add a translation_context property to Control nodes.

Proof-of-concept for godotengine/godot-proposals#8061

I put together a proof-of-concept of how this could be implemented: #4

A concrete example

Before the change I use the string General in two places. A label in a settings screen (as in General settings) and on a card (as in "this is a card of an army General").

Before the change the generated *.pot file (the comment shows that it's used in two files):

#: card_template.tscn scenes/main_menu/settings_window.tscn
#: cards/card_data.tres
msgid "General"
msgstr "??? conflicting translation ???"

After the change you can specify the translation context on the label right in the Editor:

Screenshot 2025-02-21 at 00 14 41

And the generated *.pot/*.po files now have two items for General, which can be translated separately:

#: card_template.tscn cards/card_data.tres
msgid "General"
msgstr "Le général"

#: scenes/main_menu/settings_window.tscn
msgctxt "settings_window"
msgid "General"
msgstr "Paramètres généraux"

@jkirsteins jkirsteins marked this pull request as draft February 20, 2025 23:11
@jkirsteins jkirsteins changed the title Add translation_context to Control nodes [proof-of-concept] Add translation_context to Control nodes Feb 20, 2025
@jkirsteins jkirsteins force-pushed the janiskirsteins/control-translation-context-poc branch 3 times, most recently from 148d97d to f784ffc Compare February 21, 2025 12:14
@jkirsteins jkirsteins force-pushed the janiskirsteins/control-translation-context-poc branch from f784ffc to 6ca9d7e Compare February 21, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant