lvarayut / relay-fullstack

:point_up::running: Modern Relay Starter Kit - Integrated with Relay, GraphQL, Express, ES6/ES7, JSX, Webpack, Babel, Material Design Lite, and PostCSS
https://lvarayut.github.io/relay-fullstack/
MIT License
986 stars 126 forks source link

Added i18n #105

Open caioflores opened 6 years ago

caioflores commented 6 years ago

I added a i18n library (react-i18next) and created the base structure to make the internationalization. I also updated almost all the texts to the new i18n pattern and translated the file to Brazilian Portuguese. I also added i18n as a feature of the boilerplate.

caioflores commented 6 years ago

@Neitsch the PR that you asked for! Tell me what you think. There are some constants that were not translated, and I didn't created a option to change the language (we can use the browser's language). I set up the translation options in the index.js file, I don't know if it's the best option. All the components that needs translations will need to be exported using translate method (Ex: export default translate()(Feature);), I don't know any way that we can improve this.

Neitsch commented 6 years ago

Hi Caio, thank you so much for the PR! I think instead of using translate()(...) we can wrap the top level component in a i18nProvider (https://react.i18next.com/components/i18nextprovider.html) and then get { t } from this.context. I'll give that a shot tomorrow. Other than that looks really good. Thank you!