Do you need to use a different language on your WordPress site? Rather than manually downloading, installing, and activating your language packs, you can easily do it all with WP-CLI! In this article, we'll show you how.
Quick Links
- Managing WordPress Core Language Packs
- Managing WordPress Plugin Language Packs
- Managing WordPress Theme Language Packs
Managing WordPress Core Language Packs
Listing Available Language Packs
To view a list of all language packs that can be installed with WP-CLI, simply use the following command:
pagely-wp language core list
Listing Installed Language Packs
To get a list of the currently installed language packs for WordPress core, issue the following WP-CLI command:
pagely-wp language core list --status=installed
Installing a Language Pack
To install a language pack for WordPress core, just grab the language name (the list command helps with this) and install it using the install subcommand like this:
pagely-wp language core install es_ES
Activating a Language Pack
Once a language pack has been installed, you'll want to activate it. To do so, use the following command, replacing the language name in the example with the name of the pack that you want to activate.
pagely-wp language core activate es_ES
Uninstalling a Language Pack
To uninstall a language pack that has previously been installed, you can use the uninstall subcommand like this:
pagely-wp language core uninstall es_ES
Updating All Language Packs
To perform an update of all currently installed language packs for WordPress core, simply use the following command:
pagely-wp language core update
Managing WordPress Plugin Language Packs
Just like WordPress core, WP-CLI also supports managing language packs for plugins.
Listing Available Language Packs
To view a list of all language packs that can be installed for a particular plugin, replace hello-dolly with the plugin slug in the following command:
pagely-wp language plugin list hello-dolly
Listing Installed Language Packs
Do you want to check which language packs are already installed for one of your plugins? Do it like this:
pagely-wp language plugin list hello-dolly --status=installed
Installing a Language Pack
Once you've determined that a language pack is available for your plugin, you're ready to install it! To install a new language pack for one of your WordPress plugins, it can be installed like this:
pagely-wp language plugin install hello-dolly es_ES
Activating a Language Pack
Before an installed language pack will be used, you'll need to activate it. To activate your language pack, use the activate subcommand like this:
pagely-wp language plugin activate hello-dolly es_ES
Uninstalling a Language Pack
If you no longer need a language pack for one of your plugins, it can be removed using the uninstall subcommand like the following example:
pagely-wp language plugin uninstall hello-dolly es_ES
Updating All Language Packs
To perform an update of all language packs installed for a particular plugin, you can use the update subcommand like in the following example:
pagely-wp language plugin update hello-dolly
Or if you want to update the language packs for all plugins:
pagely-wp language plugin update --all
Managing WordPress Theme Language Packs
Need to translate your WordPress theme into different languages? Just like with plugins, you can install and activate your language packs with WP-CLI.
Listing Available Language Packs
To view a list of the available languages for a particular WordPress theme, you can use the following command, replacing twentynineteen with the name of your theme:
pagely-wp language theme list twentynineteen
Listing Installed Language Packs
If you need to see which language packs are already installed for one of your themes, simply use the --status=installed option like this:
pagely-wp language theme list twentynineteen --status=installed
Installing a Language Pack
If a language pack is available for your theme, you can install it like this:
pagely-wp language theme install twentynineteen es_ES
Activating a Language Pack
Once your theme's language pack is installed, it can be activated like in the following example:
pagely-wp language theme activate twentynineteen es_ES
Uninstalling a Language Pack
What if you no longer need a certain language pack? You can uninstall it like this:
pagely-wp language theme uninstall twentynineteen es_ES
Updating All Theme Language Packs
If you want to update all of your installed language packs for your theme, you can use the following example:
pagely-wp language theme update twentynineteen
Or if you want to update all of the installed language packs for all of your themes:
pagely-wp language theme update --all