wp-cli / i18n-command

Provides internationalization tools for WordPress projects.
MIT License
96 stars 52 forks source link

`'update-po' is not a registered subcommand of 'i18n'.` #331

Closed strarsis closed 2 years ago

strarsis commented 2 years ago

Bug Report

Describe the current, buggy behavior Trying to invoke the new update-po subcommand with wp i18n from the latest release v2.4.0, that introduced it, or latest main results in an error that this subcommand is not known:

Error: 'update-po' is not a registered subcommand of 'i18n'.

Describe how other contributors can replicate this bug

Describe what you would expect as the correct outcome update-po subcommand is found and can be used.

Let us know what environment you are running this on

OS:     Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php
PHP version:    7.4.30
php.ini used:   /etc/php/7.4/cli/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
SQL modes:
WP-CLI root dir:        /home/build/src/i18n-command/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      /home/build/src/i18n-command/vendor
WP_CLI phar path:
WP-CLI packages dir:    /home/build/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:  /home/build/src/example.com/site/wp-cli.yml
WP-CLI version: 2.6.0

Provide a possible solution The new update-po subcommand isn't registered/loaded. Probably some piece of code is missing that would register this subcommand otherwise.

swissspidy commented 2 years ago

This doesn't sound like you're using the latest version of this package. At least I cannot reproduce the issue locally.

What's the output of wp package list? What's the output of wp i18n?

I installed the latest version of the package using wp package install wp-cli/i18n-command:dev-main and then I get this:

$ wp package list
+------------------------------------+------------------+----------+-----------+----------------+
| name                               | authors          | version  | update    | update_version |
+------------------------------------+------------------+----------+-----------+----------------+
| swissspidy/validate-readme-command |                  | dev-main | none      |                |
| wp-cli/dist-archive-command        | Daniel Bachhuber | v2.0.1   | none      |                |
| wp-cli/i18n-command                | Pascal Birchler  | dev-main | available | 2.x-dev        |
| wp-cli/scaffold-package-command    | Daniel Bachhuber | v2.0.1   | none      |                |
+------------------------------------+------------------+----------+-----------+----------------+

$ wp i18n update-po
usage: wp i18n update-po <source> [<destination>]

So it works as expected.

strarsis commented 2 years ago

@swissspidy: Yes, I can confirm that installing the latest wp i18n as you described (wp package install) works correctly.

What I did first (and which didn't work):

  1. (cd ~/src)
  2. git clone https://github.com/wp-cli/i18n-command
  3. (cd i18n-command)
  4. composer install
  5. ~/src/i18n-command/vendor/bin/wp i18n update-po

After install the latest wp i18n using wp package install the issue also went away. So my approach for using wp i18n directly from GitHub repository appears to be wrong.

bilalmalkoc commented 1 year ago

@swissspidy check this

It says

"This package is included with WP-CLI itself, no additional installation necessary."

Check this issue please: https://github.com/wp-cli/i18n-command/issues/340