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
I want to have pages called /en/ and /${locale}/ in general that implement custom functionality (such as language switching via cookies).
The problem is that Next.js treats these routes in a special manner and ignores pages with these names.
It turns out that happens because next-translate forwards its locale config to the Next config, specifically the locales array.
In fact, it seems that it is the only thing being done with locales and defaultLocale. I have a full production project with several locales, and removing these locales from the config changes nothing.
Unfortunately, it seems that next-translate has a default defaultLocale that is set to 'en'. For that reason, it is impossible to omit these properties, as the default locale is not found in locales and an error is thrown.
Right now I worked around this by filling these properties with the 'default' locale, basically a junk locale to satisfy the package.
What do you think is the correct solution to this problem?
defaultLocale should not have a default value.
The package should expect that these properties may be omitted, in case the project does not require Next's built-in locale routing.
Perhaps it should be made clear how exactly they are used and what relation they have to the same properties in next.config.js.
Are you willing to submit a pull request to implement this change?
No.
The text was updated successfully, but these errors were encountered:
What version of this package are you using?
2.5.3
What problem do you want to solve?
I want to have pages called
/en/
and/${locale}/
in general that implement custom functionality (such as language switching via cookies).The problem is that Next.js treats these routes in a special manner and ignores pages with these names.
It turns out that happens because
next-translate
forwards its locale config to the Next config, specifically thelocales
array.In fact, it seems that it is the only thing being done with
locales
anddefaultLocale
. I have a full production project with several locales, and removing these locales from the config changes nothing.Unfortunately, it seems that
next-translate
has a defaultdefaultLocale
that is set to'en'
. For that reason, it is impossible to omit these properties, as the default locale is not found inlocales
and an error is thrown.Right now I worked around this by filling these properties with the
'default'
locale, basically a junk locale to satisfy the package.What do you think is the correct solution to this problem?
defaultLocale
should not have a default value.next.config.js
.Are you willing to submit a pull request to implement this change?
No.
The text was updated successfully, but these errors were encountered: