Closed Rickk137 closed 3 years ago
Here is an example with getServerSide props: https://github.com/flayyer/next-rosetta#example-with-getserversideprops
getInitialProps is not recommended anymore but I think you can use it as:
// Untested
Page.getInitialProps = async (context) => {
const locale = context.locale || context.defaultLocale;
const { table = {} } = await import(`../i18n/${locale}`); // Import locale
return { props: { table } }; // Passed to `/pages/_app.tsx`
}
It's not possible to have getInitialProps and getServerSideProps in the same page. So how should we load the translation in such a page?