1
0
Fork 0

Merge pull request #102798 from bruvzg/tr_names

Fix editor UI showing empty string for unknown locales.
This commit is contained in:
Thaddeus Crews 2025-02-13 10:15:42 -06:00
commit 627373a7d0
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
1 changed files with 18 additions and 6 deletions

View File

@ -299,12 +299,12 @@ String TranslationServer::get_locale_name(const String &p_locale) const {
} }
} }
String name = language_map[lang_name]; String name = get_language_name(lang_name);
if (!script_name.is_empty()) { if (!script_name.is_empty()) {
name = name + " (" + script_map[script_name] + ")"; name = name + " (" + get_script_name(script_name) + ")";
} }
if (!country_name.is_empty()) { if (!country_name.is_empty()) {
name = name + ", " + country_name_map[country_name]; name = name + ", " + get_country_name(country_name);
} }
return name; return name;
} }
@ -320,7 +320,11 @@ Vector<String> TranslationServer::get_all_languages() const {
} }
String TranslationServer::get_language_name(const String &p_language) const { String TranslationServer::get_language_name(const String &p_language) const {
return language_map[p_language]; if (language_map.has(p_language)) {
return language_map[p_language];
} else {
return p_language;
}
} }
Vector<String> TranslationServer::get_all_scripts() const { Vector<String> TranslationServer::get_all_scripts() const {
@ -334,7 +338,11 @@ Vector<String> TranslationServer::get_all_scripts() const {
} }
String TranslationServer::get_script_name(const String &p_script) const { String TranslationServer::get_script_name(const String &p_script) const {
return script_map[p_script]; if (script_map.has(p_script)) {
return script_map[p_script];
} else {
return p_script;
}
} }
Vector<String> TranslationServer::get_all_countries() const { Vector<String> TranslationServer::get_all_countries() const {
@ -348,7 +356,11 @@ Vector<String> TranslationServer::get_all_countries() const {
} }
String TranslationServer::get_country_name(const String &p_country) const { String TranslationServer::get_country_name(const String &p_country) const {
return country_name_map[p_country]; if (country_name_map.has(p_country)) {
return country_name_map[p_country];
} else {
return p_country;
}
} }
void TranslationServer::set_locale(const String &p_locale) { void TranslationServer::set_locale(const String &p_locale) {