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