problem in name variable in nextJs multi language

Viewed 27

i want to access variable blow

{`${t('serviceCart:serviceCart[0].title')}`}

the result is serviceCart[0].title and it shows it as string.

this is serviceCard.json

{
    "serviceCart": [
      {
        "id": "1",
        "title": "Support e-commerce",
        "description": "Vehicula malesuada"
      },
      {
        "id": "2",
        "title": "Google AD's campaigns",
        "description": "Dictum ligula scelerisque"
      },
      {
        "id": "3",
        "title": "Product landing pages",
        "description": "Augue himenaeos fusce placerat"
      }
    ]
}

in multi language page you should access variable like this.

{t('JSONFlieName:varibleKey')} like {t('header:title')}

but i put it in a group of json, named serviceCart. now i can't access that

this is i18next.js

module.exports = {
    i18n:{
        defaultLocale: 'fa',
      locales: ['fa','en','ar'],
    }
  }
0 Answers
Related