Skip to content

Fix i18n two letter language code check - #262

Open
DarkDefender wants to merge 1 commit into
MrGlockenspiel:mainfrom
DarkDefender:fix_i18n_two_letter_parse
Open

Fix i18n two letter language code check#262
DarkDefender wants to merge 1 commit into
MrGlockenspiel:mainfrom
DarkDefender:fix_i18n_two_letter_parse

Conversation

@DarkDefender

Copy link
Copy Markdown

Before this fix, various language codes (like "en_NL") would fail and erronosly pick something like "fr_FR".

This is because the "_" check in this while loop would push the index for "lang_code" out of bounds and could potentially make the function return a false positive.

As all first two letter combinations are the same for each lang_code entry, instead just do a direct comparison between the first variant in the lang_code array and lang.

Before this fix, various language codes (like "en_NL") would fail and
erronosly pick something like "fr_FR".

This is because the "_" check in this while loop would push the index
for "lang_code" out of bounds and could potentially make the function
return a false positive.

As all first two letter combinations are the same for each lang_code
entry, instead just do a direct comparison between the first variant
in the lang_code array and lang.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant