i18n-node-2
i18n-node-2 copied to clipboard
Error Condition: Detecting when the ID is blank/undefined
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.
I don't really get the problem. Could you post a subset of your localization file and also explain a bit more?