-
-
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
Rework the auto translation system #87530
Conversation
b667dab
to
01fe285
Compare
@AThousandShips Changes made. |
Where's the "new default" in the current version of this PR? I don't think I see it. Edit: Ok, I understand now. Although, I do have a feeling that there could be a way to remove |
Can we deprecate To keep things compatible, make
|
Yes, this can be done by handling |
@timothyqiu @akien-mga The methods themselves would still need to be registered, right? To maintain GDNative compatibility I mean. |
Yeah, but they can be registered as compat bindings. See e.g. Alternatively, we can keep the methods registered as normal methods and the property registered too, and mark them deprecated. Both options should be fine. |
Alright, with the increasing number of nodes that need auto translation that don't inherit |
01fe285
to
4c9ef52
Compare
The PR has been heavily reworked, please see the updated OP. |
4c9ef52
to
81f08f7
Compare
This PR is ready. |
I don't have anything against the documentation. I'm still questioning the usefulness of |
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.
Quick code review. Looks good!
Still have to actually test.
@@ -3558,9 +3550,12 @@ void Control::_bind_methods() { | |||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size_flags_stretch_ratio", PROPERTY_HINT_RANGE, "0,20,0.01,or_greater"), "set_stretch_ratio", "get_stretch_ratio"); | |||
|
|||
ADD_GROUP("Localization", ""); | |||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_translate"), "set_auto_translate", "is_auto_translating"); | |||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "localize_numeral_system"), "set_localize_numeral_system", "is_localizing_numeral_system"); |
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.
Just food for thought - is this something that could be streamlined together with the added auto_translate_mode
, maybe adding enum values that enable both translation + numbers localization?
May not be a good idea, but just leaving this here for consideration.
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.
As much as I like the idea, how many extra options that would add? I feel like it would make it a little convoluted.
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.
Yeah I don't really see how it would work to be honest :D
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.
Clamping it all together in a BitField of some sort sounds interesting...
I tested it with this scene setup: With Auto Translate disabled on FileDialog, and after setting the project test locale to |
dc1e0cb
to
8770a19
Compare
I fixed the part that this PR affects, however, this will be only fixed completely with #86222, since this bug occurs because those strings are translated before being given to the button. |
8770a19
to
bac8812
Compare
bac8812
to
7b42c24
Compare
Changes made. |
Thanks! |
Closes godotengine/godot-proposals#8897.
This PR adds the
auto_translate_mode
member toNode
, deprecatingauto_translate
inControl
andWindow
. This not only removes the need for duplicate code between those two, but also makes it easier to add it to other node types in the future as well (such asLabel3D
).atr()
was also moved toNode
for the same reasons above.Here's a list of the available modes:
AUTO_TRANSLATE_MODE_ALWAYS
- Makesauto_translate
work exactly as it does now.AUTO_TRANSLATE_MODE_INHERIT
- The new default, inherits theauto_translate
value of its parent.AUTO_TRANSLATE_MODE_DISABLED
- The same as ifauto_translate
was toggled off.The new default slight breaks compatibility, but I think it's for the better.