Merge pull request #96462 from RandomShaper/opt_comp_loc

TranslationServer: Add fast path for comparison of equal locales
This commit is contained in:
Rémi Verschelde 2024-09-02 12:14:01 +02:00
commit 88197d4a51
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 5 additions and 0 deletions

View File

@ -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);