title: Next Js dynamic i18n subfolder
body: <p>I am currently working with a headless WordPress site in Next.js. I struggle a bit with the routing for internationalization.
  I have 2 main page files relevant for this question:</p>
  <pre><code>pages/[...slug].tsx 
  </code></pre>
  <p>In this file I use a getStaticPaths function to fetch GraphQL data for all <strong>pages</strong> in my WordPress database.</p>
  <pre><code>pages/[locale]/Blog/[...slug].tsx 
  </code></pre>
  <p>In this file I use a getStaticPaths function to fetch GraphQL data for all <strong>blog posts</strong> in my WordPress database.</p>
  <p>I have locales configured in my next.config file like this:</p>
  <pre><code>i18n: {
      locales: ['da-DK', 'en-GB'],
      defaultLocale: 'da-DK',
    },
  </code></pre>
  <p>I struggle to find a way to catch all the blog posts. With my current file structure, I will catch all blog posts with an url like:</p>
  <pre><code>siteName/en/blog/page-name
  </code></pre>
  <p>BUT not blog posts under default language with the structure:</p>
  <pre><code>siteName/blog/page-name
  </code></pre>
  <p>I tried with [[locale]] but got the error:</p>
  <pre><code>Error: Optional route parameters are not yet supported (&quot;[[locale]]&quot;).
  </code></pre>
  <p>so only catch-all routes can be made optional it seems. Any idea how to handle something like this? Another way could be to 'join' the 2 different files for posts and blog posts and then use some conditional logic to sort if I need a Query for a post or a page. I would rather avoid this if possible...</p>