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

docker: Add script to create "fake" translations for testing i18n #21407

Merged
merged 5 commits into from
Nov 1, 2021

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Oct 13, 2021

Changes proposed in this Pull Request:

This adds a script, intended to be run inside the Jetpack Docker
environment, to create plugin translations for two fake languages.

  • en_piglatin: All messages are translated into Pig Latin.
  • en_rtl: All messages will display backwards, and the interface will be
    right-to-left.

Once you have run the script, in WordPress Admin > Settings > General
you should see the above two languages as options for "Site Language".

Note WordPress itself is not translated as described, the translations
are only created for messages in the specified plugin.

Jetpack product discussion

p1634159370450900-slack-CBG1CP4EN

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Make sure you have the latest docker image, last I checked the one from Docker was outdated. You might need to jetpack docker build-image.
  • Run jetpack docker exec /var/scripts/fakepot.sh /var/www/html/wp-content/plugins/jetpack
  • Open your site to /wp-admin/options-general.php. You should see the two new languages in the Site Languages dropdown.
  • If you select "en_piglatin" and go to the Jetpack dashboard, you should see something like this:
    en_piglatin screenshot
  • If you select "en_rtl" and go to the Jetpack dashboard, you should see something like this:
    en_rtl screenshot

This adds a script, intended to be run inside the Jetpack Docker
environment, to create plugin translations for two fake languages.

- en_piglatin: All messages are translated into Pig Latin.
- en_rtl: All messages will display backwards, and the interface will be
  right-to-left.

Once you have run the script, in WordPress Admin > Settings > General
you should see the above two languages as options for "Site Language".

Note WordPress itself is not translated as described, the translations
are only created for messages in the specified plugin.
@anomiex anomiex added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Feature Request [Pri] Low Docker labels Oct 13, 2021
@anomiex anomiex self-assigned this Oct 13, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.

@anomiex anomiex added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Oct 15, 2021
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be useful, thank you.

I wonder if we should make this an option in the Jetpack Debug helper plugin UI right away?

@anomiex
Copy link
Contributor Author

anomiex commented Oct 18, 2021

Unless the Jetpack Debug Helper is already monorepo-only, it would need some work:

  • Remove the use of stuff from the monorepo tools/includes/ that may not be available.
  • Detect whether Jetpack is the monorepo copy where we need to make a pseudo-built version, or an already-built version installed in some other way (e.g. Jetpack Beta) where we don't need to and probably can't because it's not a git repo.
  • Don't just assume WordPress is at /var/www/html/.
  • Will the calls to wp make-pot and such always work as written?
  • Will the node cli command always be available?
  • Will pnpm always be available for line 99? Could switching to npm there help?

@sdixon194
Copy link
Contributor

Tested this out, but even after cleaning docker, building image, and upping again, I'm getting:

Success: Created 4 files.
Copying translations into /var/www/html/wp-content/languages/plugins/
cp: target '/var/www/html/wp-content/languages/plugins/' is not a directory
Cleaning up /tmp/fakepot.06MTtKk
Command exited with status 1

What am I missing here 🤔

@anomiex
Copy link
Contributor Author

anomiex commented Oct 20, 2021

You hadn't installed any language packs before, so the directory for the plugin language packs didn't exist. Updated the script to create the directory.

@kraftbj kraftbj enabled auto-merge (squash) November 1, 2021 22:11
@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 1, 2021
@kraftbj kraftbj merged commit 385bf54 into master Nov 1, 2021
@kraftbj kraftbj deleted the add/docker-fakepot branch November 1, 2021 22:21
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 1, 2021
davidlonjon added a commit that referenced this pull request Nov 2, 2021
…ng-formatting

* master:
  docker: Add script to create "fake" translations for testing i18n (#21407)
  Add webpack-config package (#21482)
  Update dependency composer/semver to v3.2.6 (#21608)
  Update dependency eslint-plugin-import to v2.25.2 (#21607)
  Update JS unit testing packages (#21605)
  Admin page: Fix pricing/currency displayed on the upgrade page (#21594)
  Update dependency @rollup/plugin-node-resolve to v13.0.6 (#21599)
  Publicize: Add new publicize icon toggle component (#20957)
  Search: hide search menu for atomic sites (#21565)
  Allow /wp/v2/sites/1234/batch endpoint to process widget updates (#21549)
  tooling: Add `.mjs` as a JavaScript extension (#21589)
  Jetpack: PHPCS src/class-tracking (#21583)
  Publicize: make the default social media message blank (#21477)
davidlonjon added a commit that referenced this pull request Nov 2, 2021
* master:
  docker: Add script to create "fake" translations for testing i18n (#21407)
  Add webpack-config package (#21482)
  Update dependency composer/semver to v3.2.6 (#21608)
  Update dependency eslint-plugin-import to v2.25.2 (#21607)
  Update JS unit testing packages (#21605)
  Admin page: Fix pricing/currency displayed on the upgrade page (#21594)
  Update dependency @rollup/plugin-node-resolve to v13.0.6 (#21599)
  Publicize: Add new publicize icon toggle component (#20957)
  Search: hide search menu for atomic sites (#21565)
  Allow /wp/v2/sites/1234/batch endpoint to process widget updates (#21549)
  tooling: Add `.mjs` as a JavaScript extension (#21589)
  Jetpack: PHPCS src/class-tracking (#21583)
  Publicize: make the default social media message blank (#21477)
davidlonjon added a commit that referenced this pull request Nov 2, 2021
* master: (40 commits)
  docker: Add script to create "fake" translations for testing i18n (#21407)
  Add webpack-config package (#21482)
  Update dependency composer/semver to v3.2.6 (#21608)
  Update dependency eslint-plugin-import to v2.25.2 (#21607)
  Update JS unit testing packages (#21605)
  Admin page: Fix pricing/currency displayed on the upgrade page (#21594)
  Update dependency @rollup/plugin-node-resolve to v13.0.6 (#21599)
  Publicize: Add new publicize icon toggle component (#20957)
  Search: hide search menu for atomic sites (#21565)
  Allow /wp/v2/sites/1234/batch endpoint to process widget updates (#21549)
  tooling: Add `.mjs` as a JavaScript extension (#21589)
  Jetpack: PHPCS src/class-tracking (#21583)
  Publicize: make the default social media message blank (#21477)
  Photon: do not serve Wikipedia images from CDN. (#21572)
  Publicize: update endpoint (#21510)
  [Plugin] Backup: Update initial backup screen (#21559)
  RNA Connect Screen: Remove unused files (#21570)
  RNA Connection: Add ConnectScreenRequiredPlan Component (#21521)
  Update PHPUnit coverage configs (#21557)
  cli: Fix skeleton phpunit config (#21555)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants