-
-
Notifications
You must be signed in to change notification settings - Fork 334
Description
Description
I just installed the package just 4 hours after updated deployment.
DISCLAIMER: My Next JS Folder Structure (App Router)
src
proxy.js // I tried to put this file on the root and inside folder src
/i18n
/messages
...the language.json
navigation.js
request.js
routing.js
Simply, I wanted to make my page accessible for both side /:page or /:locale/:page. When I read the documentation I found that I can make it by setting up the localePrefix inside /src/i18n/routing.js:
import {defineRouting} from 'next-intl/routing';
export const routing = defineRouting({
locales: ['en', 'zh'],
defaultLocale: 'en',
localeDetection: true,
localeCookie: {
name: 'NEXT_LOCALE',
maxAge: 60 * 60 * 24 * 365
},
localePrefix: 'as-needed' // the problem I found
});// next.config.mjs
...
const withNextIntl = createNextIntlPlugin();
export default withNextIntl(nextConfig);However, after checking the autocomplete it only receive always instead of others. At first, I thought it was just the autocomplete configuration. After completing all the setup, it turns error while accessing the page without :locale. Actually no returning any error or something alike, it just returns to not-found page.
Can anyone help to explain where did I miss? or is this the bug from the package?
Verifications
- I've verified that the problem I'm experiencing isn't covered in the docs.
- I've searched for similar, existing issues on GitHub and Stack Overflow.
- I've compared my app to a working example to look for differences.
Mandatory reproduction URL
App Router
Reproduction description
Steps to reproduce:
- Open the docs
- Read on https://next-intl.dev/docs/routing/configuration#localeprefix
- See error: no error but doesn't work at docs mentioned.
Expected behaviour
On page: https://next-intl.dev/docs/routing/configuration#localeprefix
Expected: make the page accessible with and without locale on the URL (OK: /:any-path-of-the-page and /:locale/:any-path-of-the-page)