Installing & managing WordPress language packs using WP-CLI
The WordPress active language is fairly easy to maintain, and here is a guide on managing language packs using the WP-CLI installed on all of our servers.
Get fast, reliable hosting for WordPress
Power your site with the industry’s fastest, most optimized WordPress hosting
Introduction to installing WordPress language packs using WordPress command line interface (WP-CLI)
In today’s world, where everything is almost always multilingual, we need to consider doing the same for the websites that we own or manage.
Since almost 37% of all the world’s websites run on the WordPress Content Management System (CMS) and Nexcess is one of the premier global providers in the Managed WordPress industry, here is a guide on managing language packs using the WordPress Command Line Tool (WP-CLI) that is installed on all of our servers.
Requirements:
- Nexcess account
- Any Nexcess Plan that supports the WordPress CMS
- Secure Shell (SSH) access
Your SSH access can be obtained by following this guidance in the Locating your SSH/SFTP Credentials for your Nexcess Cloud Account article.
Everything else is already installed and should be running as expected in the following parts of the tutorial.
Managing WordPress languages in 3 areas: core, themes, & plugins
- WordPress Core Language: The Admin Panel and the general installation of the WordPress supports most of the world’s languages.
- WordPress Theme Language: Each theme can have different languages that depend on the theme developers.
- WordPress Plugin Language: Each plugin can have different languages that depend on the plugin developers.
Each of those areas 1-3 above has their respective commands that can be used to download, activate, and deactivate languages.
Managing the WordPress core language using WP-CLI
In this use case, we will be using the following temporary domain to show you how it works:
- Domain: 893f3aa5f1.nxcli.net
- WordPress Installation Path: /home/$username/$domain/html
- Our Path: /home/adea7c0e/893f3aa5f1.nxcli.net/html
Navigate to the path using the following command:
| cd /home/adea7c0e/893f3aa5f1.nxcli.net/html |
To see the available SUBCOMMANDS that can be executed on WordPress core regarding languages, we can use the following command:
| wp language core —help |
The above command will generate a list with available SUBCOMMANDS, some examples, and additional parameters that can be used with the command:
| SYNOPSIS wp language core SUBCOMMANDS activate Activates a given language. install Installs a given language. is-installed Checks if a given language is installed. list Lists all available languages. uninstall Uninstalls a given language. update Updates installed languages for core. EXAMPLES # Install the Dutch core language pack. $ wp language core install nl_NL Success: Language installed. # Activate the Dutch core language pack. $ wp language core activate nl_NL Success: Language activated. # Uninstall the Dutch core language pack. $ wp language core uninstall nl_NL Success: Language uninstalled. # List installed core language packages. $ wp language core list –status=installed +———-+————–+————-+———–+———–+———————+ | language | english_name | native_name | status | update | updated | +———-+————–+————-+———–+———–+———————+ | nl_NL | Dutch | Nederlands | installed | available | 2016-05-13 08:12:50 | +———-+————–+————-+———–+———–+———————+ |
The following command shows all the available languages for the core installation that are available:
| wp language core list |
To check which language is installed on our site for the WordPress core we can use the following command:
| [adea7c0e@cloudhost-3927893 html]$ wp language core list –status=installed+———-+————–+————–+———–+——–+———————+| language | english_name | native_name | status | update | updated |+———-+————–+————–+———–+——–+———————+| en_GB | English (UK) | English (UK) | installed | none | 2021-09-09 10:29:25 |+———-+————–+————–+———–+——–+———————+ |
We can see that the additional language of en_GB English (UK) is installed from the above command, but that does not mean it is the active language by the site since WordPress comes preinstalled with the language of en_US
Additional resources
What is managed WordPress hosting? →
Get details and decide if managed WordPress hosting is right for you.
Must-have web development plugins to create WordPress websites at scale →
Explore the best web development plugins to enhance functionality, improve performance, and streamline your WordPress site.
A complete guide to WordPress shortcodes →
Shortcodes make life easier. Learn how to get started!
