Skip to content

Commit

Permalink
Recursive lang_get_defaulted() for English fallback
Browse files Browse the repository at this point in the history
Follows the same logic as in lang_get().

Fixes #21201
  • Loading branch information
dregad committed Mar 3, 2020
1 parent 2115bd0 commit 710a466
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/lang_api.php
Expand Up @@ -343,12 +343,13 @@ function lang_get_defaulted( $p_string, $p_default = null, $p_lang = null ) {

if( lang_exists( $p_string, $t_lang ) ) {
return lang_get( $p_string );
} elseif( $t_lang != 'english' ) {
# If the string was not found in the foreign language, then retry with English.
return lang_get_defaulted( $p_string, $p_default, 'english' );
} else {
if( null === $p_default ) {
return $p_string;
} else {
return $p_default;
}
# English string was not found either, return the default,
# or the original string if no default was provided
return $p_default !== null ? $p_default : $p_string;
}
}

Expand Down

0 comments on commit 710a466

Please sign in to comment.