Comments (20)
13.4.12 is the latest version where next-translate still works. 13.4.13 breaks it.
from next-translate.
@rlvk94 Let's do this. We supported it because many people asked to be able to migrate from pages to app router and have both living together, but doing this feature was a bad idea because Next.js doesn't support it and so it breaks a lot of things to try to maintain this. Either you use pages folder, or you use app router... I have asked Next.js to support both, but they don't even respond.
from next-translate.
Ok thanks for the example, I'm going to take a look
from next-translate.
Thanks for bumping the issue, I have been scratching my head with this error for like almost a week.
The only thing I have found out is that the plugin breaks it. I tested without the plugin, and of course, the library will not translate anything... but at least it does not show a 404.
from next-translate.
I hate to say it, but I think the solution will be to remove the support for mixing pages and app router, because everything breaks adding the i18n in the Next.js configuration. I don't understand how Next.js doesn't support partial migration from pages to app router with i18n.
from next-translate.
@aralroca Still not working, here is the example
from next-translate.
@abriginets @aralroca I don't have i18n in my config and I am using the middleware. But I am still getting 404.
I know this might be a lot to ask but can you write a small note on step by step instructions to set up next-translate in Next 14. Would help newbies like me to quickly set up for my project.
from next-translate.
I had the same problem, so I checked with the version down and 13.4.9 works fine with this version.
Is there any way to make it work without problems in version 14?
from next-translate.
Up for this issue.. @aralroca, any schedule to fix this?
Thanks!
from next-translate.
I'm having pretty similar issue. I moved my homepage from /app/page.tsx
to /app/[lang]/page.tsx
and now none of the translations work. My i18n.js
is
module.exports = {
pages: [...],
locales: ['en', 'ru', 'uk'],
defaultLocale: 'en',
localeDetection: false,
};
So I tried accessing /uk
, /ru
and /en
and I got 404. Now here's the interesting thing I accidentally found out is that if I try to navigate to locales I don't support then NextJS would actually try to render something but throws an error (obviously).
from next-translate.
I hate to say it, but I think the solution will be to remove the support for mixing pages and app router, because everything breaks adding the i18n in the Next.js configuration. I don't understand how Next.js doesn't support partial migration from pages to app router with i18n.
Yeah it's quite strange that the localization config is even used when strictly using the app router, as they do not mention those configuration options in the documentation, but solely recommend the dynamic route setup with a [lang]
folder.
But it would be nice with the option to use next-translate strictly with app router 🙏
from next-translate.
Please try Next-translate & Next-translate-plugin at the same version 3.0.0-canary.1
and confirm if now is working in your projects. Thanks!
from next-translate.
@dracon-china Yeah the same, tested with the updated with-app-dir example in this repo and I'm seeing the same 404 error.
from next-translate.
Version 3.0.0-canary.1 had a problem generating the npm tarball, fixed in 3.0.0-canary.2.
from next-translate.
Version 3.0.0-canary.1 had a problem generating the npm tarball, fixed in 3.0.0-canary.2.
Tried 3.0.0-canary.2 version, but still doesn't work.
from next-translate.
It seems if dashes are added to the i18n config, then the pages work. I tried with a fresh new app dir based project without any other deps than the normal create-next app needs and even if you manually add the i18n config which this lib is injecting, the pages fail with normal values like: "en", but if you replace them with "en-US" then they work.
I've opened a PR to test this out with the app example in this repo, and I can make the pages work with the new locale naming, seems like a super hacky workaround, but hey atleast they work.
PR: #1189 (Don't forget to access url directly with locale like localhost:3000/en)
from next-translate.
@aralroca Hey! So I love and have used next-translate for all my previous projects. I am building the latest one on next 14. I am somehow not able to resolve 404 error. As you asked, installed 3.0.0-canary.2 but still not able to resolve the issue.
Any ideas what I can do to make it work?
I would want to stick with next-translate. If it doesn't work, which other library do you recommend?
from next-translate.
Please take a look at this issue vercel/next.js#57704 (comment)
It appears that for making it work we need to remove i18n
from config and switch to middleware for pages dir. I myself haven't tried that just yet, but one can consider this answer official and proceed with the suggested changes.
from next-translate.
A lot of love for the library author for maintaining such an amazing library, but given how fast next has been moving, the state of this library with next 14 is really bad. Even if 404 pages are fixed, I found not-found pages and no SSG support a big deal breaker for me (and I'm aware most of them are due to next itself). Wish you good luck for this library but I have migrated my projects to another library next-intl
which works well.
I'm closing this issue and related PR as there are already other similar issues opened in the repo. Again very thanks for creating the library that worked this well with the pages directory.
from next-translate.
@jaisharx Move to the library that best suits your project. I'm aware that since November we haven't made a release yet, I will dedicate time to fix this when I can, however all PR is always welcome.
from next-translate.
Related Issues (20)
- Buildng project using only app router HOT 9
- Translation not working on client component inside layout HOT 10
- Warning: Detected multiple renderers concurrently rendering the same context provider.
- 404 when accssing homepage HOT 7
- 404 on root when using baseURL in vercel HOT 1
- Can't resolve 'next-translate/appWithI18n' on 2.7.0-canary.1 HOT 6
- Cold Start on dynamic routes HOT 5
- Type safety for getT function
- Regular locale naming like "en" breaks the i18n config HOT 1
- Cannot read properties of undefined (reading 'localesToIgnore')
- Docs reference incorrect format/formatter options HOT 1
- App router for domain based local issue HOT 1
- lang useTranslation hook not refreshing in sitemap page HOT 3
- Big loading times and scroll to top once loaded HOT 2
- t is unstable in appDir HOT 1
- Issue & Update on how to use the library with app router HOT 1
- Translations not being loaded when running development build (NextJS 14.1.4) HOT 2
- Change language - compatibility with Next 13
- the demo example is not working
- Add support to ICU format
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.