Setting options on individual translations override, rather than merge global configs #832

Closed
stiliyan opened this Issue Oct 31, 2016 · 3 comments

Projects

None yet

2 participants

@stiliyan

Passing configurations to individual translations override their global counterparts, when they should be merged instead.

In the following example the desired output is some <span>foo</span>, so we set the interpolation: { escapeValue: false } option on the translation. Instead i18next outputs some __foo__, because the global interpolation.prefix and interpolation.suffix configs are overridden, rather than merged with the custom interpolation config.

global config:

{
  interpolation: {
    prefix: '__',
    suffix: '__'
  }
}

translations:

{ 
  "en": {
    "translation": {
      "tag": "some __foo__"
    }
}

call with custom options, expecting some <span>foo</span> to be output:

i18next.t('tag', { interpolation: { escapeValue: false }, foo: '<span>foo</span>' })

output:

some __foo__
@jamuhl
Member
jamuhl commented Nov 1, 2016

agree....will fix this for next version.

@jamuhl jamuhl added the issue label Nov 1, 2016
@jamuhl
Member
jamuhl commented Nov 7, 2016

should be fixed in upcoming 3.5.0

@jamuhl
Member
jamuhl commented Nov 7, 2016

feel free to reopen if still an issue.

@jamuhl jamuhl closed this Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment