In NextJS's routing system, if I navigate to //mysite.com/about/
it serves my project file pages/about.js
But when using i18n to add mysite.com/fr/
, it still serves pages/about.js
, not pages/fr/about.js
. This is fine in most cases because you want to serve the same file and just change the text by detecting the locale /fr/ with useRouter.
But in my case I want to serve a completely different file based on the sub-path /fr/ in the pathname.
In _app.js
I have props of Component
, pageProps
and router
, but it's too late to conditionally serve a different file at this point because Component has already been determined by NextJS. Even though the prop router.inFlightMode
has detected the language change.
I'm hoping there is simply a routing config to change somewhere that will include the sub-path in the pathname used to point to a file.