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

Expose onLocaleChange from counterpart #23

Closed raoulus closed 7 years ago

raoulus commented 7 years ago

Hi,

in my app I need to have a listener when the locale changes (in order to switch custom monetary formats). Currently I have to do this directly with counterpart, but I think it would be useful to expose this functionality inside the react-translate-component as well.

module.exports.onLocaleChange = translator.onLocaleChange.bind(translator);

What do you think?

martinandert commented 7 years ago

Hi @raoulus, no objections from my side. Happy to accept a pull request which adds this functionality. Please also expose offLocaleChange as well.

raoulus commented 7 years ago

cool, going to prepare a PR.

thanks!

raoulus commented 7 years ago

Please check #24