Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: match against full language code provided by the browser #651

Merged
merged 1 commit into from Apr 2, 2020
Merged

feature: match against full language code provided by the browser #651

merged 1 commit into from Apr 2, 2020

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented Mar 31, 2020

For detecting and redirecting to browser language the module only
looked at first two letters of the language codes provided by the
browser so it wasn't able to match up more specific locale codes like
en-GB or zh-CN.

Fix by matching checking against full language code first and then
falling back to only first two letters if no higher-ranked code
was found.

Resolves #650
Resolves #563

@codecov
Copy link

codecov bot commented Mar 31, 2020

Codecov Report

Merging #651 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #651   +/-   ##
=======================================
  Coverage   99.18%   99.18%           
=======================================
  Files           3        3           
  Lines         122      122           
  Branches       32       32           
=======================================
  Hits          121      121           
  Misses          1        1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d9ab31...26db412. Read the comment docs.

@rchl rchl mentioned this pull request Apr 1, 2020
@mcdmaster
Copy link

Looks fine. Can you please go ahead with this PR before long? Thank you!

For detecting and redirecting to browser language the module only
looked at first two letters of the first language of the language codes
provided by the browser so it wasn't able to match up more specific
locale codes like en-GB or zh-CN and didn't consider lower-ranked
language codes that user preferred.

Fix by matching checking against full language code first and then
falling back to only first two letters if no higher-ranked code was found.
And consider all user-preferred locales.

Resolves #650
Resolves #563
@rchl rchl merged commit 93e1918 into nuxt-modules:master Apr 2, 2020
@rchl rchl deleted the feature/match-full-browser-locale branch April 2, 2020 09:13
@mcdmaster
Copy link

Thank you!

rchl added a commit that referenced this pull request Apr 3, 2020
Related to PR #651 and new browser language detection logic that
takes into account full (like en-GB) language codes.

Co-authored-by: mcdmaster <mcdmaster@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants