Browse Source

Do not reload resources and send notification if locale is not changed.

(cherry picked from commit 829349d2ca6e49eaf0703154467ee8020484b387)
bruvzg 1 year ago
parent
commit
4cadc50bf7
1 changed files with 5 additions and 1 deletions
  1. 5 1
      core/string/translation.cpp

+ 5 - 1
core/string/translation.cpp

@@ -518,8 +518,12 @@ String TranslationServer::get_country_name(const String &p_country) const {
 }
 }
 
 
 void TranslationServer::set_locale(const String &p_locale) {
 void TranslationServer::set_locale(const String &p_locale) {
-	locale = standardize_locale(p_locale);
+	String new_locale = standardize_locale(p_locale);
+	if (locale == new_locale) {
+		return;
+	}
 
 
+	locale = new_locale;
 	ResourceLoader::reload_translation_remaps();
 	ResourceLoader::reload_translation_remaps();
 
 
 	if (OS::get_singleton()->get_main_loop()) {
 	if (OS::get_singleton()->get_main_loop()) {