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

queryContent does not support i18n #2589

Open
814704261 opened this issue Mar 18, 2024 · 0 comments
Open

queryContent does not support i18n #2589

814704261 opened this issue Mar 18, 2024 · 0 comments

Comments

@814704261
Copy link

Environment

  • Operating System: Windows_NT
  • Node Version: v18.12.1
  • Nuxt Version: -
  • CLI Version: 3.10.1
  • Nitro Version: -
  • Package Manager: unknown
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

.

Describe the bug

i18n config

{
      i18n: {
        strategy: 'prefix_except_default',
        defaultLocale: 'zh',
        locales: ['zh', 'en']
      }
}

content config

{
    content: {
            locales: ['zh', 'en'],
            defaultLocale: 'zh',
    }
}

Problem Description

When my address is http://localhost:3000/en/doc/tutorial/getting , queryContent cannot find the document

const localePath = useLocalePath()

const route = useRoute()
const { data: articles } = await useAsyncData('page-doc', () =>
  queryContent<CommonParsedContent>(localePath(route.path)).findOne()
)

What I can guarantee is that the output of localPath(route. path) is en/doc/tutorial/getting started

Directory structure

image
image

Additional context

No response

Logs

No response

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

No branches or pull requests

1 participant