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
What version of this package are you using?
tried canary and last official What operating system, Node.js, and npm version?
20 and 10 What happened?
I am writing this issue after desperately trying to make the library work with the app router since 2 week already. I somehow managed to make everything work locally with the dynamic rendering (static ssr would only build the default locale).
I tried a consequent amount of different configurations, but not a single one worked so far. All example that i could find didn't worked either. Canary version of the library (that need to be implemented with npm i --force) doesn't seems to help either. So i though that i would put here all the configurations that have here and let's see if someone would have an idea to how debug it.
If i fix my issue i offer myself to build an advanced usage example for this library including multi vendor and dynamic page routing.
1. The configuration that almost worked
1.1 package.json
here i used "next-translate": "2.6.2" and "next-translate-plugin": "2.6.2"
This is the one i used that was suggested by @aralroca in some of the examples i could find.
1.5 folder architecture
My folder architecture would look that this:
where the layout would make usage of the const { lang } = useTranslation() to get the lang for metadata and html lang.
As you can see there is no [lang] folder in this solution as all my attempts to make this work with a [lang] folder resulted in a fail.
1.6 The issue
this configuration worked perfectly in development but unfortunately in production it only worked partially. If the defaultLocale match the defaultLocale from a specific domain then it work but if it doesn't most of the pages at the root level would not work correctly. The only way to make then work is to add the /br/us that correspond to the /domainDefaultLocal/defaultLocal in the path and it somehow mysteriously work.
i tried to custom the middleware to redirect the pathname to that specific case on some url:
I really tried all examples, with different type of structure with the [lang] wrapper. Different middlewares. The new canary versions. removing manually some config from the next.config.js such as the i18n = 'undefined' and non of all trial could even work a single time in production.
Most of the time i had a 404 in the home page but i couldn't make the translation work in the other pages anyways.
So here i am, a bit lost, asking for a good soul to try to indicate me the path to follow :)
The text was updated successfully, but these errors were encountered:
What i am doing here is to get the host from the header to manage to know what language attribute and from there setup the language with the searchParams.set("lang", locale)
What version of this package are you using?
tried canary and last official
What operating system, Node.js, and npm version?
20 and 10
What happened?
I am writing this issue after desperately trying to make the library work with the
app router
since 2 week already. I somehow managed to make everything work locally with the dynamic rendering (static ssr would only build the default locale).I tried a consequent amount of different configurations, but not a single one worked so far. All example that i could find didn't worked either. Canary version of the library (that need to be implemented with
npm i --force
) doesn't seems to help either. So i though that i would put here all the configurations that have here and let's see if someone would have an idea to how debug it.If i fix my issue i offer myself to build an
advanced usage example
for this library including multi vendor and dynamic page routing.1. The configuration that almost worked
1.1 package.json
here i used
"next-translate": "2.6.2"
and"next-translate-plugin": "2.6.2"
1.2 next.config.js
In this case i used the
i18n
routing with:i made sure to have all the
domains
etc coming from thei18n
file as it is a nice place to centralize all this information.1.3 i18n.js
here also i tried with the
[lang]
parameter and it didn't helped so i ended removing it1.4 middleware
Make sure to have the middleware inside the src
This is the one i used that was suggested by @aralroca in some of the examples i could find.
1.5 folder architecture
My folder architecture would look that this:
where the layout would make usage of the
const { lang } = useTranslation()
to get the lang for metadata and html lang.As you can see there is no [lang] folder in this solution as all my attempts to make this work with a [lang] folder resulted in a fail.
1.6 The issue
this configuration worked perfectly in development but unfortunately in production it only worked partially. If the
defaultLocale
match thedefaultLocale
from a specific domain then it work but if it doesn't most of the pages at the root level would not work correctly. The only way to make then work is to add the/br/us
that correspond to the/domainDefaultLocal/defaultLocal
in the path and it somehow mysteriously work.i tried to custom the
middleware
to redirect the pathname to that specific case on some url:but then i get an error of
2. Asking for help
I really tried all examples, with different type of structure with the
[lang]
wrapper. Different middlewares. The new canary versions. removing manually some config from thenext.config.js
such as thei18n = 'undefined'
and non of all trial could even work a single time in production.Most of the time i had a 404 in the home page but i couldn't make the translation work in the other pages anyways.
So here i am, a bit lost, asking for a good soul to try to indicate me the path to follow :)
The text was updated successfully, but these errors were encountered: