-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 option to add built-in strings in the POT generation #86222
Add option to add built-in strings in the POT generation #86222
Conversation
a57cc59
to
1d02419
Compare
Does this pave the way to godotengine/godot-proposals#7334? As I understand it, it should, but I'm asking to make sure nonetheless. |
@Calinou It's a first step. For, it just populates the POT, but the plan is to add translations to the PO files in the future. |
Generate POT is disabled when you have only built-in strings included (no scenes). Not sure how useful is that, but technically it could work. EDIT: |
@KoBeWi As stated above, this PR won't work until its sister PR is merged (godotengine/godot-editor-l10n#13). |
1d02419
to
9c2c478
Compare
9c2c478
to
4240892
Compare
Alright, I made an important change on how This change was made so they could work better with
|
4240892
to
52df18d
Compare
ETR won't work for formatted text. Auto-translation only has effect on exact strings. |
I'm aware, but that method has a flaw: it overrides the original string if the locale is not set to "en" at the start. That means if a control has a lot of other controls (e. g.
I see. I will update those them. |
I only used ATR for dynamic texts. It's basically the same as your |
Not really, the |
52df18d
to
765ff9a
Compare
@KoBeWi I've added more cases, give me a heads-up if I forgot anything else. |
This change is missing if you were to supersede my PR: btw ATR in constructor was a mistake. |
765ff9a
to
6f7cb67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine on GUI side.
Here's the proposal I was talking about: godotengine/godot-proposals#8897 |
6f7cb67
to
9e099ce
Compare
Would this also enable translating built in strings with CSV or is that not possible? |
@Kiisu-Master Built-in nodes should already be using translations when available. |
9e099ce
to
735e657
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, though I'm a bit confused about when we should use atr(ETR(...))
and when it should only be ETR(...)
.
void load_editor_translations(const String &p_locale); | ||
void load_doc_translations(const String &p_locale); | ||
void load_property_translations(const String &p_locale); | ||
void load_doc_translations(const String &p_locale); | ||
void load_extractable_translations(const String &p_locale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is starting to look like something that could be refactored in a single method, using an enum parameter to define whether it's editor, property, doc, or extractable.
But that can be for future rework.
@@ -689,7 +705,7 @@ void ColorPicker::_text_type_toggled() { | |||
text_type->set_icon(nullptr); | |||
|
|||
c_text->set_editable(true); | |||
c_text->set_tooltip_text(RTR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); | |||
c_text->set_tooltip_text(ETR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that some of the tooltips use atr(ETR())
and others just ETR()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tooltips obey auto translation, so if they are a static string, they don't need atr()
. However, if the string has a dynamic component, it needs to be translated directly.
735e657
to
d70c45b
Compare
Thanks! |
Adds 'extractable' strings after #86222.
This PR adds the option to add the built-in strings that can appear inside user projects (such as
FileDialog
node and the menu fromLineEdit
) into the POT generation. This is made possible with the newETR/ETRN()
functions, which from now on should be used on those occasions. Here's the sister PR on the "l10n" repo: godotengine/godot-editor-l10n#13As a bonus, this PR also makes so that the POT generator stops putting location comments into strings that don't have one.
Bugsquad edit: Closes godotengine/godot-proposals#3827 Supersedes #81180
Production edit: Closes godotengine/godot-roadmap#33