r80185 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80184‎ | r80185 | r80186 >
Date:19:17, 13 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Ignore TU nodes in TMX
Modified paths:
  • /trunk/extensions/LiveTranslate/includes/LT_TMXParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/includes/LT_TMXParser.php
@@ -69,6 +69,15 @@
7070 protected $insideSegment;
7171
7272 /**
 73+ * Boolean to keep track of if the XML parser is inside a node that should be ingored.
 74+ *
 75+ * @since 0.4
 76+ *
 77+ * @var boolean
 78+ */
 79+ protected $insideIgnoreNode;
 80+
 81+ /**
7382 * Constructor.
7483 *
7584 * @since 0.4
@@ -135,6 +144,9 @@
136145 $this->currentTranslation = '';
137146 $this->insideSegment = true;
138147 break;
 148+ case 'ut' :
 149+ $this->insideIgnoreNode = true;
 150+ break;
139151 }
140152 }
141153
@@ -160,6 +172,9 @@
161173 case 'seg':
162174 $this->insideSegment = false;
163175 break;
 176+ case 'ut' :
 177+ $this->insideIgnoreNode = false;
 178+ break;
164179 }
165180 }
166181
@@ -172,7 +187,7 @@
173188 * @param string $data The second parameter, data, contains the character data as a string.
174189 */
175190 protected function segmentContentHandler( $parser, $data ) {
176 - if ( $this->insideSegment ) {
 191+ if ( $this->insideSegment && !$this->insideIgnoreNode ) {
177192 $this->currentTranslation .= $data;
178193 }
179194 }

Status & tagging log