Skip to content

Commit 03cae12

Browse files
committed
Merge pull request #106295 from timothyqiu/legacy-l10n
Remove translation loading logic that was never used
2 parents cc07dc4 + bbc6643 commit 03cae12

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

core/string/translation_server.cpp

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -424,28 +424,6 @@ StringName TranslationServer::translate_plural(const StringName &p_message, cons
424424
return main_domain->translate_plural(p_message, p_message_plural, p_n, p_context);
425425
}
426426

427-
bool TranslationServer::_load_translations(const String &p_from) {
428-
if (ProjectSettings::get_singleton()->has_setting(p_from)) {
429-
const Vector<String> &translation_names = GLOBAL_GET(p_from);
430-
431-
int tcount = translation_names.size();
432-
433-
if (tcount) {
434-
const String *r = translation_names.ptr();
435-
436-
for (int i = 0; i < tcount; i++) {
437-
Ref<Translation> tr = ResourceLoader::load(r[i]);
438-
if (tr.is_valid()) {
439-
add_translation(tr);
440-
}
441-
}
442-
}
443-
return true;
444-
}
445-
446-
return false;
447-
}
448-
449427
bool TranslationServer::has_domain(const StringName &p_domain) const {
450428
if (p_domain == StringName()) {
451429
return true;
@@ -641,11 +619,16 @@ void TranslationServer::_bind_methods() {
641619
}
642620

643621
void TranslationServer::load_translations() {
644-
_load_translations("internationalization/locale/translations"); //all
645-
_load_translations("internationalization/locale/translations_" + locale.substr(0, 2));
646-
647-
if (locale.substr(0, 2) != locale) {
648-
_load_translations("internationalization/locale/translations_" + locale);
622+
const String prop = "internationalization/locale/translations";
623+
if (!ProjectSettings::get_singleton()->has_setting(prop)) {
624+
return;
625+
}
626+
const Vector<String> &translations = GLOBAL_GET(prop);
627+
for (const String &path : translations) {
628+
Ref<Translation> tr = ResourceLoader::load(path);
629+
if (tr.is_valid()) {
630+
add_translation(tr);
631+
}
649632
}
650633
}
651634

core/string/translation_server.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class TranslationServer : public Object {
5050
bool enabled = true;
5151

5252
static inline TranslationServer *singleton = nullptr;
53-
bool _load_translations(const String &p_from);
5453

5554
static void _bind_methods();
5655

0 commit comments

Comments
 (0)