summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-02 12:14:01 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-02 12:14:01 +0200
commit88197d4a513a7873cb7cf85138a42a04fb1c9011 (patch)
tree02fbf91b802cb9dc2be532cb8c97f39ac4127213
parentf546bf6aea165ed52321eea9ad390d52499c5c0a (diff)
parentcfb7443e263b702e880dbe953c09760d6f29033b (diff)
downloadredot-engine-88197d4a513a7873cb7cf85138a42a04fb1c9011.tar.gz
Merge pull request #96462 from RandomShaper/opt_comp_loc
TranslationServer: Add fast path for comparison of equal locales
-rw-r--r--core/string/translation_server.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/string/translation_server.cpp b/core/string/translation_server.cpp
index 6e784881d0..4ac79ad10a 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);