Repository: godotengine/godot
File: scene/main/window.cpp (C++)

Code before:

			Window *parent_window = Object::cast_to<Window>(parent_node);
			if (parent_window) {
				return parent_window->is_layout_rtl();
			}
			parent_node = parent_node->get_parent();
		}

		if (root_layout_direction == 1) {
			return false;
		} else if (root_layout_direction == 2) {
			return true;
		} else if (root_layout_direction == 3) {
			String locale = OS::get_singleton()->get_locale();
			return TS->is_locale_right_to_left(locale);
		} else {
			String locale = TranslationServer::get_singleton()->get_tool_locale();
			return TS->is_locale_right_to_left(locale);
		}
	} else if (layout_dir == LAYOUT_DIRECTION_LOCALE) {
		if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
			return true;
		} else {
			String locale = TranslationServer::get_singleton()->get_tool_locale();
			return TS->is_locale_right_to_left(locale);
		}
	} else {
		return (layout_dir == LAYOUT_DIRECTION_RTL);
	}
}

void Window::set_auto_translate(bool p_enable) {
	ERR_MAIN_THREAD_GUARD;
	if (p_enable == auto_translate) {
		return;
	}

	auto_translate = p_enable;

	notification(MainLoop::NOTIFICATION_TRANSLATION_CHANGED);
}

bool Window::is_auto_translating() const {
	ERR_READ_THREAD_GUARD_V(false);
	return auto_translate;
}

Transform2D Window::get_final_transform() const {
	ERR_READ_THREAD_GUARD_V(Transform2D());
	return window_transform * stretch_transform * global_canvas_transform;
}

Review comment (suggestion):
```suggestion
	set_auto_translate_mode(p_enable ? Node::AUTO_TRANSLATE_MODE_ALWAYS : Node::AUTO_TRANSLATE_MODE_DISABLED);
```

Code after:
			return false;
		} else if (root_layout_direction == 2) {
			return true;
		} else if (root_layout_direction == 3) {
			String locale = OS::get_singleton()->get_locale();
			return TS->is_locale_right_to_left(locale);
		} else {
			String locale = TranslationServer::get_singleton()->get_tool_locale();
			return TS->is_locale_right_to_left(locale);
		}
	} else if (layout_dir == LAYOUT_DIRECTION_LOCALE) {
		if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
			return true;
		} else {
			String locale = TranslationServer::get_singleton()->get_tool_locale();
			return TS->is_locale_right_to_left(locale);
		}
	} else {
		return (layout_dir == LAYOUT_DIRECTION_RTL);
	}
}

#ifndef DISABLE_DEPRECATED
void Window::set_auto_translate(bool p_enable) {
	ERR_MAIN_THREAD_GUARD;
	set_auto_translate_mode(p_enable ? AUTO_TRANSLATE_MODE_ALWAYS : AUTO_TRANSLATE_MODE_DISABLED);
}

bool Window::is_auto_translating() const {
	ERR_READ_THREAD_GUARD_V(false);
	return can_auto_translate();
}
#endif

Transform2D Window::get_final_transform() const {
	ERR_READ_THREAD_GUARD_V(Transform2D());
	return window_transform * stretch_transform * global_canvas_transform;
}

Transform2D Window::get_screen_transform_internal(bool p_absolute_position) const {
	ERR_READ_THREAD_GUARD_V(Transform2D());
	Transform2D embedder_transform;
	if (get_embedder()) {
		embedder_transform.translate_local(get_position());
		embedder_transform = get_embedder()->get_screen_transform_internal(p_absolute_position) * embedder_transform;
	} else if (p_absolute_position) {
		embedder_transform.translate_local(get_position());
	}
	return embedder_transform * get_final_transform();
}