diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-19 16:46:48 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-19 16:46:48 +0200 |
commit | de48d5101b57991614db8d2a8f5e6a98badee11e (patch) | |
tree | ff206e51f5b1f7b2a0ea13b71122939166d642a7 | |
parent | 82efb1d262aea24b5f742820017fd11c496c3f8c (diff) |
Fix locale always selecting translation instead of "en", when no match found.
-rw-r--r-- | core/io/resource_loader.cpp | 2 | ||||
-rw-r--r-- | core/string/translation.cpp | 4 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 7d42a9c8d2..3e1c9d2e4a 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -820,7 +820,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem } String l = res_remaps[i].substr(split + 1).strip_edges(); int score = TranslationServer::get_singleton()->compare_locales(locale, l); - if (score >= best_score) { + if (score > best_score) { new_path = res_remaps[i].left(split); best_score = score; if (score == 10) { diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 5d7e583de1..674098b06c 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -544,7 +544,7 @@ Ref<Translation> TranslationServer::get_translation_object(const String &p_local String l = t->get_locale(); int score = compare_locales(p_locale, l); - if (score >= best_score) { + if (score > best_score) { res = t; best_score = score; if (score == 10) { @@ -617,7 +617,7 @@ StringName TranslationServer::_get_message_from_translations(const StringName &p String l = t->get_locale(); int score = compare_locales(p_locale, l); - if (score >= best_score) { + if (score > best_score) { StringName r; if (!plural) { res = t->get_message(p_message, p_context); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index b9291bcd0f..2b98f46c17 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -377,7 +377,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { lang_hint += locale; int score = TranslationServer::get_singleton()->compare_locales(host_lang, locale); - if (score >= best_score) { + if (score > best_score) { best = locale; best_score = score; if (score == 10) { |