Install Language Packs with WP-CLI

I recently had the need to install all of the WordPress core language packs for a multisite network, where I didn’t know which languages would be needed on each site. Installing language packs through the WordPress admin is slow and tedious (as is anything with a GUI).

So I turned to WP-CLI. It allows you to install language packs, but still only one at a time. With a bit of shell magic, though, you can have it loop through all the available languages and install them for you:

wp core language list | grep uninstalled  | awk '{print $1}' | xargs -i wp core language install {}