Add a new language to Wordpress Admin

The problem

You've installed Wordpress in a language and want to switch to another one, or give the user the freedom to choose.

The solution

Use WP-CLI to do the job.

Tested enviroment

  • Ubuntu 18.04
  • MariaDB
  • Wordpress 5.3.2

The code

Install WP-CLI (PHP-CLI package is a requirement)

sudo apt-install php-cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info

List available languages to get the code:

wp language core list

Add a core language:

wp language core list
wp language core install pt_BR
wp site switch-language pt_BR

To update all downloaded languages:

wp language core update

References