Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n flattens passed in objects where i18next expects full objects #28

Closed
salminio opened this issue Nov 4, 2015 · 1 comment
Closed

Comments

@salminio
Copy link

salminio commented Nov 4, 2015

translation.json
{myKey: "alert for __property.name__"}

my code looks something like this:
this.alertHeader = this.i18n.tr('myKey', {property: this.property});

i18n.tr makes this call
this.i18next.t(key, (0, _utils.assignObjectToKeys)('', fullOptions))

which flattens out a hierarchy {property: {name:'prop1", type:'string', foo:{bar:1}}} so that would end up being:

{
  property.name: 'prop1',
  property.type: 'string',
  property.foo.bar: 1
}

which looks like what you would want but the i18next expects the object and not a flattened list.

checkout i18next.js

function applyReplacement(str, replacementHash, nestedKey, options) {
     ....
     // Check for recursive matches of object
     <code here>
     ...
}

zewa666 added a commit that referenced this issue Dec 9, 2015
removes unnecessary object flattening for i18next translation call

fixes issues #43 and #28
@zewa666
Copy link
Member

zewa666 commented Dec 17, 2015

this should be fixed with the latest release. Please reopen if you still experience issues

@zewa666 zewa666 closed this as completed Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants