-
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
Route using translated locale/.json file #49
Comments
|
I have a similar issue (using 1.9.1), where static props files seem to be translated although they shouldn't: This HEAD-request is always sent after clicking a link. Mabye these issues are also related to #54 |
Hello, I have the same issue, although from some reason it's only happening in production (Vercel) if I run it localy with next dev it works fine |
@starkys-brzezina Same here, I think that is expected. If I understand it correctly, next tries to access the cached files for the static props under |
@cvolant would you be able to help or point me closer where to look for the issue? 🙏 |
I will try to have a look at it but I am not sure when I will be able to (new born baby + lot of work...). |
I understand, it's not a blocker, just a little inconvinience... And congratulations by the way 🙂
when I'm in cs locale (the customized one or the one that differs from file name) and go from index page to for example /podminky-pouziti by clicking a link the resources should still be loaded as an original filename.json but it tries to load it with the translated name also resulting in one extra. 404 request.. It's only happening in production build, works fine in development it goes like |
I tried to give a look at it but I don't reproduce this issue. Can provide a minimal reproduction or a reproduction using next-translate-routes |
@cvolant I spent half the day trying to create a reproduction repo, unfortunately without success 🫤 I incrementally took piece by piece from the original project (custom link component, preact, i18 libraries, several configs, next auth, ...), but nothing brought back the HEAD 404 behavior. Quite a riddle 🤔 @vbrzezina @StephaneBischoff Could you maybe try to get a reproduction of this issue? Or maybe you spot any overlaps in our dependencies that might be causing the issue?:
|
Thank you for the attempt. Maybe the other way around? Starting from the code that has the bug, then removing some pieces? |
I have the same problem. I am using a custom created mapping like this. This means anything that starts with a matching url is redirected. For example, /en/about-us.json will work. But /en/hakkimizda.json will be redirected. If I disable this plugin /en/hakkimizda.json also returns the correct response. The default behaviour of nextjs is to request it as /en/hakkimizda.json in the background. I believe most of these problems can be fixed if there is a way to make the plugin ignore ".json" urls. If one of the main goal of this plugin is to improve SEO and user usability. .json files should be irrelevant. |
It is hard to debug as I don't reproduce the issue... Can at least someone post here, it the issue persists with the last version:
But again, the best would be a public Github repo with a (minimal if possible) reproduction. |
Hello, Yes the issue persists with the latest version. Here is an example of a direct. there is a redirect rule in NTRConfig such as:
so if a user wants to access next js sends some prefetch ajax as in the screenshot, the server redirects |
I think I reproduced this bug while trying to reproduce another one. Without using next-translate-routes. async redirects() {
return [
{
source: '/fr/about',
destination: '/fr/a-propos',
locale: false,
},
]
}, And my prefetch ( I seems to be a bug in Next.js. Or could it possibly be a desired behavior? Anyway, for now I think we can use @ahmettahasakar approach, but using 'x-nextjs-data' instead of 'purpose' because 'purpose' does not appear in dev. |
@cvolant I'm still getting the 404 HEAD request even after updating to the lastest version 🫤 Here are the response headers:
and the request headers:
|
Hi @simonhenke, could you try with |
@cvolant just tried the prerelease. Similar to #84 (comment) I get the following error (
On
|
Hi,
Looks like the
next-translate-routes
affects the next-i18n translation file logic.The 18n file (namespace) that is requested is translated.
Example folder structure:
For some reason, locally everything works fine for both language. The correct
about.json
file is fetched.But once deployed to Vercel, the
.json
file that is request is notabout.json
butnotre-histoire.json
?In the browser, I see the file being fetched as
https://..../_next/data/UhEhAsJqgcuNptbGTt7v2/fr/notre-histoire.json
When it should be
https://..../_next/data/UhEhAsJqgcuNptbGTt7v2/fr/about.json
Looks like a redirect made by
next-translate-route
?I would prefer not having to change the file names (i18n namespaces)
The text was updated successfully, but these errors were encountered: