formatjs / dust-intl

Dust helpers for internationalization.
http://formatjs.io/dust/
Other
48 stars 11 forks source link

IntlMessage fails if _key contains variable #34

Closed taomin closed 10 years ago

taomin commented 10 years ago

I have below usage in my dust template:

{@intlMessage _key="LABEL:{magazine}" /}

And when I render it on client side, even if magazine is present, the dust helper still throws error saying _key is undefined. I found it could be an error coming from https://github.com/yahoo/dust-helper-intl/blob/master/lib/helpers.js#L226 . The result returned is undefined.

taomin commented 10 years ago

In my case, the error comes from

https://github.com/yahoo/dust-helper-intl/blob/master/lib/helpers.js#L109

the keys it loops through is ['intl', 'messages', 'LABEL:beauty'], and the last key is the real key for i18n strings. However it never reaches the last key, because intl is undefined in the data, then the loop aborted.

drewfish commented 10 years ago

I think this got fixed. @taomin could you retry with the latest code?

drewfish commented 10 years ago

It looks like this got fixed in a5e6ef0a0.

ericf commented 10 years ago

Closing this. If there's still an issue, feel free to re-open.