1<?php 2 3use dokuwiki\Extension\SyntaxPlugin; 4 5/** 6 * Translation Plugin: Simple multilanguage plugin 7 * 8 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 9 * @author Andreas Gohr <andi@splitbrain.org> 10 */ 11class syntax_plugin_translation_trans extends SyntaxPlugin 12{ 13 /** @inheritdoc */ 14 public function getType() 15 { 16 return 'substition'; 17 } 18 19 /** @inheritdoc */ 20 public function getSort() 21 { 22 return 155; 23 } 24 25 /** @inheritdoc */ 26 public function connectTo($mode) 27 { 28 $this->Lexer->addSpecialPattern('~~TRANS~~', $mode, 'plugin_translation_trans'); 29 } 30 31 /** @inheritdoc */ 32 public function handle($match, $state, $pos, Doku_Handler $handler) 33 { 34 return []; 35 } 36 37 /** @inheritdoc */ 38 public function render($format, Doku_Renderer $renderer, $data) 39 { 40 if ($format != 'xhtml') return false; 41 // disable caching 42 $renderer->nocache(); 43 44 /** @var helper_plugin_translation $hlp */ 45 $hlp = plugin_load('helper', 'translation'); 46 $renderer->doc .= $hlp->showTranslations(); 47 return true; 48 } 49} 50