Skip to content

queryContent does not support i18n #2589

Open
@814704261

Description

@814704261

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions