i18next / next-app-dir-i18next-example-ts

Next.js 13/14 app directory feature in combination with i18next
https://locize.com/blog/next-app-dir-i18n/
117 stars 29 forks source link

If I move the app into the src directory, the homepage will display 404 #12

Closed aboutjquery closed 2 months ago

aboutjquery commented 2 months ago
import { fallbackLng, languages, cookieName } from './src/app/i18n/settings'

Expected behavior

If my app is moved into the src directory, 404 will be displayed on the homepage. I have changed the i18n setting path of middleware.ts, and 404 will appear on the homepage. If I add /en, it will display normally, but if I don’t add en, 404 will appear.

adrai commented 2 months ago

Is app in src supported by Next.js? https://nextjs.org/docs/app

aboutjquery commented 2 months ago

Is app in src supported by Next.js? https://nextjs.org/docs/app

I believe it is. In the latest nextjs 14.x, when creating a project, there is also a question whether to create a src directory, and my other functions are all normal in src/app.

https://nextjs.org/docs/app/building-your-application/configuring/src-directory

adrai commented 2 months ago

Are you sure you've also moved the middleware.ts file in to the src folder? I just tried to move the app folder into the src folder and also the middleware.ts into the src folder and it works...

https://nextjs.org/docs/app/building-your-application/configuring/src-directory

image
aboutjquery commented 2 months ago

Are you sure you've also moved the middleware.ts file in to the src folder? I just tried to move the app folder into the src folder and also the middleware.ts into the src folder and it works...

https://nextjs.org/docs/app/building-your-application/configuring/src-directory image

That's the problem, thank you.