0

I'm using Next.js and with the following config.

module.exports = {
  debug: true,
  backend: {
    backends: [HttpBackend],
    backendOptions: [
      // { expirationTime: 60 * 60 * 1000 },
      {
        loadPath: `${url}/locales/{{lng}}/{{ns}}.json`,
        crossDomain: true,
        requestOptions: {
          mode: 'no-cors',
          cache: 'no-store',
        },
        expirationTime: 60 * 1000,
      },
    ],
  },

  serializeConfig: false,
  use: [ChainedBackend],
  i18n: {
    defaultNS: 'common',
    defaultLocale: 'en',
    locales: ['en'],
    ns: ['common'],
  },
};

Whenever I push update to the api. It should reflect those changes in Nextjs. Right now I need to restart server everytime I update the namespace config

0

2 Answers 2

4

Try to set reloadOnPrerender to true: https://github.com/i18next/next-i18next/blob/a2308cf194218f572745322186ddfd6eb541f5ec/examples/simple/next-i18next.config.js#L7

You can also try to set the revalidate option in getStaticProps https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration

Sign up to request clarification or add additional context in comments.

3 Comments

this causing deadly memory issues :(
will setting this false work on production after api is updated? like api has returned some new data. How will it get that new data?
you can also try to set the revalidate option in getStaticProps nextjs.org/docs/basic-features/data-fetching/…
0

You could use i18next.init() and pass in the config inside your app.jsx or _app.jsx it should work as you expect it to.

1 Comment

The question is which param we should to add ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.