Author: david
Date: Fri Nov 12 10:50:16 2010
New Revision: 8832

Log:
Use local message source for sfI18nPluginExtract to avoid issues with resetting 
global i18n->messageSource.

Modified:
   trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php

Modified: trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php
==============================================================================
--- trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php Fri Nov 
12 10:18:41 2010        (r8831)
+++ trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php Fri Nov 
12 10:50:16 2010        (r8832)
@@ -29,15 +29,18 @@
       throw new sfException('You must give a "path" parameter when extracting 
for a plugin.');
     }
 
-    $this->i18n->setMessageSource(array($this->parameters['path'].'/i18n'), 
$this->culture);
-
-    $this->extractObjects = array();
+    $this->setMessageSource();
+  }
 
-    // Modules (usually one per plugin)
-    foreach 
(sfFinder::type('dir')->maxdepth(0)->relative()->in($this->parameters['path'].'/modules')
 as $name)
-    {
-      $this->extractObjects[] = new sfI18nModuleExtract($this->i18n, 
$this->culture, array('module' => $name, 'path' => 
$this->parameters['path'].'/modules/'.$name));
-    }
+  /**
+   * Use local plugin messageSource
+   */
+  protected function setMessageSource()
+  {
+    $opt = $this->i18n->getOptions();
+    $this->messageSource = sfMessageSource::factory($opt['source'], 
$this->parameters['path'].'/i18n');
+    $this->messageSource->setCulture($this->culture);
+    $this->messageSource->load();
   }
 
   /**
@@ -45,39 +48,31 @@
    */
   public function extract()
   {
-    foreach ($this->extractObjects as $extractObject)
+    foreach 
(sfFinder::type('dir')->maxdepth(0)->relative()->in($this->parameters['path'].'/modules')
 as $moduleName)
     {
-      $extractObject->extract();
+      $this->extractFromPhpFiles(array(
+        $this->parameters['path'].'/'.$moduleName.'/actions',
+        $this->parameters['path'].'/'.$moduleName.'/lib',
+        $this->parameters['path'].'/'.$moduleName.'/templates',
+      ));
     }
 
     // Extract from lib files
     $this->extractFromPhpFiles($this->parameters['path'].'/lib');
   }
 
-  protected function aggregateMessages($name)
-  {
-    $messages = array();
-    foreach ($this->extractObjects as $extractObject)
-    {
-      $messages = array_merge($messages, $extractObject->$name());
-    }
-
-    return array_unique($messages);
-  }
-
-  /**
-   * @see sfI18nExtract
-   */
-  public function getCurrentMessages()
-  {
-    return $this->aggregateMessages('getCurrentMessages');
-  }
-
   /**
    * @see sfI18nExtract
    */
-  public function getAllSeenMessages()
+  protected function loadCurrentMessages()
   {
-    return $this->aggregateMessages('getAllSeenMessages');
+    $this->currentMessages = array();
+    foreach ($this->messageSource->read() as $catalogue => $translations)
+    {
+      foreach ($translations as $key => $values)
+      {
+        $this->currentMessages[] = $key;
+      }
+    }
   }
 }

-- 
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