コード例 #1
0
 function process_translated_string($translation_proxy_job_id, $language)
 {
     $project = TranslationProxy::get_current_project();
     $translation = $project->fetch_translation($translation_proxy_job_id);
     $translation = apply_filters('icl_data_from_pro_translation', $translation);
     $ret = false;
     $xliff = new WPML_TM_xliff();
     $translation = $xliff->get_strings_xliff_translation($translation);
     if ($translation) {
         $ret = icl_translation_add_string_translation($translation_proxy_job_id, $translation, $language);
         if ($ret) {
             $project->update_job($translation_proxy_job_id);
         }
     }
     return $ret;
 }
コード例 #2
0
 function process_translated_string($request_id, $language)
 {
     global $sitepress_settings, $wpdb, $sitepress;
     $ret = false;
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $translation = $iclq->cms_do_download($request_id, $language);
     if ($translation) {
         $ret = icl_translation_add_string_translation($request_id, $translation, $sitepress->get_language_code($this->server_languages_map($language, true)));
         if ($ret) {
             $iclq->cms_update_request_status($request_id, CMS_TARGET_LANGUAGE_DONE, $language);
         }
     }
     // if there aren't any other unfullfilled requests send a global 'done'
     if (0 == $wpdb->get_var("SELECT COUNT(rid) FROM {$wpdb->prefix}icl_core_status WHERE rid='{$request_id}' AND status < " . CMS_TARGET_LANGUAGE_DONE)) {
         $iclq->cms_update_request_status($request_id, CMS_REQUEST_DONE, false);
     }
     return $ret;
 }
コード例 #3
0
 private function process_translated_string($translation_proxy_job_id, $language)
 {
     $project = TranslationProxy::get_current_project();
     $translation = $project->fetch_translation($translation_proxy_job_id);
     $translation = apply_filters('icl_data_from_pro_translation', $translation);
     $ret = false;
     $translation = $this->xliff_reader_factory->string_xliff_reader()->get_data($translation);
     if ($translation) {
         $ret = icl_translation_add_string_translation($translation_proxy_job_id, $translation, $language);
         if ($ret) {
             $project->update_job($translation_proxy_job_id);
         }
     }
     return $ret;
 }