Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More logical sequence in lang_get() if block
Code cleanup: use elseif and negate the test's expression for a more
logical flow (process the error case last).
  • Loading branch information
dregad committed Mar 3, 2020
1 parent 8d6784e commit 2115bd0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions core/lang_api.php
Expand Up @@ -299,16 +299,13 @@ function lang_get( $p_string, $p_lang = null ) {

if( lang_exists( $p_string, $t_lang ) ) {
return $g_lang_strings[$t_lang][$p_string];
} elseif( $t_lang != 'english' ) {
# If the string was not found in the foreign language, then retry with English.
return lang_get( $p_string, 'english' );
} else {
if( $t_lang == 'english' ) {
error_parameters( $p_string );
trigger_error( ERROR_LANG_STRING_NOT_FOUND, WARNING );
return '';
} else {

# if string is not found in a language other than english, then retry using the english language.
return lang_get( $p_string, 'english' );
}
error_parameters( $p_string );
trigger_error( ERROR_LANG_STRING_NOT_FOUND, WARNING );
return '';
}
}

Expand Down

0 comments on commit 2115bd0

Please sign in to comment.