Closed
Description
Describe the bug
I'm using the built-in feature of internationalization of Nextjs. I don't want to use other third-party modules for translations of my app.
So I decided to put my translations in /public/locales
and access them using getServerSideProps
for dynamic pages and getStaticProps
for static pages.
Static pages work fine. But dynamic pages not working and they are not able to access the file using getServerSideProps
.
This is the error I have on netlify:
Also, I'm trying to get my translations simply by this lines of codes in both pages:
const dir = path.resolve('./public/locales')
const filePath = `${dir}/${locale}.json`;
const buffer = fs.readFileSync(filePath);
const translations = JSON.parse(buffer.toString());
Expected behavior
Have my translations in both Static and Dynamic pages.
Versions
- Next.js: 10.2.0
- @netlify/plugin-nextjs: 3.3.0