next-translate icon indicating copy to clipboard operation
next-translate copied to clipboard

Exclude compiled page: /_error from next-translate

Open kouliavtsev opened this issue 1 year ago • 2 comments

What version of this package are you using?

"next-translate": "^2.0.6" and "next-translate-plugin": "^2.0.5"

What operating system, Node.js, and npm version?

18.15.0

What happened?

I have set up next-translate like this:

// next.config

import nextTranslate from "next-translate-plugin";

const config = {
  i18n: {
    locales: ["en", "nl"],
    default locale: "en",
  },
  // ... other config
} 

export default nextTranslate(config); 

Screenshot 2023-06-07 at 13 30 47

Note that I have not added import useTranslation from 'next-translate/useTranslation' to any of the pages. If I use the hook, then it works as it should.

At first I thought it was an error, yet later I learned that this is how next-translate should work.

Screenshot 2023-06-07 at 14 50 42

The next-translate seems to compile the pages/_error.tsx which you can overwrite.

What did you expect to happen?

These messages are flooding my terminal, which is super annoying.

Is there a way to exclude pages/_error.tsx fom being compiled by next-translate?

Are you willing to submit a pull request to fix this bug?

Sure, yet need some pointers on why I am gettings these errors and what is the best way to debug this.

kouliavtsev avatar Jun 07 '23 12:06 kouliavtsev

I have the same problem. Have you found a solution?

marc-on-github avatar Jul 31 '23 07:07 marc-on-github

On my side next-translate prevents my _error page to properly load and it never shows on 404s or 500s, I would like to exclude it from the plugin as well, or is there another solution ?

VinceBT-BG avatar Sep 29 '23 17:09 VinceBT-BG