Comments (9)
Available in v1.10.0. Thank you @michalpulpan !
from next-translate-routes.
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.
So unfortunately it is unlikely that I can work on this soon. You can try to make a PR though: there are some complexities, but I tried to make the code as clear as possible and well documented.
from next-translate-routes.
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.
So unfortunately it is unlikely that I can work on this soon. You can try to make a PR though: there are some complexities, but I tried to make the code as clear as possible and well documented.
Hello, I'm really sorry for being this late with my response, but I missed your reply.
I'll be honest, I haven't digged much into the code of next-translate-routes
yet. But given your skill, you think it would be doable? Mainly as a solution for large amount of generated pages?
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).
So it should only generate de
version (for all these three variants) and solve possible issue with https://nextjs.org/docs/messages/max-custom-routes-reached? But, of course, maintain correct locale in the path, so for example:
example.com/de-CH/produkt/1
, example.com/de-AT/produkt/1
, etc.
Thank you for your response!
from next-translate-routes.
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 path = routeBranch.paths[locale] || routeBranch.paths.default
.
We would need to write a getPath
function as follow then use it in this 10 places:
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.
The longer part will probably be to write tests and make sure everything works.
You can give it a try I you want.
from next-translate-routes.
Note: the above don't includes nonExplicitSupportedLngs
option that would need some more work.
I don't know how next-i18next handles it but for next-translate-routes it should be quite simple: building fallbackLng
automatically on ntrData
initialization should be enough.
from next-translate-routes.
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!
from next-translate-routes.
Hello, @cvolant ,
I think I'm mostly done with the implementation of fallbackLng
(and tests, hopefully it's sufficient, haha). We can work out nonExplicitSupportedLngs
in separate PR.
I have branch feat/fallback-lng
locally and sadly cannot push into it.
➜ next-translate-routes git:(feat/fallback-lng) git push origin feat/fallback-lng
ERROR: Permission to hozana/next-translate-routes.git denied to michalpulpan.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Where my origin is:
➜ next-translate-routes git:(feat/fallback-lng) git remote -v
origin [email protected]:hozana/next-translate-routes.git (fetch)
origin [email protected]:hozana/next-translate-routes.git (push)
Am I doing something totally wrong or do I need permissions?
Thanks!
from next-translate-routes.
Hi @michalpulpan ,
Thank you for contributing!
Here is a short guide about how to submit a PR on an open-source project: https://opensource.com/article/19/7/create-pull-request-github
And here, a more in-depth, video guide, where the steps 7, 8, and 9 should help: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
from next-translate-routes.
Hi @michalpulpan ,
Thank you for contributing!
Here is a short guide about how to submit a PR on an open-source project: https://opensource.com/article/19/7/create-pull-request-github
And here, a more in-depth, video guide, where the steps 7, 8, and 9 should help: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
Hi,
Thank you very much! It's now absolutely clear
from next-translate-routes.
Related Issues (20)
- Typescript support for Link properties HOT 1
- Link to dynamic route results in ERR_ABORTED 404 (Not Found), then redirects correctly HOT 2
- Incorrect translation of external links HOT 4
- How to use next-translate-routes with I18next and withPlugins? HOT 1
- [storybook] - No wrapped App component in withTranslateRoutes HOT 1
- We support Dynamic Routes and getStaticProps Pages from next.js? HOT 9
- fileUrlToUrl breaks on 404 HOT 2
- Add support for Next 13 `/app` directory HOT 4
- Update LinkProps to support Next.js 13 <Link> component HOT 2
- Update pagesDirs to support Next.js 11 pages path HOT 1
- Next Link supports ref, but next-translate-routes does not HOT 1
- Routing does not work any more after update to next 13.3.0 HOT 7
- Add the ability to export the translations directly from the pages HOT 1
- How can I use it in storybook? HOT 1
- Static segment after dynamic segment? HOT 2
- How to work with dynamic routes? HOT 1
- The page could not be found on refresh HOT 2
- Mailto links are broken since v.1.9.2 HOT 1
- The querystring API is considered Legacy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-translate-routes.