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

fix: locale not updated on navigation (no fallbackLocale) #647

Merged
merged 1 commit into from
Mar 31, 2020
Merged

fix: locale not updated on navigation (no fallbackLocale) #647

merged 1 commit into from
Mar 31, 2020

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented Mar 30, 2020

When:

  • detectBrowserLanguage was enabled
  • detectBrowserLanguage.fallbackLocale was not specified
  • preferred browser language was set to one that nuxt-i18n configuration
    didn't support

then navigating to another locale in SPA mode has updated the URL but
failed to change locale.

Fix by correcting the logic of browser language detection which was
supposed to return false when it didn't manage to detect language but
didn't always do that.

Resolves #643

When:
 - `detectBrowserLanguage` was enabled
 - `detectBrowserLanguage.fallbackLocale` was not specified
 - preferred browser language was set to one that nuxt-i18n configuration
   didn't support

then navigating to another locale in SPA mode has updated the URL but
failed to change locale.

Fix by correcting the logic of browser language detection which was
supposed to return false when it didn't manage to detect language but
didn't always do that.

Resolves #643
@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #647 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #647   +/-   ##
=======================================
  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 967cfa9...5f6803b. Read the comment docs.

@rchl rchl merged commit 1ad3ed1 into nuxt-modules:master Mar 31, 2020
@rchl rchl deleted the fix/no-fallback-locale branch March 31, 2020 07:21
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.

When you try to change the language, the URL fragment changes but the data on the page does not
1 participant