i18next / i18next-gitbook

165 stars 172 forks source link

Nesting example suggests JSON, but doesn't use JSON #130

Closed lynn closed 4 years ago

lynn commented 4 years ago

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.

jamuhl commented 4 years ago

"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

souvik2805 commented 3 years ago

Same issue, But unable to solve

adrai commented 3 years ago

please provide a reproducible example