protected function _request_translations($source_language) { $client = new Lingotek_API(); foreach ($this->pllm->get_languages_list() as $lang) { if ($source_language->slug != $lang->slug && !$this->is_disabled_target($source_language, $lang) && empty($this->translations[$lang->locale])) { $workflow = Lingotek_Model::get_profile_option('workflow_id', $this->type, $source_language, $lang, $this->source); $args = $workflow ? array('workflow_id' => $workflow) : array(); if ($client->request_translation($this->document_id, $lang->lingotek_locale, $args)) { $this->status = 'current'; $this->translations[$lang->locale] = 'pending'; unset($this->desc_array['lingotek']['api_errors']['_request_translations'][$lang->name]); } else { $this->desc_array['lingotek']['api_errors']['_request_translations'][$lang->name] = __('Error requesting translation for ', 'wp-lingotek') . $lang->name . __(' for post ', 'wp-lingotek') . $this->source; } } } $this->save(); }
protected function _request_translations($source_language) { $type_id; $client = new Lingotek_API(); foreach ($this->pllm->get_languages_list() as $lang) { if ($source_language->slug != $lang->slug && !$this->is_disabled_target($source_language, $lang) && empty($this->translations[$lang->locale])) { $workflow = Lingotek_Model::get_profile_option('workflow_id', $this->type, $source_language, $lang, $this->source); $args = $workflow ? array('workflow_id' => $workflow) : array(); if ($this->type == 'string') { $type_id = $this->name; } else { $type_id = $this->source; } // don't change translations to pending if the api call failed if ($client->request_translation($this->document_id, $lang->locale, $args, $type_id)) { $this->status = 'current'; $this->translations[$lang->locale] = 'pending'; } } } $this->save(); }