i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

Fix pluralization when using directive to bind as html #102

Closed putermancer closed 8 years ago

putermancer commented 8 years ago

Binding the directive to HTML currently does not work with pluralization, and has been broken since v0.4.2. The bug is because $sanitize turns numbers into strings—$sanitize(3) becomes the string "3". As a result, an object like {count: 3} becomes {count: "3"}, which i18next does not pluralize because the special "count" property is no longer a Number.

I added the ignore:line bit because a double-equal equality comparison is disallowed by the jshint rules but allows us to easily detect and fix this condition, whereas a triple-equal identity comparison does not.