Merge pull request #6943 from damon-myers/fix-mac-locale
Fix locale for macOS-style locales
This commit is contained in:
commit
8321e48ab0
@ -844,8 +844,11 @@ void Translation::_set_messages(const DVector<String>& p_messages){
|
|||||||
|
|
||||||
void Translation::set_locale(const String& p_locale) {
|
void Translation::set_locale(const String& p_locale) {
|
||||||
|
|
||||||
if(!is_valid_locale(p_locale)) {
|
// replaces '-' with '_' for macOS Sierra-style locales
|
||||||
String trimmed_locale = get_trimmed_locale(p_locale);
|
String univ_locale = p_locale.replace("-", "_");
|
||||||
|
|
||||||
|
if(!is_valid_locale(univ_locale)) {
|
||||||
|
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||||
|
|
||||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||||
@ -853,7 +856,7 @@ void Translation::set_locale(const String& p_locale) {
|
|||||||
locale=trimmed_locale;
|
locale=trimmed_locale;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
locale=p_locale;
|
locale=univ_locale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,8 +922,11 @@ Translation::Translation() {
|
|||||||
|
|
||||||
void TranslationServer::set_locale(const String& p_locale) {
|
void TranslationServer::set_locale(const String& p_locale) {
|
||||||
|
|
||||||
if(!is_valid_locale(p_locale)) {
|
// replaces '-' with '_' for macOS Sierra-style locales
|
||||||
String trimmed_locale = get_trimmed_locale(p_locale);
|
String univ_locale = p_locale.replace("-", "_");
|
||||||
|
|
||||||
|
if(!is_valid_locale(univ_locale)) {
|
||||||
|
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||||
|
|
||||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||||
@ -928,7 +934,7 @@ void TranslationServer::set_locale(const String& p_locale) {
|
|||||||
locale=trimmed_locale;
|
locale=trimmed_locale;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
locale=p_locale;
|
locale=univ_locale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user