diff options
Diffstat (limited to 'core/translation.cpp')
-rw-r--r-- | core/translation.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/translation.cpp b/core/translation.cpp index a402df3eea..afbc639eaa 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<Ref<Translation> >::Element *E = translations.front(); E; E = E->next()) { + + const Ref<Translation> &t = E->get(); + String l = t->get_locale(); + + locales.push_back(l); + } + + return locales; +} + Vector<String> TranslationServer::get_all_locales() { Vector<String> locales; @@ -1052,7 +1065,7 @@ StringName TranslationServer::translate(const StringName &p_message) const { if (fallback.length() >= 2) { const CharType *fptr = &fallback[0]; - bool near_match = false; + near_match = false; for (const Set<Ref<Translation> >::Element *E = translations.front(); E; E = E->next()) { const Ref<Translation> &t = E->get(); @@ -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() { |