r89827 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89826‎ | r89827 | r89828 >
Date:15:37, 10 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added support for comments in the LTF
Modified paths:
  • /trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/LT_LTFParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/includes/LT_LTFParser.php
@@ -22,10 +22,24 @@
2323
2424 $translationSets = array();
2525
 26+ $text = preg_replace( '/\\<!--([^(--\\>)]*)--\\>/', '', $text );
2627 $lines = explode( "\n", $text );
27 - $languages = array_map( 'trim', explode( ',', array_shift( $lines ) ) );
2828
 29+ while ( true ) {
 30+ $languages = array_shift( $lines );
 31+
 32+ if ( trim( $languages ) != '' ) {
 33+ break;
 34+ }
 35+ }
 36+
 37+ $languages = array_map( 'trim', explode( ',', $languages ) );
 38+
2939 foreach ( $lines as $line ) {
 40+ if ( trim( $line ) == '' ) {
 41+ continue;
 42+ }
 43+
3044 $values = array_map( 'trim', explode( ',', $line ) );
3145 $tu = new LTTMUnit();
3246
Index: trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php
@@ -47,7 +47,7 @@
4848 );
4949
5050 foreach ( $res as $tm ) {
51 - if ( $tm->memory_local != "0" ) {
 51+ if ( $tm->memory_local != '0' ) {
5252 // Obtain the contents of the article.
5353 $title = Title::newFromText( $location, NS_MAIN );
5454

Status & tagging log