hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 30 forks source link

Error when following the doc: No withTranslateRoutes high order component found in _app #18

Closed c7nj7n closed 2 years ago

c7nj7n commented 2 years ago

Hello, your component is exactly what I was looking for. I really hope I can make it work, from what I've read you exactly addressed my need (which is interestingly not a out-of-the-box thing from Next).

What happened?

  1. I successfully installed the package with yarn add next-translate-routes
  2. I imported withTranslateRoutes on line 1 of next.config.js as follows: const withTranslateRoutes = require('next-translate-routes/plugin');
  3. I wrapped, as indicated, the config in next.config.js with withTranslateRoutes instead of nextTranslate
  4. I obtain the following error:

error - ./pages/_app.js Error: [next-translate-routes] - No withTranslateRoutes high order component found in _app.

What am I missing, what am I doing wrong? Looking forward to hearing from you :)

P.S. I created one _routes.json at my pages root level, and added one single page to test.

c7nj7n commented 2 years ago

My bad, I skipped a step: Wrap your _app component with the withTranslateRoutes hoc

Sorry for the noise and keep it up!