How to Localize WordPress with WP-CLI

31. January 2017 Note

If you want to localize WordPress with WP-CLI, you can do like following.

Install Language

At first, install the language file with the following command.

$ wp core language install ja --activate

ja means Japanese, so please change it to your own language.

Change Timezone

If you want to change the timezone, please run following command.

$ timezone=$(wp eval "echo _x( '0', 'default GMT offset or timezone string' );")
$ wp option update timezone_string $timezone

The default timezone of your language is saved in the .mo, so you can get it with wp eval command.

Then if you update timezone_string option, timezone will be updated.

Change Date Format

Finally, change the date format with the following command.

$ date_format=$(wp eval "echo __( 'M jS Y' );")
$ wp option update date_format $date_format

 


Leave a Reply

Your email address will not be published. Required fields are marked *