i18next / i18next-gitbook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nesting example suggests JSON, but doesn't use JSON

lynn opened this issue · comments

commented

The example for nesting has a hint reading:

Make sure the options string is valid JSON and can be parsed using JSON.parse

'sampleKey': 'test $t(nest2, { "changedVarName": "{{var}}" })'

However, the example right above it does not follow this advice.

{
      "girlsAndBoys": "$t(girls, {'count': {{girls}} }) and {{count}} boy",
      "girlsAndBoys_plural": "$t(girls, {'count': {{girls}} }) and {{count}} boys",
      "girls": "{{count}} girl",
      "girls_plural": "{{count}} girls"
}

{'count': {{girls}} } is not valid JSON.

"fixed" was done this way because of the syntax highlighting -> changes it to use \" which might confuse some peoples even more - but anyway at least that is correct

Same issue, But unable to solve

please provide a reproducible example