Skip to content

Commit 9285bb3

Browse files
committed
Don't update scene tree when calling Translation::set_locale()
1 parent 6c9765d commit 9285bb3

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

core/string/translation.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include "translation.h"
3232

33-
#include "core/os/os.h"
3433
#include "core/os/thread.h"
3534
#include "core/string/translation_server.h"
3635

@@ -74,21 +73,6 @@ void Translation::_set_messages(const Dictionary &p_messages) {
7473

7574
void Translation::set_locale(const String &p_locale) {
7675
locale = TranslationServer::get_singleton()->standardize_locale(p_locale);
77-
78-
if (Thread::is_main_thread()) {
79-
_notify_translation_changed_if_applies();
80-
} else {
81-
// This has to happen on the main thread (bypassing the ResourceLoader per-thread call queue)
82-
// because it interacts with the generally non-thread-safe window management, leading to
83-
// different issues across platforms otherwise.
84-
MessageQueue::get_main_singleton()->push_callable(callable_mp(this, &Translation::_notify_translation_changed_if_applies));
85-
}
86-
}
87-
88-
void Translation::_notify_translation_changed_if_applies() {
89-
if (OS::get_singleton()->get_main_loop() && TranslationServer::get_singleton()->get_loaded_locales().has(get_locale())) {
90-
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_TRANSLATION_CHANGED);
91-
}
9276
}
9377

9478
void Translation::add_message(const StringName &p_src_text, const StringName &p_xlated_text, const StringName &p_context) {

core/string/translation.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class Translation : public Resource {
4545
virtual Dictionary _get_messages() const;
4646
virtual void _set_messages(const Dictionary &p_messages);
4747

48-
void _notify_translation_changed_if_applies();
49-
5048
protected:
5149
static void _bind_methods();
5250

0 commit comments

Comments
 (0)