Merge pull request #107344 from timothyqiu/can-auto-translate

Expose `Node.can_auto_translate()`
This commit is contained in:
Rémi Verschelde 2025-06-11 11:20:18 +02:00
commit 875a0979f3
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 9 additions and 2 deletions

View File

@ -1002,7 +1002,7 @@
<member name="anchor_top" type="float" setter="_set_anchor" getter="get_anchor" default="0.0">
Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top offset updates when the node moves or changes size. You can use one of the [enum Anchor] constants for convenience.
</member>
<member name="auto_translate" type="bool" setter="set_auto_translate" getter="is_auto_translating" deprecated="Use [member Node.auto_translate_mode] instead.">
<member name="auto_translate" type="bool" setter="set_auto_translate" getter="is_auto_translating" deprecated="Use [member Node.auto_translate_mode] and [method Node.can_auto_translate] instead.">
Toggles if any text should automatically change to its translated version depending on the current locale.
</member>
<member name="clip_contents" type="bool" setter="set_clip_contents" getter="is_clipping_contents" default="false">

View File

@ -239,6 +239,12 @@
This function ensures that the calling of this function will succeed, no matter whether it's being done from a thread or not. If called from a thread that is not allowed to call the function, the call will become deferred. Otherwise, the call will go through directly.
</description>
</method>
<method name="can_auto_translate" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if this node can automatically translate messages depending on the current locale. See [member auto_translate_mode], [method atr], and [method atr_n].
</description>
</method>
<method name="can_process" qualifiers="const">
<return type="bool" />
<description>

View File

@ -587,7 +587,7 @@
<member name="always_on_top" type="bool" setter="set_flag" getter="get_flag" default="false">
If [code]true[/code], the window will be on top of all other windows. Does not work if [member transient] is enabled.
</member>
<member name="auto_translate" type="bool" setter="set_auto_translate" getter="is_auto_translating" deprecated="Use [member Node.auto_translate_mode] instead.">
<member name="auto_translate" type="bool" setter="set_auto_translate" getter="is_auto_translating" deprecated="Use [member Node.auto_translate_mode] and [method Node.can_auto_translate] instead.">
Toggles if any text should automatically change to its translated version depending on the current locale.
</member>
<member name="borderless" type="bool" setter="set_flag" getter="get_flag" default="false">

View File

@ -3792,6 +3792,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_translate_mode", "mode"), &Node::set_auto_translate_mode);
ClassDB::bind_method(D_METHOD("get_auto_translate_mode"), &Node::get_auto_translate_mode);
ClassDB::bind_method(D_METHOD("can_auto_translate"), &Node::can_auto_translate);
ClassDB::bind_method(D_METHOD("set_translation_domain_inherited"), &Node::set_translation_domain_inherited);
ClassDB::bind_method(D_METHOD("get_window"), &Node::get_window);