Skip to content
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

Issue with i18n: 404 Error When Accessing English Version of Site #1140

Closed
EpsilonOrionis opened this issue Aug 29, 2023 · 7 comments
Closed

Comments

@EpsilonOrionis
Copy link

Description

I've been experiencing an issue with internationalization using Next.js 13 and the next-translate package. The issue is that when I try to access the English version of my website by appending /en to the URL, I get a 404 error.

Steps to Reproduce

  1. Navigate to the default Italian version of the site (e.g., http://<domain>).
  2. Try to switch to the English version by navigating to http://<domain>/en.

Expected Behavior

The English version of the site should be displayed.

Actual Behavior

I receive a 404 error.

Configurations

My next.config.js is configured as follows:

/** @type {import('next').NextConfig} */
const nextConfig = {
};

const nextTranslate = require('next-translate-plugin');

// Utilizza nextTranslate per estendere la configurazione
module.exports = nextTranslate(nextConfig);

And my i18n.json

{
  "locales": ["en", "it"],
  "defaultLocale": "en",
  "pages": {
    "*": ["common"],
    "/": ["home", "example"]
  }
}

I have tried various troubleshooting steps, including verifying the setup of i18n.json, restarting the development environment, and even using experimental configurations in next.config.js, but the issue persists.

@michalstrzelecki
Copy link

I have been experiencing the same problem, but with next-translate 1.6. Latest working nextjs version is 13.4.9.

@michalstrzelecki
Copy link

I think that my issue is related to #1131. When I delete middleware file everything works again.
nextjs version 13.4.19

@EpsilonOrionis
Copy link
Author

Thank you for your response. I don't have a middleware file as I am using the app directory.

@boredland
Copy link
Contributor

not having a middleware, removing i18n from the next.config helps for the development mode, but for me the production builds still lead to a 404.

@deifos
Copy link

deifos commented Oct 16, 2023

Did you figure this out?
I had the same issue and setting nextconfig like so.

`const nextConfig = {};
const nextTranslate = require("next-translate-plugin");
const config = nextTranslate(nextConfig)
config.i18n = undefined;

module.exports = config;`

fixed the problem but then I do not get the locale on the request.nextUrl.locale in the middleware.

@aralroca
Copy link
Owner

This is solved in 3.0.0-canary.1 version (both, next-translate & next-translate-plugin). Thanks

@iamvinny
Copy link

iamvinny commented Mar 23, 2024

This is solved in 3.0.0-canary.1 version (both, next-translate & next-translate-plugin). Thanks

Doesn't seem to work for me on the canary version, is there any workaround for the latest stable version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants