http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88989

Revision: 88989
Author:   jeroendedauw
Date:     2011-05-27 19:12:28 +0000 (Fri, 27 May 2011)
Log Message:
-----------
1.0.1

Modified Paths:
--------------
    trunk/extensions/LiveTranslate/LiveTranslate.php
    trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
    trunk/extensions/LiveTranslate/RELEASE-NOTES
    trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php
    trunk/extensions/LiveTranslate/includes/LT_LTFParser.php
    trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php

Modified: trunk/extensions/LiveTranslate/LiveTranslate.php
===================================================================
--- trunk/extensions/LiveTranslate/LiveTranslate.php    2011-05-27 18:51:26 UTC 
(rev 88988)
+++ trunk/extensions/LiveTranslate/LiveTranslate.php    2011-05-27 19:12:28 UTC 
(rev 88989)
@@ -24,7 +24,7 @@
        die( 'Not an entry point.' );
 }
 
-define( 'LiveTranslate_VERSION', '1.0' );
+define( 'LiveTranslate_VERSION', '1.0.1' );
 
 $wgExtensionCredits['other'][] = array(
        'path' => __FILE__,

Modified: trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
===================================================================
--- trunk/extensions/LiveTranslate/LiveTranslate_Settings.php   2011-05-27 
18:51:26 UTC (rev 88988)
+++ trunk/extensions/LiveTranslate/LiveTranslate_Settings.php   2011-05-27 
19:12:28 UTC (rev 88989)
@@ -55,3 +55,6 @@
 
 # Show the control for namespaces not specified in 
$egLTNSWithTranslationControl?
 $egLTUnknownNSShowControl = true;
+
+# When true, this prevents storange of translations that are the same in the 
source and target language.
+$egLTRequireSignificance = false;

Modified: trunk/extensions/LiveTranslate/RELEASE-NOTES
===================================================================
--- trunk/extensions/LiveTranslate/RELEASE-NOTES        2011-05-27 18:51:26 UTC 
(rev 88988)
+++ trunk/extensions/LiveTranslate/RELEASE-NOTES        2011-05-27 19:12:28 UTC 
(rev 88989)
@@ -4,6 +4,12 @@
 Latest version of the release notes: 
http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/RELEASE-NOTES?view=co
 
 
+=== Version 1.0.1 ===
+2011-05-27
+
+* Added option (on by default) to store insignificant translations.
+* Tweaked the LTF parser to allow specifying a word that should never be 
translated.
+
 === Version 1.0 ===
 2011-05-26
 

Modified: trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php
===================================================================
--- trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php 
2011-05-27 18:51:26 UTC (rev 88988)
+++ trunk/extensions/LiveTranslate/api/ApiImportTranslationMemories.php 
2011-05-27 19:12:28 UTC (rev 88989)
@@ -96,7 +96,7 @@
                
                // Insert the memory in the db.
                foreach ( $tm->getTranslationUnits() as $tu ) {
-                       if ( !$tu->isSignificant() ) {
+                       if ( $GLOBALS['egLTRequireSignificance'] && 
!$tu->isSignificant() ) {
                                continue;
                        }
                        

Modified: trunk/extensions/LiveTranslate/includes/LT_LTFParser.php
===================================================================
--- trunk/extensions/LiveTranslate/includes/LT_LTFParser.php    2011-05-27 
18:51:26 UTC (rev 88988)
+++ trunk/extensions/LiveTranslate/includes/LT_LTFParser.php    2011-05-27 
19:12:28 UTC (rev 88989)
@@ -29,12 +29,21 @@
                        $values = array_map( 'trim', explode( ',', $line ) );
                        $tu = new LTTMUnit();
                        
-                       foreach ( $values as $nr => $value ) {
-                               if ( array_key_exists( $nr, $languages ) ) {
+                       // If there is only one value, interpret it as "should 
never be translated", and add it for all languages.
+                       if ( count( $values ) == 1 ) {
+                               foreach ( $languages as $language ) {
                                        // Add the translation (or 
translations) (value, array) of the word in the language (key).
-                                       $tu->addVariants( array( 
$languages[$nr] => array_map( 'trim', explode( '|', $value ) ) ) );
+                                       $tu->addVariants( array( $language => 
array_map( 'trim', explode( '|', $values[0] ) ) ) );
                                }
                        }
+                       else {
+                               foreach ( $languages as $nr => $language ) {
+                                       if ( array_key_exists( $nr, $values ) ) 
{
+                                               // Add the translation (or 
translations) (value, array) of the word in the language (key).
+                                               $tu->addVariants( array( 
$language => array_map( 'trim', explode( '|', $values[$nr] ) ) ) );
+                                       }
+                               }
+                       }
                        
                        $tm->addTranslationUnit( $tu );
                }

Modified: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
===================================================================
--- trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php 
2011-05-27 18:51:26 UTC (rev 88988)
+++ trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php 
2011-05-27 19:12:28 UTC (rev 88989)
@@ -65,7 +65,8 @@
         * @return string
         */
        public static function getCurrentLang( Title $title ) {
-               $subPage = array_pop( explode( '/', $title->getSubpageText() ) 
);
+               $subPage = explode( '/', $title->getSubpageText() );
+               $subPage = array_pop( $subPage );
 
                if ( $subPage != '' && array_key_exists( $subPage, 
Language::getLanguageNames( false ) ) ) {
                        return $subPage;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to