Skip to content

Commit

Permalink
fix: cannot work locale changing, when we move with <NuxtLink> on `…
Browse files Browse the repository at this point in the history
…no_prefix` (#1686)
  • Loading branch information
kazupon committed Nov 28, 2022
1 parent b3770a2 commit 159c46e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion specs/browser_language_detection/disable.spec.ts
Expand Up @@ -41,5 +41,5 @@ test('disable', async () => {
await page.waitForTimeout(100)

// set default locale
expect(await getText(page, '#lang-switcher-current-locale code')).toEqual('en')
expect(await getText(page, '#lang-switcher-current-locale code')).toEqual('fr')
})
4 changes: 4 additions & 0 deletions src/runtime/utils.ts
Expand Up @@ -240,6 +240,10 @@ export function detectLocale<Context extends NuxtApp = NuxtApp>(
finalLocale = getLocaleDomain(normalizedLocales)
} else if (strategy !== 'no_prefix') {
finalLocale = routeLocaleGetter(route)
} else {
if (!nuxtI18nOptions.detectBrowserLanguage) {
finalLocale = initialLocale
}
}
}

Expand Down

0 comments on commit 159c46e

Please sign in to comment.