i18n-node-2 icon indicating copy to clipboard operation
i18n-node-2 copied to clipboard

Error Condition: Detecting when the ID is blank/undefined

Open dortamur opened this issue 8 years ago • 1 comments

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.

dortamur avatar Apr 01 '16 08:04 dortamur

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

gjuchault avatar May 19 '16 21:05 gjuchault