Home:ALL Converter>Changing wordpress language through API

Changing wordpress language through API

Ask Time:2015-03-25T17:33:21         Author:Damiano Barbati

Json Formatter

I need to deploy sixteen wordpress instances at once and nope, wordpress network is not an option.

I'm trying to customize each instance language programmatically after its deploy. I managed to customize anything else I need.

Neither of these solutions seem to work:

  1. set $locale="es_ES" in wp-config.php
  2. update_option("WPLANG", "es_ES") //return false
  3. update_blog_option(1, "WPLANG", "es_ES") //return false
  4. update_site_option("WPLANG", "es_ES") //just for network, but at least returns true but setting wplang option to null

Language keeps being the default english. Any solution?

EDIT:

Kevin was actually right. You need to:

1) Download the correct language pack (.mo files) from http://wpcentral.io/internationalization/

2) update wp_options set option_value = "de_DE" where option_name = "wplang";

I thought I need not to download anything since you can set any language in the admin panel, but digging in the code I found out that wordpress is download files under the scenes.

Author:Damiano Barbati,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29251920/changing-wordpress-language-through-api
yy