1*3e2a3564SAndreas Gohr<?php 2*3e2a3564SAndreas Gohr 3*3e2a3564SAndreas Gohruse dokuwiki\Extension\RemotePlugin; 4*3e2a3564SAndreas Gohruse dokuwiki\Remote\AccessDeniedException; 5*3e2a3564SAndreas Gohr 6*3e2a3564SAndreas Gohr/** 7*3e2a3564SAndreas Gohr * DokuWiki Plugin deeplautotranslate (Remote Component) 8*3e2a3564SAndreas Gohr * 9*3e2a3564SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 10*3e2a3564SAndreas Gohr * @author Andreas Gohr <gohr@cosmocode.de> 11*3e2a3564SAndreas Gohr */ 12*3e2a3564SAndreas Gohrclass remote_plugin_deeplautotranslate extends RemotePlugin 13*3e2a3564SAndreas Gohr{ 14*3e2a3564SAndreas Gohr /** 15*3e2a3564SAndreas Gohr * Create a new translation of the given page in the given language 16*3e2a3564SAndreas Gohr * 17*3e2a3564SAndreas Gohr * @param string $id The page ID 18*3e2a3564SAndreas Gohr * @param string $lang The target language 19*3e2a3564SAndreas Gohr * @return string The page ID of the newly translated page 20*3e2a3564SAndreas Gohr */ 21*3e2a3564SAndreas Gohr public function pushTranslation($id, $lang) 22*3e2a3564SAndreas Gohr { 23*3e2a3564SAndreas Gohr global $ID; 24*3e2a3564SAndreas Gohr global $INFO; 25*3e2a3564SAndreas Gohr $ID = $id; 26*3e2a3564SAndreas Gohr $INFO['exists'] = page_exists($id); 27*3e2a3564SAndreas Gohr 28*3e2a3564SAndreas Gohr 29*3e2a3564SAndreas Gohr /** @var action_plugin_deeplautotranslate $action */ 30*3e2a3564SAndreas Gohr $action = plugin_load('action', 'deeplautotranslate'); 31*3e2a3564SAndreas Gohr 32*3e2a3564SAndreas Gohr $text = rawWiki($id); 33*3e2a3564SAndreas Gohr 34*3e2a3564SAndreas Gohr return $action->push_translate($id, $text, $lang); 35*3e2a3564SAndreas Gohr } 36*3e2a3564SAndreas Gohr} 37