Sponsored Content
The Wayback Machine - https://web.archive.org/web/20210817032938/https://github.com/google/site-kit-wp/issues/759
Skip to content
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

wordpress/components package wrongly included #759

Closed
swissspidy opened this issue Oct 31, 2019 · 9 comments
Closed

wordpress/components package wrongly included #759

swissspidy opened this issue Oct 31, 2019 · 9 comments

Comments

@swissspidy
Copy link
Member

@swissspidy swissspidy commented Oct 31, 2019 •

Bug Description

The plugin bundles @wordpress/components because it uses the withFilters component. That means unnecessarily including tons of JavaScript. One side effect of that is users having to translate irrelevant strings on https://translate.wordpress.org/projects/wp-plugins/google-site-kit/ because they're part of the package.

The solution would be to copy the code of withFilters and ditch the components package entirely.

Additional Context

  • PHP Version:
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Plugin Version [e.g. 22]
  • Device: [e.g. iPhone6]

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • No irrelevant translatable strings are included in the plugin and exposed to translators.

Implementation Brief

  • Bundle withFilters HOC from Gutenberg directly in the plugin.

Changelog entry

  • Remove irrelevant translation strings from codebase by eliminating @wordpress/components dependency.
@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Nov 4, 2019

The plugin bundles @wordpress/components because it uses the withFilters component. That means unnecessarily including tons of JavaScript. One side effect of that is users having to translate irrelevant strings on https://translate.wordpress.org/projects/wp-plugins/google-site-kit/ because they're part of the package

Why would contributors need to translate strings that aren't under the google-site-kit text domain?

Also, all of @wordpress/components shouldn't be included in our bundles since we only reference the wp global in our consuming code.

@ThierryA ThierryA added the P1 label Nov 4, 2019
@swissspidy
Copy link
Member Author

@swissspidy swissspidy commented Nov 4, 2019 •

WordPress.org translation platform scans all strings irregardless of text domain for various reasons.

The complete package is bundled as a polyfill on WP 4.x installs.

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Nov 4, 2019

@aaemnnosttv

Also, all of @wordpress/components shouldn't be included in our bundles since we only reference the wp global in our consuming code.

We need to bundle it for pre-Gutenberg versions as a polyfill. However, I completely agree with the IB, we should fully eliminate this dependency and instead bundle that single function "manually".

@felixarntz felixarntz added this to the 1.0.2 milestone Nov 4, 2019
@lilybonney lilybonney removed this from the 1.0.2 milestone Nov 4, 2019
@swissspidy
Copy link
Member Author

@swissspidy swissspidy commented Nov 4, 2019

I've had a PoC over at #784, but based on #437. It would need to be rebased to develop for a patch release. If anyone wants to take that over, feel free :-)

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Nov 6, 2019

@swissspidy #802 is a version of your PR which targets develop. It also removes @wordpress/components as a dependency in a few other places.

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Nov 6, 2019 •

#802 is ready for review, although if we end up going with #437 for i18n sooner than later then #784 would be easier to merge since they share a common base (in which case it would need just a few changes which it could borrow from 802 😄 ).

@tofumatt tofumatt added this to the 1.0.2 milestone Nov 6, 2019
@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Nov 6, 2019
@felixarntz felixarntz removed their assignment Nov 7, 2019
@tofumatt tofumatt self-assigned this Nov 7, 2019
@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Nov 7, 2019

Grepping through the content, looking through code with // translators: comments, and looking through __() calls from the output of npm run build in the dist/ folder this looks good to me; I can't see anything from outside the google-site-kit i18n domain.

If there were particular strings showing up before it would be good to note those and I can specifically check for them. But this seems to work so QA ✅

@tofumatt tofumatt removed their assignment Nov 7, 2019
@swissspidy
Copy link
Member Author

@swissspidy swissspidy commented Nov 7, 2019

@tofumatt See https://translate.wordpress.org/projects/wp-plugins/google-site-kit/dev/es/default/ for strings that are wrongly included. You'll see string like "Comma", "Error loading block: %s", and "Font Size"

@felixarntz felixarntz closed this Nov 7, 2019
@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Nov 7, 2019

Didn't see any of those in the output, so 👍

@ThierryA ThierryA removed this from the 1.0.2 milestone Feb 3, 2020
@ThierryA ThierryA added this to the Sprint 10 milestone Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants