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

help: _i18nTransform not translate path defined in @nuxt/i18n pages configuration #363

Open
fedetorre opened this issue Sep 24, 2024 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@fedetorre
Copy link

📚 What are you trying to do?

Good morning,

I am try to generate a dynamic sitemap from a list of items.
In my project I use @nuxt/i18n for path translations. I have the following configuration of the i18n module:

i18n: { baseUrl: 'https://mydomain.com', locales, defaultLocale: 'en', strategy: 'prefix', detectBrowserLanguage: { useCookie: true, cookieKey: 'i18n_redirected', redirectOn: 'root', }, customRoutes: 'config', // disable custom route with page components pages: { 'terms-and-conditions': { en: 'terms-and-conditions', it: 'termini-e-condizioni', } }, },

If I use the _i18nTransform option for the sitemap generation I'm expecting that the sitemap will have an entry in the en version with /en/terms-and-conditions loc and one in the italian sitemap with the loc /it/termini-e-condizioni but the generated sitemaps has both the terms-and-conditions path at the end without translation. It seems that the _i18nTransform option only append the language prefix in the beginning part of the url. Is it true or I have to configure something else?

Thanks!

🔍 What have you tried?

No response

ℹ️ Additional context

No response

@fedetorre fedetorre added the help wanted Extra attention is needed label Sep 24, 2024
@harlan-zw
Copy link
Collaborator

The _i18nTransform config does not support the i18n pages config, I'd suggest having these as a static file if possible. This config should only be needed for dynamic data.

@jakubkoje
Copy link

I am trying to generate a sitemap for dynamic events from backend. The dynamic page has different paths in different languages. The _i18nTransform does not take this into an account, it just appends for example 'en' in front of the original loc path. Is there a way to make this work? Thanks.

defineI18nRoute({
  paths: {
    sk: '/podujatie/[id]',
    cs: '/udalost/[id]',
    en: '/event/[id]',
  },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants