wp-cli / language-command

Installs, activates, and manages language packs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-installed for themes and plugins should only support one language code

ocean90 opened this issue · comments

2660f96 added support for is-installed to language core and follows the core/plugin/theme commands. All the commands only support one object to check for. This makes sense because the return value is only 0 or 1.

In 51a5ff0 this was also added to language plugin/theme but in this case it also supports passing multiple language codes. This made the genreal behaviour of is-installed inconsistent and I'm wondering why someone would use this since you'd never know which language code isn't installed.

If your use case is to verify whether all requirements are set and bail if not, then this can do it in one command.

For quick & dirty setup, for example, you could do something like this:

if ! wp plugin is-installed gutenberg en_US de_DE fr_FR nl_NL; then
    wp plugin install gutenberg en_US de_DE fr_FR nl_NL
fi

Otherwise, you are still able to only pass in a single plugin/theme at a time.

So yes, while it is debatable whether one can make proper use of this, it is not an error per se, and the more useful behavior is not blocked because of it.

Of course this makes it inconsistent with the existing core language is-installed command then. So we should discuss whether we change one or the other to make them more consistent.

Hmm yeah I probably should only have added support for one locale to be passed.