microapps / gatsby-plugin-react-i18next

Easily translate your Gatsby website into multiple languages
MIT License
121 stars 72 forks source link

SSR and DSG pages include language twice inside matchPath #162

Open denisgoryaynov opened 1 year ago

denisgoryaynov commented 1 year ago

I have some SSR routes that use getServerData to fetch some data, for example src/pages/products/[slug].tsx

These pages work correctly for the default language but for other language they contain the language twice, for example the component mentioned above becomes: /fr/fr/products/:slug

The expected behaviour would be for the page to be reachable at /fr/products/:slug, but it is not happening because this line of code duplicates the language:

https://github.com/microapps/gatsby-plugin-react-i18next/blob/2b7b55bca752b7f6cbdcfe2b6714a9bf49f04eb7/src/plugin/onCreatePage.ts#L109

Removing the entire if condition fixes the issue.