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

SDK / Gutenblocks: include .pot file with built blocks #30048

Closed
jeherve opened this issue Jan 9, 2019 · 5 comments
Closed

SDK / Gutenblocks: include .pot file with built blocks #30048

jeherve opened this issue Jan 9, 2019 · 5 comments
Assignees
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg i18n [Pri] High Address as soon as possible after BLOCKER issues [Type] Bug

Comments

@jeherve
Copy link
Member

jeherve commented Jan 9, 2019

Background

Jetpack blocks live as compiled files here:
https://github.com/Automattic/jetpack/tree/branch-6.8-built/_inc/blocks

We then extract strings from those files on release, and generate this file from it:
https://github.com/Automattic/jetpack/blob/branch-6.8-built/_inc/jetpack-strings.php

This is done here:
https://github.com/Automattic/jetpack/blob/branch-6.8/gulpfile.babel.js#L197

However, the automatically generated file does not actually include any strings from the blocks right now. We have to go back to the 6.7 release to actually get strings from the blocks files:
https://github.com/Automattic/jetpack/blob/branch-6.7-built/_inc/jetpack-strings.php
(you can see the files coming from the blocks files by looking at the comments, like // _inc/blocks/editor.js:25)

Something broke in the process in Jetpack 6.8. It seems the format of the strings outputted in the built files by the SDK has changed, so i18n-calypso can’t pick them up anymore.

Ideally, to work around this problem we could use the tools now available in Calypso to create a .pot file that should ship with the blocks we release on npm.

PR to fix this: #30303

From @akirk:

Gutenberg indeed has its own translatable string extractor: https://github.com/WordPress/gutenberg/tree/master/packages/babel-plugin-makepot
And for Calypso we have https://github.com/Automattic/wp-calypso/tree/master/packages/babel-plugin-i18n-calypso

What we’ll do there is to run babel on everything and makepot will extract the @wordpress/i18n style strings and the i18n-calypso plugin with the translate() style strings and then use the command line tool msgcat to merge the files
CALYPSO_ENV=production NODE_ENV=build_pot npm run build-client && find build/i18n-calypso -name \\*.pot | msgcat -f- -o calypso-strings.pot

This is not yet in production but will be available soon

Related: #28583
PR to fix this: #29429

Once the .pot file is available with the blocks, we'll need to update the way Jetpack extracts strings from the blocks to take that into account.

Related discussion: p1547026515746300-slack-jetpack-gutenberg

@jeherve jeherve added [Type] Bug [Pri] High Address as soon as possible after BLOCKER issues i18n [Goal] Gutenberg Working towards full integration with Gutenberg [Project] SDK labels Jan 9, 2019
@simison
Copy link
Member

simison commented Jan 16, 2019

Just to confirm it here I've understood correct; @zinigor you're working on this?

@zinigor zinigor self-assigned this Jan 17, 2019
@zinigor
Copy link
Member

zinigor commented Jan 17, 2019

Yes, sorry, I should have assigned this to myself. I'm going to publish a PR soon that fixes it in Jetpack.

@simison
Copy link
Member

simison commented Jan 18, 2019

Higher level issue tracking progress here: #27814

@simison
Copy link
Member

simison commented Jan 24, 2019

So this issue as it's written, is actually two separate tasks?

Let's make sure to open a new one for the latter before closing this. Also ok to move to higher level issue #27814

@scruffian
Copy link
Member

Closing, since the code lives in Jetpack this will happen a different way: Automattic/jetpack#11817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg i18n [Pri] High Address as soon as possible after BLOCKER issues [Type] Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants