Conversation
|
|
||
| /** Wrap your components with `translate` to get a prop `t` passed in. */ | ||
| declare const translate = () => <T extends object>( | ||
| declare const translate = <T extends object>( |
src/translate.js
Outdated
| {t => <WrappedComponent {...props} t={t} />} | ||
| </I18nContext.Consumer> | ||
| ) | ||
| export default function translate()(WrappedComponent) { |
There was a problem hiding this comment.
This doesn't look like valid javascript… Mixed up with the other commit?!
|
@nayaabkhan can we get the I personally don't think there's a need to introduce a breaking API change (second commit) at this point, but it would be nice to get the modernizations in place. @publicJorn I believe the first commit contains a few changes related to your api change, see inline comments… Would you mind having a second look? Or maybe just open another pullrequest with just the code modernization without the breaking change to increase chances we get this merged quickly? Thanks for your work! |
8d0bd5f to
d2435d0
Compare
d2435d0 to
8a92584
Compare
|
Thanks @ctavan for the review. I fixed translate. Don't know how the tests passed, they didn't when I checked locally. But now they do. I discarded the api change. @nayaabkhan are you still managing this project? I see some other PRs have been open for some time now. Myself, I've moved to i18next, because I needed more features than polyglot could offer. But I'll leave this PR open. |
|
@publicJorn Thanks for your PR. Yes, I do maintain this project. Unfortunately, I cannot put myself dedicatedly on this project as I work full time elsewhere. But I make sure to keep maintaining this project during the weekends. |
|
The deprecation warning was also removed in 9210c44 and no longer appears in |
Hi @nayaabkhan,
Here's a PR that does the following:
this._polyglotcalls inside an if, assumingmessageswill only need to change whenlocalechanges. This is a bit more efficient.forceReInitthat negates above check (mimicks old default behaviour)The second commit is a personal thing, but I think it's neater. Instead of calling
translate()(Component)you can now just calltranslate(Component). There's no initialisation going on in I18n anyway.It's a breaking change, so I can remove it from this PR if you don't like it.