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.
Introduction to Installing & Managing 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 is one of the premier global providers in the 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.
- Nexcess account
- Any Nexcess Plan that supports the WordPress CMS
- Secure Shell (SSH) access
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:
To see the available SUBCOMMANDS that can be executed on WordPress core regarding languages, we can use the following command:
The following command shows all the available languages for the core installation that are available:
To check which language is installed on our site for the WordPress core we can use the following command:
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 English (United States) that is shown as the active language with the following command:
To switch the active language from English (United States) to English (UK), we can use the following command:
Disclaimer: As we can see, the language has been switched to English (UK) but with a warning that there is a different way of doing it (even though it switches the language correctly).
Further in this article, we will list the commands for use without producing the warning due to the command being deprecated.
Managing the WordPress Theme Language Using WP-CLI
To see which language is installed currently for the theme, we can use the following command:
By the output of the command, we can see that the current language is English (United States).
To see the available languages for the theme, we can use the following command:
Disclaimer: The number of languages available for the theme depends on the theme developers and the requested language by the WordPress user community.
To see which language is active currently for the theme, we can use the following command:
As we can see, it is a different language, English (UK), from the one we got previously when checking on the core.
The reason for that is because the theme will always pick up the language of the WordPress core and if it happens that the theme does not support the language that is set up as for the core, it will use the last one that was supported. This kind of example is shown with the following command:
But the theme Astra shows no language active, which means it will default to its default version.
So the reason for that is that the theme Astra does not support the Croatian language by default, but let’s try to see if it’s available in this case with the following command:
The above command did not give us any output, which means that Astra does not support the Croatian language, and the language can’t be found in official WordPress offering.
Disclaimer: If we try to install the Croatian language anyway, we will get the following error:
But if we check for the English language, it gives us following output:
Since we already have the English (United States/English (UK) installed for the Astra theme, let's switch to one of those for the WordPress core and see what happens with the Astra theme:
We are informed the reason behind this outcome is that there is no activate option in –help for the theme language modifications.
Managing the WordPress Plugin Language Using WP-CLI
In most cases switching the plugin, the language is the same as for the theme, just with a different command which we can always reference by checking with the –help command.
Disclaimer: The plugin language has the same correlation with the WordPress core language as does the theme language, so the same rules apply to them.
In most cases, it’s straightforward when dealing with languages but if something is misconfigured with the theme, plugin, or core, troubleshooting will almost always point to the missing PHP extensions, etc. And in that case, our suggestion is to reach out to our support team to assist you further with resolving the issue.
The WordPress active language is fairly easy to maintain. If you need some specific languages that are not supported officially, there may be a plugin that would help you solve the issue. However, if you are comfortable with using the command line for the language modifications shown in this article, we would always recommend use them. The benefit is that if anything gets messed up, we can check the command history and faster help you to resolve the issue.
If you are interested in more in-depth usage of WP-CLI language commands and potentially contributing to the WP-CLI tool and its supporting community, you can always reference the following link:
As for your interest in Nexcess, if you are interested in learning a lot of new stuff, you can always check out our , or if you can’t find what you are searching for there, you can always visit the . If that does not help, you can get in contact with our most helpful support agents that will help you with your problems and questions.
Using the WP-CLI commands for languages is documented in the following articles:
Those articles cover how to install, add, activate, change, and manage language packs for the WordPress core, plugins, and themes.
Useful WordPress Links for Developers & Admins
About the Nexcess Portal
Starting with a new hosting partner can be overwhelming. For that exact reason, we have prepared a Nexcess Portal Guide to make each client’s introduction to our Nexcess Portal easier.
How to Become a Nexcess Portal Pro
You signed up for an account with Nexcess but now what do you do? New systems can be intimidating to learn, so we’ve put together this guide to help explain what is in the portal and where to find it.
Read more about the Fully Managed WordPress Hosting and its benefits for your business.
Build Better Websites with Fully Managed WordPress Hosting
It’s hosting optimized for WordPress. That means a faster, more secure and scalable website. Smart monitoring tools are built-in to help you keep it that way.
It’s why WordPress Users Trust Nexcess Hosting.
We also have a variety of Nexcess support articles about WordPress, including how to get your site going with a number of different configuration options. These resources include a great article on setting this up for Migrating to Nexcess with managed WordPress and managed WooCommerce hosting.
If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.
Resources for More Information
New Customers: Fully Managed Hosting Solutions
- Scope of Support
- Getting started with managed WordPress and WooCommerce hosting
Migrating to Nexcess with managed WordPress and managed WooCommerce hosting
- Going live with your site in Managed WordPress and Managed WooCommerce hosting
- WordPress Cleanup 101: 9 Easy Ways To Clean Up and Optimize Your WordPress Site
- How to configure the Nexcess CDN with WordPress and CDN Enabler
- The Nexcess Plugin Performance Monitor
- Viewing AWStats for Managed WordPress & WooCommerce