Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Replace i18n-webpack-plugin with react-i18next #77

Closed
1 of 2 tasks
ghost opened this issue Aug 20, 2017 · 8 comments
Closed
1 of 2 tasks

Replace i18n-webpack-plugin with react-i18next #77

ghost opened this issue Aug 20, 2017 · 8 comments

Comments

@ghost
Copy link

ghost commented Aug 20, 2017

I'm submitting a ...

  • bug report
  • feature request

Feature Request:

  • Is feature important in common use cases?

Yes as i18n is already implemented in a fashion.

  • Describe requested feature:

The current i18n library is webpack based and can only display the language it was built with. The react-i18next library is one of the most robust i18n libraries for react. The benefit is that this allows the language to be detected from the browser and also changed on the fly.

https://github.com/i18next/react-i18next

@ghost ghost changed the title Add react-i18next Move from i18n-webpack-plugin to react-i18next Aug 20, 2017
@Metnew
Copy link
Owner

Metnew commented Aug 20, 2017

Hi @Nate0001 , I agree with you probably it'd be better move to a library like i18next. But there is the next issue: How is it good for performance?

If I understand correctly this lib replace text in runtime. So it requires additional time to render the page.

Anyway react-i18next probably will be used in next release, because current dist folder structure might be too complicated for users.

@ghost
Copy link
Author

ghost commented Aug 21, 2017

If you follow the best practices, performance hits are very minor.

With the current library, you can only select the language during webpack build. This makes having translations pretty useless as they can't be changed on the fly.

@Metnew
Copy link
Owner

Metnew commented Aug 22, 2017

I use similar i18n technique in the side-project and it works well, but I agree with you because it requires some additional code.

I reviewed react-i18next, probably it'd be added, but I still search for alternatives.

@Metnew
Copy link
Owner

Metnew commented Aug 22, 2017

What do you think about react-intl? @Nate0001

@ghost
Copy link
Author

ghost commented Aug 22, 2017

react-intl looks like something to be used alongside an i18n library, right? So you can get plurals, numbers, dates, etc formatted correctly. I've used the FormatJS library that react-intl uses. It's a nice library.

Looks like i18next make it easy to plugin for number formating, interpolation, passing in objects, etc.

I think the biggest benefit is there's a caching plugin.

@Metnew
Copy link
Owner

Metnew commented Aug 22, 2017

React-intl is a complex i18n library, but react-i18next seems easier to integrate and has a simple API. So I'm going to integrate react-i18next.

@Metnew Metnew changed the title Move from i18n-webpack-plugin to react-i18next Replace i18n-webpack-plugin with react-i18next Aug 22, 2017
@malixsys
Copy link

malixsys commented Sep 3, 2017

There is also https://github.com/oklas/intl-webpack-plugin

@Metnew
Copy link
Owner

Metnew commented Nov 4, 2017

i18n-webpack-plugin was replaced by react-intl. It's more advanced than react-i18next, check src/server/i18n for more info

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants