-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Separate text
and tr_text
properties to control auto-translation
#2783
Comments
I think adding a property to Control to disable automatic translation is a better way to go about it, as you won't have to edit two properties every time you wish a label to be translated automatically. (This new property should not affect manual
We can probably make |
Not. These properties work in pairs, similar to how the |
I consider properties that change behind your back to be an anti-pattern, if my experience with We've had similar issues with the Weight property in RigidBody, which was removed in |
Like this: var _text = ""
var _text_autotranslate = true
var text:
get:
return _text
set(value):
_text = value
update()
var text_autotranslate:
get:
return _text_autotranslate
set(value):
_text_autotranslate = value
update()
func _notification(what):
match what:
NOTIFICATION_TRANSLATION_CHANGED:
if _text_autotranslate:
update()
func _draw():
if _text_autotranslate:
draw_text(tr(_text))
else:
draw_text(_text) ? Because this point is still important:
|
Again, it depends on which side. I see some problem that the Then we need to add the func get_actual_text():
if _text_autotranslate:
return tr(_text)
else:
return _text
func _draw():
draw_text(get_actual_text()) |
Closed because godotengine/godot#49149 is merged. |
Describe the project you are working on
No matter.
Describe the problem or limitation you are having in your project
godotengine/godot#43151
godotengine/godot#48662
godotengine/godot#43159
People complain that once a string is added as a translation key, it becomes impossible to display it without tweaks (adding a space or invisible character, or using
set_message_translation(false)
).set_message_translation
is not a good enough solution because:tr
function for this object, which can be inconvenient if a script is attached to it;NOTIFICATION_TRANSLATION_CHANGED
is not automatically sent.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add paired properties for auto-translated properties. In the editor, you need to set
text
to display the value as is ortr_text
to auto-translate.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
There is no need for
set_message_translation
andcan_translate_messages
,tr
behaves the same regardless of the object (we can move it to@GDScript
or@GlobalScope
).If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
This is core related and is a common problem.
The text was updated successfully, but these errors were encountered: