Przeglądaj źródła

Added check to get_all_locales to avoid adding duplicate locales to array

raphaelazev 3 lat temu
rodzic
commit
82527df55c
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      core/string/translation.cpp

+ 4 - 1
core/string/translation.cpp

@@ -1092,9 +1092,12 @@ Array TranslationServer::get_loaded_locales() const {
 		ERR_FAIL_COND_V(t.is_null(), Array());
 		String l = t->get_locale();
 
-		locales.push_back(l);
+		if (!locales.has(l)) {
+			locales.push_back(l);
+		}
 	}
 
+	locales.sort();
 	return locales;
 }