Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Match pages for locales? #21

Open
verbeeksteven opened this issue Apr 3, 2019 · 3 comments
Open

Match pages for locales? #21

verbeeksteven opened this issue Apr 3, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@verbeeksteven
Copy link

Hello,

I see we have

   pages: [{ // (optional)
      type: 'Article',         // TypeName from prismic
      match: '/article/:uid',  // Pages will be generated under this pattern
      path: '/article',        // Placeholder page for unpublished documents
      component: require.resolve('./src/templates/article.js'),
    }],

Which will allow you to say Article = /article/slug/ however is there a way to say

Article EN = /article/slug
Article FR = /articleinfrench/slug

etc?

@birkir
Copy link
Owner

birkir commented Apr 3, 2019

@verbeeksteven
Copy link
Author

In this example, how would you translate the word article?

match: '/:lang?/article/:uid',

Or would you just have it twice?

     {
        type: 'Article',
        match: '/article/:uid',
        path: '/article',
        component: require.resolve('./src/templates/article.js'),
      },
      {
        type: 'Article',
        match: '/fr/articleinfrench/:uid',
        path: '/article',
        component: require.resolve('./src/templates/article.js'),
      }

?

@birkir
Copy link
Owner

birkir commented Apr 6, 2019

I think you would have to do it twice. This is a url pattern matching mechanism so no translations or any kind of word mappings are possible.

I can add params like { lang: 'fr' } to the configuration to allow you to define this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants