Conversation
Gruntfile.js
Outdated
| }, | ||
| makepot: { | ||
| command: 'wp i18n make-pot . languages/amp-js.pot --include="*.js" --file-comment="*/null/*"' // The --file-comment is a temporary workaround for <https://github.com/ampproject/amp-wp/issues/1416>. | ||
| // TODO: The exclude argument to make-pot does not seem to actually exclude. Without including the --exclude argument, the generated amp-js.pot still includes references to the build/ directory. |
There was a problem hiding this comment.
build was never excluded by default, so if you don't need that, you have to pass --exclude.
Note: The latest version of the command changed the way includes and excludes are handled based on scores, see wp-cli/i18n-command#104.
|
@felixarntz Does running |
|
Quick question: Does the plugin still support WordPress 4.9 with the Gutenberg plugin or is Gutenberg support aimed at WordPress 5.0 only? |
|
Support is intended for 4.9 without Gutenberg as well. For example #1781 |
|
WordPress.org should handle string extraction of JavaScript files by now, as you can see here: https://translate.wordpress.org/projects/wp-plugins/amp/dev/en-gb/default?filters%5Boriginal_id%5D=7004670 That also means WordPress.org ships language packs with JSON translation files in them since WordPress 5.0. So there's no need to manually build POT files anymore. Note: I published an in-depth guideline for WordPress JS I18N on my website: https://pascalbirchler.com/internationalization-in-wordpress-5-0/
|
|
@swissspidy ok, thank you. So we can eliminate So given this example: amp-wp/includes/admin/class-amp-editor-blocks.php Lines 162 to 171 in 8f7a60a Are you saying that we don't need the Also, will |
|
Yep, there's no need for that anymore. WordPress.org handles the make-pot part nowadays.
4.9 + Gutenberg should still have
No :-) That's the whole point of this new function. Everything is split up into multiple little JSON files that will be read and passed to the JS libraries in your plugin. See https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/ for more info. However, You could shim |
|
@swissspidy thank you very much. I've amended the PR then to eliminate POT generation entirely. The result is that there is that there is no longer a |
WordPress no longer needs POT files or generated PHP files for translation strings to be discovered. So we can eliminate all of that code.
This PR also adds a missing
translatorscomment.Without this--excludeargument, runningtime lando grunt shell:makepottakes 73 seconds to complete. What's more is that the generatedamp-js.potfile includes references to files in thebuild/directory even though this directory is not included in the--includeargument. When the--excludeis included, the time to runtime lando grunt shell:makepotcuts down to 41 seconds. Even though this is entirely too long to run (which is likely due to a Lando problem), it shows that adding the--excludeis cutting down on processing files unnecessarily.This PR also uses Composer to explicitly mark thewp-cli/i18n-commanddependency with a pinned version.