[dokuwiki] Google translate...

  • From: Robin Getz <rgetz@xxxxxxxxxxxxxxxxxxxx>
  • To: DokuWiki Mailinglist <dokuwiki@xxxxxxxxxxxxx>
  • Date: Fri, 22 Oct 2010 10:11:46 -0400

I have been playing with google translate on dokuwiki, and noticed
that I don't like my C code translated (it doesn't compile very well
afterwards...)

This makes sure that google translate doesn't translate things 
in the code class.

The "notranslate" is described in "General information for webmasters"
http://translate.google.com/support/?hl=en

Any other suggestions on how to do this without whacking common code
is appreciated.

-Robin


diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 1732445..4009be6 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -409,7 +409,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
     }

     function preformatted($text) {
-        $this->doc .= '<pre class="code">' . 
trim($this->_xmlEntities($text),"\n\r") . '</pre>'. DOKU_LF;
+        $this->doc .= '<pre class="notranslate" class="code">' . 
trim($this->_xmlEntities($text),"\n\r") . '</pre>'. DOKU_LF;
     }

     function file($text, $language=null, $filename=null) {
@@ -450,9 +450,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         }

         if ( is_null($language) ) {
-            $this->doc .= '<pre 
class="'.$type.'">'.$this->_xmlEntities($text).'</pre>'.DOKU_LF;
+            $this->doc .= '<pre class="notranslate" 
class="'.$type.'">'.$this->_xmlEntities($text).'</pre>'.DOKU_LF;
         } else {
-            $class = 'code'; //we always need the code class to make the 
syntax highlighting apply
+            $class = 'notranslate code'; //we always need the code class to 
make the syntax highlighting apply
             if($type != 'code') $class .= ' '.$type;

             $this->doc .= "<pre class=\"$class 
$language\">".p_xhtml_cached_geshi($text, $language, '').'</pre>'.DOKU_LF;


-------------------------------------------------------
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: