You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It will now 404 as the app/page.tsx file is skipped over
Create app/[slug]/page.tsx
It will no longer 404 but the app/page.tsx file will still be skipped over
Disabling localeDetection
Run create-next-app@latest
Add localeDetection: false to next.config.js
Run dev server and see that it will not launch due to a console error (Error: Specified i18n.locales should be an Array received undefined)
Then try adding locales: ['default', 'en', 'de', 'fr'], defaultLocale: 'default' to the config
Run dev server
See that it is still being routed to a locale
Describe the Bug
The two issues are related to localePrefixing, but due to the difficulty of reproducing the yarn error, I will describe them separately. It is impossible to work around the Yarn issue without creating a [locale] slug since you cannot disable localeDetection.
Yarn Routing
This is difficult to reproduce consistently. The yarn example above (hopefully) should work if cloned.
If a project is scaffolded with Yarn (3.3.1) and the app directory is enabled, the locale prefix will be treated as a subroute. A [locale] slug in the app dir is required for routing.
This issue seems to only happen when Next 13 app projects are scaffolded with Yarn. I did not encounter these issues when copying over these files to the other error example template (that was created with npm), which is the other reason why I have separated the examples.
localeDetection
You cannot disable localeDetection without a console error (Error: Specified i18n.locales should be an Array received undefined) in Next 13.1.1 (and 13.1.1-canary.1). Adding locales to circumvent it will still lead to the page being routed to a locale.
The issue also occurs with both the app and pages directory.
Expected Behavior
Yarn Routing
For the app/page.tsx file to be the default page and for the locale prefix to not be treated as a slug route. It is also odd that it is being prefixed in Yarn scaffolds as previous versions of Next 13's app directory do not have the prefixing.
apriltaoyvr
changed the title
Cannot disable localeDetection on pages and app directory
Locale prefix treated as subroute + cannot disable localeDetection
Dec 26, 2022
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
Due to the difficulty of reproducing the yarn error, I am seperating the two issues.
https://github.com/apriltaoyvr/next13-yarn
https://github.com/apriltaoyvr/next-i18n-error
To Reproduce
Yarn Routing
app/page.tsx
file is skipped overapp/[slug]/page.tsx
app/page.tsx
file will still be skipped overDisabling localeDetection
create-next-app@latest
localeDetection: false
tonext.config.js
Error: Specified i18n.locales should be an Array received undefined
)locales: ['default', 'en', 'de', 'fr'], defaultLocale: 'default'
to the configDescribe the Bug
The two issues are related to localePrefixing, but due to the difficulty of reproducing the yarn error, I will describe them separately. It is impossible to work around the Yarn issue without creating a [locale] slug since you cannot disable localeDetection.
Yarn Routing
This is difficult to reproduce consistently. The yarn example above (hopefully) should work if cloned.
If a project is scaffolded with Yarn (3.3.1) and the app directory is enabled, the locale prefix will be treated as a subroute. A [locale] slug in the app dir is required for routing.
This issue seems to only happen when Next 13 app projects are scaffolded with Yarn. I did not encounter these issues when copying over these files to the other error example template (that was created with npm), which is the other reason why I have separated the examples.
localeDetection
You cannot disable
localeDetection
without a console error (Error: Specified i18n.locales should be an Array received undefined
) in Next 13.1.1 (and 13.1.1-canary.1). Adding locales to circumvent it will still lead to the page being routed to a locale.The issue also occurs with both the app and pages directory.
Expected Behavior
Yarn Routing
For the app/page.tsx file to be the default page and for the locale prefix to not be treated as a slug route. It is also odd that it is being prefixed in Yarn scaffolds as previous versions of Next 13's app directory do not have the prefixing.
localeDetection
To be able to disable internationalized routing as shown in the docs (https://nextjs.org/docs/advanced-features/i18n-routing#disabling-automatic-locale-detection).
Which browser are you using? (if relevant)
Version 109.0.5414.46 (Official Build) beta (64-bit)
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: