$wp_version )); if ( is_wp_error( $result ) ){ qtranxf_add_warning(__( 'Gettext databases not updated:', 'qtranslate' ) . ' ' . $result->get_error_message()); return false; } set_time_limit(300); $langs = empty($only_for_language) ? $q_config['enabled_languages'] : array($only_for_language); $locales = $q_config['locale']; $errcnt = 0; foreach ( $result['translations'] as $translation ) { $locale = $translation['language']; $lang = null; foreach($langs as $lng) { if(!isset($locales[$lng])){ $locales = qtranxf_language_configured('locale'); if(!isset($locales[$lng])) continue; } if($locales[$lng] != $locale) continue; $lang = $lng; break; } if(!$lang) continue; $translation = (object) $translation; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); $translation->type = 'core'; $result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false )); if ( is_wp_error( $result ) ){ qtranxf_add_warning(sprintf(__( 'Failed to update gettext database for "%s": %s', 'qtranslate' ), $q_config['language_name'][$lang], $result->get_error_message())); ++$errcnt; } } return $errcnt; }