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

Codesplitting not working without NextJS routing #145

Open
alexpuertasr opened this issue Aug 26, 2022 · 1 comment
Open

Codesplitting not working without NextJS routing #145

alexpuertasr opened this issue Aug 26, 2022 · 1 comment

Comments

@alexpuertasr
Copy link

I'm having some issues making the namespaces codesplitting for pages. I'm not using the NextJS internationalized routing.

I tried first to use the clientNamespaces like this:

export const getStaticProps = async (props) => {
  return {
    props: {
      ...clientNamespaces(ni18nConfig, ['common', 'first-page']),
    },
  }
}

However it just load correctly the namespaces on the first load, when I change to another page is not loading the new namespaces correctly

After I tried the loadTranslations like this:

export async function getStaticProps(props) {
  return {
    props: {
      ...(await loadTranslations(ni18nConfig, props.locale, [
        "common",
        "first-page",
      ])),
    },
  };
}

In this scenario the namespaces are loaded correctly without problem but then the changeLanguage stop working correctly (I guess because of the props.locale) whenever I change to another page with a different language than the default one, the language change to the default one

@woodjs
Copy link

woodjs commented Dec 2, 2022

I also faced this problem.
I tried intentionally using getServerSideProps to change the value of props.locale, but this does not give any result :(

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

2 participants