-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fallback / substituable language (nonExplicitSupportedLngs) #58
Comments
I understand you need... but there is a lot of work to support next@13, and a new born baby plus a lot of work make it hard to find some time to work on it these days. |
Hello, I'm really sorry for being this late with my response, but I missed your reply.
So it should only generate Thank you for your response! |
I gave a quick look at it to estimate the work to be done. Let's say half a day of work if everything goes smoothly (it may double otherwise), including solving bugs, checking that everything works good, and writing tests. There is at least 10 places in 5 files to update. If you want to see them, you can perform a search of "path.default" in next-translate-routes code... Each time, it is something like const getPath = <L extends string>({ paths, locale }: { paths: TRouteSegmentPaths<L>, locale: L }) => {
if (paths[locale]) {
return paths[locale]
}
const { fallbackLng } = getNtrData()
if (fallbackLng?.[locale]) {
for (const l of fallbackLng[locale]) {
if (paths[l]) {
return paths[l]
}
}
}
return paths.default
} It might be enough... It may not. 🤞 |
Note: the above don't includes |
Thank you very much for your valuable input and time. I'm currently a bit out of time so hopefully I'll get to this as soon as possible. This project is coming together very well! |
Hello, @cvolant ,
Where my origin is:
Am I doing something totally wrong or do I need permissions? 😊 Thanks! |
Hi @michalpulpan , |
Hi, Thank you very much! It's now absolutely clear 🤦. First time properly contributing to open-source 😄. I made draft of the PR #66. Looking forward to your feedback! |
Available in v1.10.0. Thank you @michalpulpan ! |
Hello!
First of all, thank you very much for maintaining this project.
I wanted to ask whether there's (or is planned) support for a feature
nonExplicitSupportedLngs
/fallbackLng
ofnext-i18next
that is quite common in NextJS world.See: i18next/next-i18next#1930
I'm running e-commerce site on NextJS and it's necessary for me to store both
locale
andcountry
in the URL (as, for example,de-AT
orde-CH
). So I might have two urlsexample.org/de-DE/produkt/1
andexample.org/de-CH/produkt/1
. Both routes share the same locale but they might present different prices (€
vs.CHF
).The rewrite itself can be handled by
middleware
(I can share code later if anyone is interested, but it's fairly simple).With this feature,
next-i18next
allows to define "substituable" localede-CH --> de
andde-AT --> de
so folderpublic/locales
doesn't have to look like:but
is sufficient.
It would be nice if this feature is also supported by
next-translate-routes
so thatroutes.json
doesn't have to look like 😊 :but only
and generate page only once (for
de
).If it would not be possible to implement, is there a chance to at least to introduce substitutable pages into build process?
NextJS will now generate the same page 3x (
de
,de-CH
,de-AT
) and it heavily slows down build time (due to large amount of pages).Thank you in advance☺️ .
The text was updated successfully, but these errors were encountered: