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

Different namespace for each page #1329

Closed
jashwant opened this issue Jul 22, 2021 · 1 comment
Closed

Different namespace for each page #1329

jashwant opened this issue Jul 22, 2021 · 1 comment

Comments

@jashwant
Copy link

I have a page my-page/sub-page/example.

I want to load a common.json file + another file which has translations of this page only.

My getStaticProps looks like this,

export const getStaticProps: GetStaticProps = async ({ locale }) => {
  return {
    props: {
      ...(await serverSideTranslations(locale, ['common', 'my-page/sub-page/example'])),
    },
  };
};

And I am using it like this.

const { t } = useTranslation('my-page/sub-page/example');

This throws error
Error: ReactDOMServer does not yet support Suspense

If I remove useSuspense,

const { t } = useTranslation('page/sub-page/sub-page-2/example', { useSuspense: false });

Error is fixed, but it does not translate and shows translate key as fallback.

How do I keep a different translation file for each page ?

@isaachinman
Copy link
Contributor

Please post on StackOverflow for help. Good luck!

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