Tiqa / redux-polyglot

Polyglot.js bindings for Redux
MIT License
58 stars 13 forks source link

Documentation request: createGetP example using translate HOC? #103

Open rbarkhouse opened 6 years ago

rbarkhouse commented 6 years ago

Hello,

I would like to use createGetP to tweak polyglot options, but it's unclear to me from the documentation how I should use createGetP... would each component have to use this selector instead of using the translate HOC? Is there a way to specify my own 'p' to be used in all components that use translate?

Rick

guillaumearm commented 6 years ago

Hi Rick,

You right, the documentation is not clear about this point. I think you should use the same getP (custom or not) in your whole app.

In your case, you cannot use translate enhancer. You should use your custom getP directly inside a redux mapStateToProps.

Is it interesting for you to have a kind of createTranslate function, or something similar ?

rbarkhouse commented 6 years ago

Specifically, all I want to do is provide an "onMissingKey" function so that I control the error case of when a key is not found... I'd want to just do this once, globally. I'm happy to not use translate as long as I can see how I'm supposed to do it otherwise :)