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

Translate Verbum Block Editor Package #90462

Merged
merged 18 commits into from
May 10, 2024
Merged

Conversation

alshakero
Copy link
Member

@alshakero alshakero commented May 8, 2024

Proposed Changes

This downloads Gutenberg translations from .org's GlotPress and bundles it with VBE to be deployed in widgets.wp.com. This PR will not make the editor translate well. It just creates the translations file to be consumed later.

Testing Instructions

  1. cd into packages/verbum-block-editor.
  2. run yarn build.
  3. run yarn dev --sync.
  4. There should be many JSON files in /dist/languages.

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@alshakero alshakero marked this pull request as ready for review May 10, 2024 09:13
@alshakero alshakero requested a review from a team May 10, 2024 09:45
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 10, 2024
@escapemanuele escapemanuele added this to In progress in Vertex Team Board via automation May 10, 2024
@@ -23,15 +23,17 @@
"bugs": "https://github.com/Automattic/wp-calypso/issues",
"types": "dist/types",
"scripts": {
"clean": "rm -rf dist",
"build": "NODE_ENV=production yarn dev",
"clean": "",
Copy link
Contributor

Choose a reason for hiding this comment

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

we would need to revert this right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not now at least. If we keep this, yarn dev will delete the dist folder and the translations with it, and your sandbox won't have them. Once we deploy, we can put this back since yarn dev --sync won't delete files on remote if they don't exist on your site.

};

const loadLanguageFile = async ( languageFileName: string ) => {
const url = `https://widgets.wp.com/verbum-block-editor/languages/${ languageFileName }-v1.1.json`;
Copy link
Contributor

Choose a reason for hiding this comment

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

We will have to handle cache issues at some point as well

@agrullon95 agrullon95 self-requested a review May 10, 2024 14:44
@alshakero alshakero merged commit 543201a into trunk May 10, 2024
12 checks passed
Vertex Team Board automation moved this from In progress to Done May 10, 2024
@alshakero alshakero deleted the translate/verbum-block-editor branch May 10, 2024 14:44
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 10, 2024
@alshakero
Copy link
Member Author

alshakero commented May 10, 2024

Update: It turns out some strings are translated at module initiation time, meaning they strictly have to be translated before the JS bundle is executed at all! Loading translations during runtime of this script won't be possible. I updated this PR to only build the translations. Then, I'll send a Jetpack PR to enqueue the translations before executing this script.

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

Successfully merging this pull request may close these issues.

None yet

3 participants