xref: /plugin/autotranslation/syntax/trans.php (revision 649de279a0f065ebecd2d6d4d613255f87cbdc54)
1*649de279SAndreas Gohr<?php
2*649de279SAndreas Gohr/**
3*649de279SAndreas Gohr * Translation Plugin: Simple multilanguage plugin
4*649de279SAndreas Gohr *
5*649de279SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6*649de279SAndreas Gohr * @author     Andreas Gohr <andi@splitbrain.org>
7*649de279SAndreas Gohr */
8*649de279SAndreas Gohr// must be run within Dokuwiki
9*649de279SAndreas Gohrif(!defined('DOKU_INC')) die();
10*649de279SAndreas Gohr
11*649de279SAndreas Gohrclass syntax_plugin_translation_trans extends DokuWiki_Syntax_Plugin {
12*649de279SAndreas Gohr    /**
13*649de279SAndreas Gohr     * What kind of syntax are we?
14*649de279SAndreas Gohr     */
15*649de279SAndreas Gohr    function getType() {
16*649de279SAndreas Gohr        return 'substition';
17*649de279SAndreas Gohr    }
18*649de279SAndreas Gohr
19*649de279SAndreas Gohr    /**
20*649de279SAndreas Gohr     * Where to sort in?
21*649de279SAndreas Gohr     */
22*649de279SAndreas Gohr    function getSort() {
23*649de279SAndreas Gohr        return 155;
24*649de279SAndreas Gohr    }
25*649de279SAndreas Gohr
26*649de279SAndreas Gohr    /**
27*649de279SAndreas Gohr     * Connect pattern to lexer
28*649de279SAndreas Gohr     */
29*649de279SAndreas Gohr    function connectTo($mode) {
30*649de279SAndreas Gohr        $this->Lexer->addSpecialPattern('~~TRANS~~', $mode, 'plugin_translation_trans');
31*649de279SAndreas Gohr    }
32*649de279SAndreas Gohr
33*649de279SAndreas Gohr    /**
34*649de279SAndreas Gohr     * Handle the match
35*649de279SAndreas Gohr     */
36*649de279SAndreas Gohr    function handle($match, $state, $pos, &$handler) {
37*649de279SAndreas Gohr        return array();
38*649de279SAndreas Gohr    }
39*649de279SAndreas Gohr
40*649de279SAndreas Gohr    /**
41*649de279SAndreas Gohr     * Create output
42*649de279SAndreas Gohr     */
43*649de279SAndreas Gohr    function render($format, &$renderer, $data) {
44*649de279SAndreas Gohr        if($format != 'xhtml') return false;
45*649de279SAndreas Gohr
46*649de279SAndreas Gohr        // disable caching
47*649de279SAndreas Gohr        $renderer->nocache();
48*649de279SAndreas Gohr
49*649de279SAndreas Gohr        /** @var helper_plugin_translation $hlp */
50*649de279SAndreas Gohr        $hlp =  plugin_load('helper', 'translation');
51*649de279SAndreas Gohr        $renderer->doc .= $hlp->showTranslations();
52*649de279SAndreas Gohr        return true;
53*649de279SAndreas Gohr    }
54*649de279SAndreas Gohr
55*649de279SAndreas Gohr}
56*649de279SAndreas Gohr
57*649de279SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 :
58