xref: /plugin/autotranslation/syntax/notrans.php (revision 5fa510d28b6011b7a44f63599b99fa559d67b2b5)
1649de279SAndreas Gohr<?php
2649de279SAndreas Gohr/**
3649de279SAndreas Gohr * Translation Plugin: Simple multilanguage plugin
4649de279SAndreas Gohr *
5649de279SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6649de279SAndreas Gohr * @author     Andreas Gohr <andi@splitbrain.org>
7649de279SAndreas Gohr */
8649de279SAndreas Gohr// must be run within Dokuwiki
9649de279SAndreas Gohrif(!defined('DOKU_INC')) die();
10649de279SAndreas Gohr
11649de279SAndreas Gohrclass syntax_plugin_translation_notrans extends DokuWiki_Syntax_Plugin {
12649de279SAndreas Gohr
13649de279SAndreas Gohr    /**
14649de279SAndreas Gohr     * for th helper plugin
15649de279SAndreas Gohr     */
16649de279SAndreas Gohr    var $hlp = null;
17649de279SAndreas Gohr
18649de279SAndreas Gohr    /**
19649de279SAndreas Gohr     * Constructor. Load helper plugin
20649de279SAndreas Gohr     */
21649de279SAndreas Gohr    function syntax_plugin_translation(){
22649de279SAndreas Gohr        $this->hlp =& plugin_load('helper', 'translation');
23649de279SAndreas Gohr    }
24649de279SAndreas Gohr
25649de279SAndreas Gohr    /**
26649de279SAndreas Gohr     * What kind of syntax are we?
27649de279SAndreas Gohr     */
28649de279SAndreas Gohr    function getType(){
29649de279SAndreas Gohr        return 'substition';
30649de279SAndreas Gohr    }
31649de279SAndreas Gohr
32649de279SAndreas Gohr    /**
33649de279SAndreas Gohr     * Where to sort in?
34649de279SAndreas Gohr     */
35649de279SAndreas Gohr    function getSort(){
36649de279SAndreas Gohr        return 155;
37649de279SAndreas Gohr    }
38649de279SAndreas Gohr
39649de279SAndreas Gohr
40649de279SAndreas Gohr    /**
41649de279SAndreas Gohr     * Connect pattern to lexer
42649de279SAndreas Gohr     */
43649de279SAndreas Gohr    function connectTo($mode) {
44649de279SAndreas Gohr        $this->Lexer->addSpecialPattern('~~NOTRANS~~',$mode,'plugin_translation_notrans');
45649de279SAndreas Gohr    }
46649de279SAndreas Gohr
47649de279SAndreas Gohr
48649de279SAndreas Gohr    /**
49649de279SAndreas Gohr     * Handle the match
50649de279SAndreas Gohr     */
51*5fa510d2SAndreas Gohr    function handle($match, $state, $pos, Doku_Handler $handler){
52649de279SAndreas Gohr        return array('notrans');
53649de279SAndreas Gohr    }
54649de279SAndreas Gohr
55649de279SAndreas Gohr    /**
56649de279SAndreas Gohr     * Create output
57649de279SAndreas Gohr     */
58*5fa510d2SAndreas Gohr    function render($format, Doku_Renderer $renderer, $data) {
59649de279SAndreas Gohr        // store info in metadata
60649de279SAndreas Gohr        if($format == 'metadata'){
61649de279SAndreas Gohr            $renderer->meta['plugin']['translation']['notrans'] = true;
62649de279SAndreas Gohr        }
63649de279SAndreas Gohr        return false;
64649de279SAndreas Gohr    }
65649de279SAndreas Gohr
66649de279SAndreas Gohr    // for backward compatibility
67649de279SAndreas Gohr    function _showTranslations(){
68649de279SAndreas Gohr        return $this->hlp->showTranslations();
69649de279SAndreas Gohr    }
70649de279SAndreas Gohr
71649de279SAndreas Gohr}
72649de279SAndreas Gohr
73649de279SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 :
74