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

Fail silently when trying to access a path with children #8

Closed
powmedia opened this issue Apr 23, 2012 · 2 comments
Closed

Fail silently when trying to access a path with children #8

powmedia opened this issue Apr 23, 2012 · 2 comments

Comments

@powmedia
Copy link

//translation.json
"parent": {
  "child1": "foo",
  "child2": "bar"
}

//app.js
i18next.t('parent'); //Produces: TypeError: Object #<Object> has no method 'indexOf'

It should fail silently, as it does if you access a full non-existant path, e.g. i18next.t('parent.foo')

@jamuhl
Copy link
Member

jamuhl commented Apr 23, 2012

Actually the full non-existent path will create the requested path if you set the addMissing option.

I didn't set this to fail silently as it's wrong to access a path that don't return a string (container object like parent in your sample).

I will change this to output an errormessage instead of a regular translation.

@jamuhl
Copy link
Member

jamuhl commented May 4, 2012

v1.3.0 will stop throwing this error and instead return an error message.

if you set option.debug to true you can see info and errors in console.log.

@jamuhl jamuhl closed this as completed May 4, 2012
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