cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

Switch to using `wp i18n make-pot` #80

Open danielbachhuber opened 5 years ago

danielbachhuber commented 5 years ago

The WordPress project has switched to using wp i18n make-pot (docs). It'd be great if this package switched over too, for two specific advantages:

  1. Full PHP 7 support.
  2. Also parses JavaScript files.

cc @schlessera @swissspidy

bradyvercher commented 5 years ago

As much as I'd like to switch over, I don't really want to make WP-CLI (and a WP installation?) a required dependency.

Ideally there would be a generic PHP package that could be used by WP-CLI, as a Composer package/script, grunt-wp-i18n, and node-wp-i18n. I'm not sure if it's possible to extract the work done for the WP-CLI command at this point, but that would be killer.

danielbachhuber commented 5 years ago

As much as I'd like to switch over, I don't really want to make WP-CLI (and a WP installation?) a required dependency.

Can you explain further? wp i18n make-pot doesn't require a WordPress installation, and you can slim the installation solely to the framework code and the core command package.

bradyvercher commented 5 years ago

I wasn't sure if WordPress installation was required or not to run that command, but if this becomes a wrapper for wp i18n make-pot, doesn't that require developers to have WP-CLI installed and available in their system path? Or are you saying it's possible to bundle the necessary code in this package without having to install WP-CLI?

I may not be understanding what's possible since it's been awhile since I've dug through WP-CLI. Can you explain how you envision this working?

schlessera commented 5 years ago

For v2.0 of WP-CLI I refactored the package structure so that it works properly with Composer.

All you need is to require the wp-cli/i18n-command package and it will just work. You can then use it in your Composer scripts through wp i18n ... or directly via vendor/bin/wp i18n ....

Developers don't need to have WP-CLI installed for it to work, and it will also only pull in the minimum required.

bradyvercher commented 5 years ago

@schlessera Very cool! That's pretty much exactly what I've wanted for cases where I use Composer but don't need Node. I'll look into what it will take to switch this over to using that package instead of the old PHP tools.

danielbachhuber commented 5 years ago

All you need is to require the wp-cli/i18n-command package and it will just work. You can then use it in your Composer scripts through wp i18n ... or directly via vendor/bin/wp i18n ....

I was also thinking that, if you don't want this Node package to have a dependency on composer, you could instead create a Phar file that gets bundled directly with this package.