From cfb7443e263b702e880dbe953c09760d6f29033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 2 Sep 2024 10:50:14 +0200 Subject: [PATCH] TranslationServer: Add fast path for comparison of equal locales --- core/string/translation_server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/string/translation_server.cpp b/core/string/translation_server.cpp index 6e784881d07..4ac79ad10ae 100644 --- a/core/string/translation_server.cpp +++ b/core/string/translation_server.cpp @@ -284,6 +284,11 @@ String TranslationServer::_standardize_locale(const String &p_locale, bool p_add } int TranslationServer::compare_locales(const String &p_locale_a, const String &p_locale_b) const { + if (p_locale_a == p_locale_b) { + // Exact match. + return 10; + } + String locale_a = _standardize_locale(p_locale_a, true); String locale_b = _standardize_locale(p_locale_b, true);