Author: david
Date: Fri Nov  4 14:56:45 2011
New Revision: 10268

Log:
Use first valid translation (don't overwrite with empty translation)

Modified:
   trunk/lib/task/i18nRectifyTask.class.php

Modified: trunk/lib/task/i18nRectifyTask.class.php
==============================================================================
--- trunk/lib/task/i18nRectifyTask.class.php    Fri Nov  4 14:05:22 2011        
(r10267)
+++ trunk/lib/task/i18nRectifyTask.class.php    Fri Nov  4 14:56:45 2011        
(r10268)
@@ -74,7 +74,14 @@
     $currentMessages = array();
     foreach ($this->i18n->getMessageSource()->read() as $catalogue => 
$translations)
     {
-      $currentMessages += $translations;
+      foreach ($translations as $key => $value)
+      {
+        // Use first message that has a valid translation
+        if (0 < strlen(trim($value[0])) && !isset($currentMessages[$key][0]))
+        {
+          $currentMessages[$key] = $value;
+        }
+      }
     }
 
     // Loop through plugins
@@ -93,7 +100,7 @@
       {
         foreach ($translations as $key => &$value)
         {
-          if (0 == strlen($value[0]) && 0 < strlen($currentMessages[$key][0]))
+          if (0 == strlen(trim($value[0])) && isset($currentMessages[$key]))
           {
             $messageSource->update($key, $currentMessages[$key][0], $value[2]);
           }

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to