xref: /plugin/autotranslation/syntax/notrans.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_notrans extends DokuWiki_Syntax_Plugin {
12*649de279SAndreas Gohr
13*649de279SAndreas Gohr    /**
14*649de279SAndreas Gohr     * for th helper plugin
15*649de279SAndreas Gohr     */
16*649de279SAndreas Gohr    var $hlp = null;
17*649de279SAndreas Gohr
18*649de279SAndreas Gohr    /**
19*649de279SAndreas Gohr     * Constructor. Load helper plugin
20*649de279SAndreas Gohr     */
21*649de279SAndreas Gohr    function syntax_plugin_translation(){
22*649de279SAndreas Gohr        $this->hlp =& plugin_load('helper', 'translation');
23*649de279SAndreas Gohr    }
24*649de279SAndreas Gohr
25*649de279SAndreas Gohr    /**
26*649de279SAndreas Gohr     * What kind of syntax are we?
27*649de279SAndreas Gohr     */
28*649de279SAndreas Gohr    function getType(){
29*649de279SAndreas Gohr        return 'substition';
30*649de279SAndreas Gohr    }
31*649de279SAndreas Gohr
32*649de279SAndreas Gohr    /**
33*649de279SAndreas Gohr     * Where to sort in?
34*649de279SAndreas Gohr     */
35*649de279SAndreas Gohr    function getSort(){
36*649de279SAndreas Gohr        return 155;
37*649de279SAndreas Gohr    }
38*649de279SAndreas Gohr
39*649de279SAndreas Gohr
40*649de279SAndreas Gohr    /**
41*649de279SAndreas Gohr     * Connect pattern to lexer
42*649de279SAndreas Gohr     */
43*649de279SAndreas Gohr    function connectTo($mode) {
44*649de279SAndreas Gohr        $this->Lexer->addSpecialPattern('~~NOTRANS~~',$mode,'plugin_translation_notrans');
45*649de279SAndreas Gohr    }
46*649de279SAndreas Gohr
47*649de279SAndreas Gohr
48*649de279SAndreas Gohr    /**
49*649de279SAndreas Gohr     * Handle the match
50*649de279SAndreas Gohr     */
51*649de279SAndreas Gohr    function handle($match, $state, $pos, &$handler){
52*649de279SAndreas Gohr        return array('notrans');
53*649de279SAndreas Gohr    }
54*649de279SAndreas Gohr
55*649de279SAndreas Gohr    /**
56*649de279SAndreas Gohr     * Create output
57*649de279SAndreas Gohr     */
58*649de279SAndreas Gohr    function render($format, &$renderer, $data) {
59*649de279SAndreas Gohr        // store info in metadata
60*649de279SAndreas Gohr        if($format == 'metadata'){
61*649de279SAndreas Gohr            $renderer->meta['plugin']['translation']['notrans'] = true;
62*649de279SAndreas Gohr        }
63*649de279SAndreas Gohr        return false;
64*649de279SAndreas Gohr    }
65*649de279SAndreas Gohr
66*649de279SAndreas Gohr    // for backward compatibility
67*649de279SAndreas Gohr    function _showTranslations(){
68*649de279SAndreas Gohr        return $this->hlp->showTranslations();
69*649de279SAndreas Gohr    }
70*649de279SAndreas Gohr
71*649de279SAndreas Gohr}
72*649de279SAndreas Gohr
73*649de279SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 :
74