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
Include strings from Jetpack in bundle #2617
Conversation
@@ -66,15 +66,14 @@ | |||
"install:wpcli": "(test -x bin/wp-cli.phar || curl -Ls https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o bin/wp-cli.phar && chmod +x bin/wp-cli.phar) && bin/wp-cli.phar --info", | |||
"prewp": "npm run install:wpcli", | |||
"wp": "php -d memory_limit=4G bin/wp-cli.phar", | |||
"makepot:android": "npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.android.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain gutenberg-android.pot", | |||
"makepot:ios": "npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.ios.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain gutenberg-ios.pot", | |||
"makepot": "npm run wp -- i18n make-pot ./jetpack/extensions --include=*.native.js,*.$PLATFORM.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain jetpack-$PLATFORM.pot && npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.$PLATFORM.js --exclude=test/* --subtract=./gutenberg.pot --merge=./jetpack-$PLATFORM.pot --ignore-domain gutenberg-$PLATFORM.pot ", | |||
"premakepot:gutenberg": "npm run clean:gutenberg && npm run build:gutenberg", | |||
"makepot:gutenberg": "npm run wp -- i18n make-pot ./gutenberg/build --ignore-domain gutenberg.pot", | |||
"postmakepot:gutenberg": "npm run clean:gutenberg", | |||
"pregenstrings": "test -f gutenberg.pot || npm run makepot:gutenberg", |
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.
I am not sure if there's anything similar we need to do for Jetpack like we need to do for gutenberg. The Jetpack submodule we have checked out has a languages/
folder, that includes, among other things, jetpack.pot
file. That jetpack.pot
file does not, however, appear to have all the strings we need since it is missing the "Link address to Google Maps" string (I'm guessing because it is in a native.js
file). In addition, that entire languages/
folder has been removed on master
.
Basically, there is more work to be done here to get a better understanding of the jetpack build process and either (a) verify that we do not need to do anything more to get all the relevant jetpack strings; or (b) run any necessary jetpack builds as part of the bundling process.
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.
Code looks good. One problem with this approach though is that, as you mentioned, we don't (yet) include the strings from the jetpack project, meaning that we won't have all the strings from jetpack (only those from .native.js and .platform.js files).
Moreover, including all the strings from jetpack might be overkill as it's a much larger project which has many strings.
I tried a different approach here though it has its drawbacks (the fact that we lose translator comments)
@@ -66,15 +66,14 @@ | |||
"install:wpcli": "(test -x bin/wp-cli.phar || curl -Ls https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o bin/wp-cli.phar && chmod +x bin/wp-cli.phar) && bin/wp-cli.phar --info", | |||
"prewp": "npm run install:wpcli", | |||
"wp": "php -d memory_limit=4G bin/wp-cli.phar", | |||
"makepot:android": "npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.android.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain gutenberg-android.pot", | |||
"makepot:ios": "npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.ios.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain gutenberg-ios.pot", | |||
"makepot": "npm run wp -- i18n make-pot ./jetpack/extensions --include=*.native.js,*.$PLATFORM.js --exclude=test/* --subtract=./gutenberg.pot --ignore-domain jetpack-$PLATFORM.pot && npm run wp -- i18n make-pot ./gutenberg/packages --include=*.native.js,*.$PLATFORM.js --exclude=test/* --subtract=./gutenberg.pot --merge=./jetpack-$PLATFORM.pot --ignore-domain gutenberg-$PLATFORM.pot ", |
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.
Do you think we could reduce the amount of pot files generated by having something like:
i18n make-pot . --include=./jetpack/extensions/**/*.native.js,./jetpack/extensions/**/*.$PLATFORM.js,./gutenberg/packages/**/*.native.js,./gutenberg/packages/**/*.$PLATFORM.js
?
Thanks for reviewing @Tug!
Makes sense. I can try that.
I see what you mean. Definitely need to fix that if we use this approach.
I agree, this seems like a pretty big concern.
I like the approach in your PR better. It seems much more robust. Like you said, it does seem like we need to figure out the translator's comments issue first. I'm inclined to put more work toward fixing up your approach over the approach in this PR. |
@mchowning Just reminding that we'll be cutting the 1.38 release branch later in the day Monday 9/28. Please try to get this merged by then or bump the milestone. Thanks much 🙇 |
Going ahead and closing this since our translations pipeline has been updated to address this in a different way. |
Fixes #2615
Updating our bundle scripts to ensure that the strings from the jetpack/ repo are included. We are first retrieving the strings from the jetpack repo in a
jetpack-$PLATFORM.pot
file. I am then merging that into thegutenberg-$PLATFORM.pot
file along with the strings from gutenberg. Thatgutenberg-$PLATFORM.pot
file is then passed to the relevant./bin/po2XXXX.js
script.Note that I created this branch off of
trunk
in order to avoid having additional string changes on account of the updates to the submodules ondevelop
. I anticipate that before merging this PR I'll want to rebase this PR to move the package.json changes on top of the appropriate branch (probablydevelop
) and drop the strings changes I have committed in 68a00fd.PR submission checklist: