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 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:
To see the available SUBCOMMANDS that can be executed on WordPress core regarding languages, we can use the following command:
The above command will generate a list with available SUBCOMMANDS, some examples, and additional parameters that can be used with the 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 the available SUBCOMMANDS that can be execute for the theme language modifications, we can use the following command:
The above command will generate a list with available SUBCOMMANDS, some examples, and additional parameters that can be used with the command:
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.
To see the available SUBCOMMANDS that can be execute for the plugin language modifications, we can use the following command:
The above command will generate a list with available SUBCOMMANDS, some examples, and additional parameters that can be used with the 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.
Potential Issues
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.
Conclusion
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.
Using Managed WordPress for your site hosting will make your site hosting easier and help your site's performance.
Additional Documentation
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:
https://github.com/wp-cli/language-command
As for your interest in Nexcess, if you are interested in learning a lot of new stuff, you can always check out our Nexcess Knowledge Base, or if you can’t find what you are searching for there, you can always visit the Liquid Web Knowledge Base. 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.
Useful WordPress Language Links
Using the WP-CLI commands for languages is documented in the following articles:
- https://developer.wordpress.org/cli/commands/language/
- https://developer.wordpress.org/cli/commands/language/core/
- https://developer.wordpress.org/cli/commands/language/plugin/
- https://developer.wordpress.org/cli/commands/language/theme/
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
- https://wp-cli.org/#using
- https://help.nexcess.net/74095-wordpress/locating-your-ssh-credentials-in-managed-wordpress-and-managed-woocommerce-hosting
- https://developer.wordpress.org/cli/commands/db/search/
- https://developer.wordpress.org/cli/commands/db/size/
- https://developer.wordpress.org/cli/commands/db/search/#options
- https://make.wordpress.org/cli/handbook/guides/common-issues/
- https://make.wordpress.org/cli/handbook/guides/troubleshooting/
- https://make.wordpress.org/cli/handbook/guides/identify-plugin-theme-conflict/
- https://make.wordpress.org/cli/handbook/contributions/bug-reports/
- https://developer.wordpress.org/cli/commands/cli/info/
- https://developer.wordpress.org/cli/commands/theme/list/
- https://developer.wordpress.org/cli/commands/theme/update/
- https://developer.wordpress.org/cli/commands/plugin/list/
- https://developer.wordpress.org/cli/commands/plugin/update/
- https://help.nexcess.net/74095-wordpress/wordpress-automatic-updates
- https://help.nexcess.net/74095-wordpress/how-to-enable-auto-updates-for-plugins-and-themes
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.
Next Steps?
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.
24-Hour Assistance
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.
Useful YouTube > Nexcess Channel Links
- Nexcess on YouTube - Home
- Nexcess on YouTube - Welcome to Your Nexcess Portal
- Nexcess on YouTube - Featured Videos
- Nexcess on YouTube - All Videos
- Nexcess on YouTube - All Playlists
Resources for More Information
Need more help? The Applications, WooCommerce, and WordPress sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge. Or, check out our related articles below.
New Customers: Fully Managed Hosting Solutions
Not a Nexcess customer yet? Check out our fully managed hosting solutions. The option to chat with an expert is also available.
Related Articles
- 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