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: vueI18nBridgePath wrong #1417

Merged
merged 1 commit into from
Mar 30, 2022
Merged

Conversation

baixiaoyu2997
Copy link
Contributor

find in vue-i18n-bridge dist dir,only havevue-i18n-bridge.runtime.esm-bundler.js

find in vue-i18n-bridge dist dir,only have`vue-i18n-bridge.runtime.esm-bundler.js`
@baixiaoyu2997
Copy link
Contributor Author

baixiaoyu2997 commented Mar 30, 2022

i found a other issue ,can't use localePath in defineNuxtRouteMiddleware, show error:

Error: should be used in setup
    at useRouter (index.mjs?d6c6:10:1)
    at resolveRoute (vue-i18n-routing.es.js?118c:225:1)
    at localePath (vue-i18n-routing.es.js?118c:206:1)
    at eval (router.js?9b4a:11:1)
    at promisify (utils.js?ebed:315:1)
    at middlewareSeries (utils.js?ebed:292:1)
    at Vue.callMiddleware (client.js?06a0:431:1)
    at Vue._callee6$ (client.js?06a0:552:1)
    at tryCatch (runtime.js?96cf:63:1)
    at Generator.invoke [as _invoke] (runtime.js?96cf:294:1)

my code :

import { localePath } from '#i18n'

export default defineNuxtRouteMiddleware((nuxtApp) => {
  const locale = localStorage.getItem('locale') || 'en'
  if (locale !== 'en') {
    return navigateTo({
      path: localePath(nuxtApp.from.fullPath),
    })
  }
})

@rchl rchl requested a review from kazupon March 30, 2022 08:03
@kazupon
Copy link
Collaborator

kazupon commented Mar 30, 2022

@baixiaoyu2997
Good catch!
Thanks!

@kazupon kazupon merged commit 2af6fd2 into nuxt-modules:next Mar 30, 2022
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
find in vue-i18n-bridge dist dir,only have`vue-i18n-bridge.runtime.esm-bundler.js`
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.

2 participants