martinandert / react-translate-component

A component for React that utilizes the Counterpart module to provide multi-lingual/localized text content.
MIT License
322 stars 31 forks source link

Check for updated translate key on every render call #3

Closed tobitos closed 9 years ago

tobitos commented 9 years ago

Currently, if the key of an already mounted translate-component gets changed in-between render calls, the translate component sticks to the old translation key, because "this.key" has already been set. This change allows for updating translation keys of already mounted translate components.

(This change is passing all the tests. Please tell me if you want me to write a new test for this.)

martinandert commented 9 years ago

I cannot remember why I cached the translation key in the first place. So I am going to merge your PR. Thanks.

tobitos commented 9 years ago

Cool, thanks a lot. Would be great, if you could also update the version on npm. :)

martinandert commented 9 years ago

I will release a new version as soon as I get home from work today.

martinandert commented 9 years ago

I have released a new patch version just now. Sorry for the delay.

tobitos commented 9 years ago

no worries, thank you for your work. :)