formatjs / handlebars-intl

Handlebars helpers for internationalization.
http://formatjs.io/handlebars/
Other
265 stars 28 forks source link

Adds in a few things just after drewfish's umd-plus #7

Closed apipkin closed 10 years ago

apipkin commented 10 years ago

Add _mix helper Throws proper errors Fix locale arguments for locale look up

ericf commented 10 years ago

Why are we throwing all these errors inside an HB helper like this? Won't the underlying built-in and polyfil APIs throw these errors?

apipkin commented 10 years ago

@ericf the errors thrown are for using the helpers incorrectly. By checking the last parameter's existence, you can infer the accurate number of parameters were not provided. Since handlebars adds the options to the end of the helpers call, it missing means the first option was not provided – thus using it incorrectly.

{{intlNumber format="dollahs"}} vs {{intNumber 3 format="dollahs"}}

If the helpers do not throw, they should at the very least fail silently. But I highly favor throwing.

drewfish commented 10 years ago

+1