diff --git a/core/translation.cpp b/core/translation.cpp index 6921f1d9f1b..afbc639eaa6 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -968,6 +968,19 @@ String TranslationServer::get_locale_name(const String &p_locale) const { return locale_name_map[p_locale]; } +Array TranslationServer::get_loaded_locales() const { + Array locales; + for (const Set >::Element *E = translations.front(); E; E = E->next()) { + + const Ref &t = E->get(); + String l = t->get_locale(); + + locales.push_back(l); + } + + return locales; +} + Vector TranslationServer::get_all_locales() { Vector locales; @@ -1168,6 +1181,8 @@ void TranslationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_translation", "translation"), &TranslationServer::remove_translation); ClassDB::bind_method(D_METHOD("clear"), &TranslationServer::clear); + + ClassDB::bind_method(D_METHOD("get_loaded_locales"), &TranslationServer::get_loaded_locales); } void TranslationServer::load_translations() { diff --git a/core/translation.h b/core/translation.h index b12bad0d727..d172b9ecf2e 100644 --- a/core/translation.h +++ b/core/translation.h @@ -94,6 +94,8 @@ public: String get_locale_name(const String &p_locale) const; + Array get_loaded_locales() const; + void add_translation(const Ref &p_translation); void remove_translation(const Ref &p_translation);