I'm encountering challenges with integrating next-i18next into a Typescript NextJS project. There are very few recent examples available for reference. I have successfully set up internationalized routing, but I am facing difficulties in configuring i18next due to issues with the getServerSideProps syntax.
My knowledge of Typescript is limited, and I am not yet familiar with type declarations.
The code snippet provided below resembles the example from next-i18next documentation :
### index.tsx
// rest of index.tsx...
export const getServerSideProps: GetServerSideProps = async ({locale}) => ({
props: {
...await serverSideTranslations(locale, ['common', 'header']),
},
})
export default Home
An error regarding "locale" is being flagged in my IDE. Despite using getServerSideProps, I am uncertain if this is the most suitable solution for a predominantly static project. However, it appears unavoidable if I intend to implement SSR later on. An effective method for delivering accurately translated content while maintaining consistent URL locale would be greatly appreciated.