-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framework: Run i18n-mixin-to-localize codemod #18590
Conversation
@ockham Do you know why these tests were failing by chance? It seemed a reference to the Component from |
I think there are two errors in play here -- 6dc6a62 was just to fix tests; turns out the |
The other error I'm currently seeing with PostEditor is this: The immediate reason for this is that This still doesn't fix the underlying error with the editor, but maybe we'll get more meaningful error messages to track it down once we fix the |
Fix in c17bc44. I think I'll spin up a separate PR for that. |
So the actual error in PostEditor is and I think the reason are once again static methods -- wp-calypso/client/components/tinymce/plugins/wpcom-view/views/contact-form/index.jsx Line 20 in 6e86844
localize . So we might have to modify i18n-calypso to hoist static methods after all.
|
Oh, we might work around that using a similar pattern as https://github.com/Automattic/wp-calypso/blob/master/client/components/tinymce/plugins/wpcom-view/views/simple-payments/index.jsx |
I like this pattern better because it signals intention better than independently exported functions. However, fixing the root cause of the issue by addressing the |
2043b8b
to
6afdc24
Compare
I'll have a look at these… cracks knuckles |
After some grepping, all the usage seems fine. The |
What's the concern here? Here are some findings that may be relevant:
There appear to be 84 uses of wp-calypso/client/blocks/app-banner/index.jsx Lines 160 to 163 in ce892aa
Is verifying that that example works fine enough? |
Good thinking! EDIT: I improved the original to catch a few more cases:
Looks like a manageable list, I'll dig further… |
After looking a bit, cleaning up all those @ockham Let's hear what you think, but it may be best to add the Here's the full output of non-
|
Oh wow, thanks a lot for the grepping, really helps to see the bigger picture here! I took a random sample from that list: |
Other instances are textbook cases of Edit: Okay, maybe a bit trickier than the textbook example -- but on the bright side, it doesn't need to be |
I had a look at the rest of the list. Tests should be fine by definition (they wouldn't pass otherwise), and the other ones seem to either use |
I just vetted |
Is it me or does this thing feel way faster now that the auto-injected mixin is gone? 😮 |
I ran through our full e2e tests on this branch and everything looks good. 👍 |
Fixes a bug I introduced with #18590, as reported by @jorgefilipecosta in Slack: > If open media and select an image and then press edit I get an error related with localize it may be related with the last changes Turns out that `EditorMediaModalDetail` is [properly `localize()`d](https://github.com/Automattic/wp-calypso/blob/e7e4265d9b65eccb771c3977b54bc0d272bc3c7b/client/post-editor/media-modal/detail/index.jsx#L100), but `my-sites/media/main` was importing the unlocalized version of the component.
Nice work @ockham!!! This was a tricky one |
|
||
module.exports = React.createClass( { | ||
module.exports = localize(React.createClass( { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: #18710 will soon be ready for review (once a desc is written).
It aims to fix up instances similar to this ^
It currently only looks at export default
s but could be tweaked to consider module.exports =
too :)
TODO:
prototype.translate
in tests, removethis.translate
)sites-list
notices: see SitesList Notices: Turn into actual React Component #18625form-base
: Turn into component, have consumers inherit?localize()
d now, soform-base
should be able to just usethis.props.translate()
.ref
s. Do we needlocalize
to hoist them?this.props.translate
but noti18n-calypso
. Any takers?