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

Error Condition: Detecting when the ID is blank/undefined #93

Open
dortamur opened this issue Apr 1, 2016 · 1 comment
Open

Error Condition: Detecting when the ID is blank/undefined #93

dortamur opened this issue Apr 1, 2016 · 1 comment

Comments

@dortamur
Copy link

dortamur commented Apr 1, 2016

I use Handlebars for templates, and in a few places, I use the syntax:
{{__ stateid}}

The idea being that, whatever the value of stateid is, it looks up the i18n string.
In some instances, stateid is undefined, and when encountered, it throws the error:

TypeError: /path/app/views/template.hbs: Cannot read property 'length' of undefined
at dotNotation (/path/app/node_modules/i18n-2/i18n.js:23:15)
at Object.i18n.translate (/path/app/node_modules/i18n-2/i18n.js:336:5)
.....

Could a check be added to dotNotation(), such that if "is" is undefined, it fails more gracefully?

Thanks.

@gjuchault
Copy link
Collaborator

I don't really get the problem. Could you post a subset of your localization file and also explain a bit more?

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