3636#include " core/input/input_map.h"
3737#include " core/os/os.h"
3838#include " core/string/string_builder.h"
39- #include " core/string/translation_server.h"
4039#include " scene/gui/scroll_container.h"
4140#include " scene/main/canvas_layer.h"
4241#include " scene/main/window.h"
@@ -3548,12 +3547,9 @@ bool Control::is_layout_rtl() const {
35483547 } else if (proj_root_layout_direction == 2 ) {
35493548 data.is_rtl = true ;
35503549 } else if (proj_root_layout_direction == 3 ) {
3551- String locale = OS::get_singleton ()->get_locale ();
3552- data.is_rtl = TS->is_locale_right_to_left (locale);
3550+ data.is_rtl = TS->is_locale_right_to_left (OS::get_singleton ()->get_locale ());
35533551 } else {
3554- const Ref<Translation> &t = TranslationServer::get_singleton ()->get_translation_object (TranslationServer::get_singleton ()->get_locale ());
3555- String locale = t.is_valid () ? t->get_locale () : TranslationServer::get_singleton ()->get_fallback_locale ();
3556- data.is_rtl = TS->is_locale_right_to_left (locale);
3552+ data.is_rtl = TS->is_locale_right_to_left (_get_locale ());
35573553 }
35583554 return data.is_rtl ;
35593555 }
@@ -3564,8 +3560,9 @@ bool Control::is_layout_rtl() const {
35643560 return data.is_rtl ;
35653561 }
35663562#endif // TOOLS_ENABLED
3563+ const StringName domain_name = get_translation_domain ();
35673564 Node *parent_node = get_parent ();
3568- while (parent_node) {
3565+ while (parent_node && domain_name == parent_node-> get_translation_domain () ) {
35693566 Control *parent_control = Object::cast_to<Control>(parent_node);
35703567 if (parent_control) {
35713568 data.is_rtl = parent_control->is_layout_rtl ();
@@ -3588,22 +3585,19 @@ bool Control::is_layout_rtl() const {
35883585 String locale = OS::get_singleton ()->get_locale ();
35893586 data.is_rtl = TS->is_locale_right_to_left (locale);
35903587 } else {
3591- String locale = TranslationServer::get_singleton ()->get_tool_locale ();
3592- data.is_rtl = TS->is_locale_right_to_left (locale);
3588+ data.is_rtl = TS->is_locale_right_to_left (_get_locale ());
35933589 }
35943590 } else if (data.layout_dir == LAYOUT_DIRECTION_APPLICATION_LOCALE) {
35953591 if (GLOBAL_GET_CACHED (bool , " internationalization/rendering/force_right_to_left_layout_direction" )) {
35963592 data.is_rtl = true ;
35973593 } else {
3598- String locale = TranslationServer::get_singleton ()->get_tool_locale ();
3599- data.is_rtl = TS->is_locale_right_to_left (locale);
3594+ data.is_rtl = TS->is_locale_right_to_left (_get_locale ());
36003595 }
36013596 } else if (data.layout_dir == LAYOUT_DIRECTION_SYSTEM_LOCALE) {
36023597 if (GLOBAL_GET_CACHED (bool , " internationalization/rendering/force_right_to_left_layout_direction" )) {
3603- const_cast <Control *>( this )-> data .is_rtl = true ;
3598+ data.is_rtl = true ;
36043599 } else {
3605- String locale = OS::get_singleton ()->get_locale ();
3606- const_cast <Control *>(this )->data .is_rtl = TS->is_locale_right_to_left (locale);
3600+ data.is_rtl = TS->is_locale_right_to_left (OS::get_singleton ()->get_locale ());
36073601 }
36083602 } else {
36093603 data.is_rtl = (data.layout_dir == LAYOUT_DIRECTION_RTL);
0 commit comments