/** * Sets the remote target languages before committing the basket to a translation service. * * @param array $remote_languages */ function set_remote_target_languages($remote_languages) { TranslationProxy_Basket::set_remote_target_languages($remote_languages); }
/** * Sends all jobs from basket in batch mode to translation proxy * * @param array $data POST data * * @return bool Returns false in case of errors (read from TranslationManagement::get_messages('error') to get errors details) */ function send_all_jobs($data) { if (!isset($data) || !is_array($data)) { return false; } // 1. get wp_option with basket $basket_name = TranslationProxy_Basket::get_basket_name(); if (!$basket_name) { $basket_name = isset($data['basket_name']) ? $data['basket_name'] : false; if ($basket_name) { TranslationProxy_Basket::set_basket_name($basket_name); } } $this->set_translation_jobs_basket($data); // check if we have local and remote translators $translators = isset($data['translators']) ? $data['translators'] : array(); // find all target languages for remote service (it is required to create proper batch in translation proxy) $this->set_remote_target_languages($translators); // save information about target languages for remote service TranslationProxy_Basket::set_remote_target_languages($this->remote_target_languages); $basket_items_types = TranslationProxy_Basket::get_basket_items_types(); foreach ($basket_items_types as $item_type_name => $item_type) { $type_basket_items = array(); if (isset($this->translation_jobs_basket[$item_type_name])) { $type_basket_items = $this->translation_jobs_basket[$item_type_name]; } do_action('wpml_tm_send_' . $item_type_name . '_jobs', $item_type_name, $item_type, $type_basket_items, $translators, $basket_name); } // check if there were no errors return !$this->messages_by_type('error'); }