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

Use of @nuxtjs/prismic with nuxt-i18n #90

Closed
aceol opened this issue Jul 22, 2020 · 4 comments
Closed

Use of @nuxtjs/prismic with nuxt-i18n #90

aceol opened this issue Jul 22, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@aceol
Copy link

aceol commented Jul 22, 2020

In the newer version of nuxt-18n, the url of the pages can be internationalized in the nuxt.config.js

  modules: [
    [
      'nuxt-i18n',
      {
        parsePages: false, // Required
        pages: {
          about: {
            'fr-fr': '/a-propos',
            'en-gb': '/about'
          }
        }
      }
    ],

If I miss parsePage: false it is yelling because it can't find preview.vue generated by @nuxtjs/prismic.

ERROR ENOENT: no such file or directory, open '/Users/ace/Projects/PIX/pix-site/.nuxt/prismic/pages/preview.vue'

But I need parsePage: true, because the pages name can also be specified in the page file

export default {
  name: 'About',
  nuxtI18n: {
    paths: {
          'fr-fr': '/a-propos',
          'en-gb': '/about'
    }
  },

Any advice on how to achieve that?

@lihbr
Copy link
Collaborator

lihbr commented Jul 27, 2020

Hey @aceol, sorry for the late answer, have you tried excluding preview from i18n: https://i18n.nuxtjs.org/routing.html#ignore-routes (last example), perhaps something like this could solve your issue, let me know!

modules: [
  [
    'nuxt-i18n',
    {
      parsePages: true,
      pages: {
        about: {
          'fr-fr': '/a-propos',
          'en-gb': '/about'
        },
        preview: false
      }
    }
  ],
  /* ... */
}

@lihbr lihbr added the stale label Aug 25, 2020
Copy link
Collaborator

lihbr commented Feb 6, 2021

Closing since inactive, feel free to reopen if needed~

@lihbr lihbr closed this as completed Feb 6, 2021
@angeloashmore
Copy link

angeloashmore commented Apr 7, 2022

@lihbr I just encountered this issue as well while using @nuxtjs/i18n.

WARN  [@nuxtjs/i18n] Couldn't read page component file (ENOENT: no such file or directory, open '[path-to-project]/.nuxt/prismic/pages/preview.vue')

Adding pages.preview: false fixes the issue, but only if parsePages is false. If parsePages is true, the pages option is ignored (I think).

{
  "i18n": {
    "parsePages": false,
    "pages": {
      "preview": false
    }
  }
}

To remove the warning, would it possible to add nuxtI18n: false to preview.vue? That page should not need localization so it should be okay to opt-out of i18n. Although @nuxtjs/i18n is a separate module, it seems like a common use case.

https://i18n.nuxtjs.org/ignoring-localized-routes/#disable-localized-routes

@lihbr lihbr reopened this Apr 8, 2022
@lihbr lihbr closed this as completed in 7ee7f29 Apr 8, 2022
@lihbr
Copy link
Collaborator

lihbr commented Apr 8, 2022

Very nice catch! Didn't know about this option. Published in 1.4.2

@lihbr lihbr added bug Something isn't working and removed stale labels Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants