1

I want to improve my new Wordpress sites setup, and am working on a script to install Wordpress and common plugins.

My problem is, when I install a plugin from admin panel, by default, it installs a version of my plugin in the same language as Wordpress is. This is important, for example, in plugin Contact form 7 it sets up a contact form already configured in that language.

But if I use wp-cli to download and activate the plugin, it downloads an English version.

wp plugin install contact-form-7 --activate

I thought I could use the URL provided in the official Wordpress plugin page, in my country, but as it has a specific version number, it makes it difficult automation to request always last version, which is my goal:

wp plugin install --activate https://downloads.wordpress.org/plugin/contact-form-7.5.1.3.zip

(anyway, this link also leads to an English version of the plugin, even if it was referred from an Spanish Wordpress site)

So, is there any workaorund for this?

K. Weber
  • 2,643
  • 5
  • 45
  • 77
  • 1
    The last example [here](https://developer.wordpress.org/cli/commands/language/) may help, though I've never used it so I cannot be sure. This one: `wp language plugin install akismet nl_NL` – prieber Jun 06 '19 at 19:15

1 Answers1

2

After you've downloaded and activated the plugin use wp language plugin install contact-form-7 nl_NL to install the desired translation.

# Install and activate the Dutch core language pack.
$ wp language core install nl_NL --activate

# Install and activate Contact Form 7.
$ wp plugin install contact-form-7 --activate

# Provide the Dutch language pack for Contact Form 7.
$ wp language plugin install contact-form-7 nl_NL

See https://developer.wordpress.org/cli/commands/language/

leymannx
  • 5,138
  • 5
  • 45
  • 48
  • 1
    That's it, just a note after testing it: it's better to install plugin without the `--activate` option, then install the language pack and **finally** execute `wp plugin activate`, as (at least in this case, but I guess it's frequent), activation implies some actions in which locale is important. (in this specific case a contact form is created in plugin language) – K. Weber Jun 07 '19 at 08:46