diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-23 14:38:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-23 14:38:25 +0200 |
commit | 68b1ac2d1294288f099c098183f24772db3683e6 (patch) | |
tree | ce2f1a06097aaec99b20336d83c7f16f06e0d04d /core | |
parent | 8b2eeaa724829445b1f8b65855a816003df4f2ba (diff) | |
parent | 87535fe2912030b041f21e48efd70c17b2c3c64f (diff) |
Merge pull request #22371 from akien-mga/locale-C
Fallback to "en" when invalid locale is requested
Diffstat (limited to 'core')
-rw-r--r-- | core/translation.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/translation.cpp b/core/translation.cpp index ce9b338ef6..25e67e9b96 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -938,11 +938,14 @@ void TranslationServer::set_locale(const String &p_locale) { if (!is_locale_valid(univ_locale)) { String trimmed_locale = get_trimmed_locale(univ_locale); + print_verbose(vformat("Unsupported locale '%s', falling back to '%s'.", p_locale, trimmed_locale)); - ERR_EXPLAIN("Invalid locale: " + trimmed_locale); - ERR_FAIL_COND(!is_locale_valid(trimmed_locale)); - - locale = trimmed_locale; + if (!is_locale_valid(trimmed_locale)) { + ERR_PRINTS(vformat("Unsupported locale '%s', falling back to 'en'.", trimmed_locale)); + locale = "en"; + } else { + locale = trimmed_locale; + } } else { locale = univ_locale; } |