Author: fabien
Date: 2010-03-29 11:37:05 +0200 (Mon, 29 Mar 2010)
New Revision: 28848

Modified:
   branches/1.3/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php
   branches/1.4/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php
Log:
[1.3, 1.4] fixed i18n:extract for generator.yml files (closes #8027, patch from 
alcaeus)

Modified: branches/1.3/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php
===================================================================
--- branches/1.3/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php        
2010-03-29 09:09:54 UTC (rev 28847)
+++ branches/1.3/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php        
2010-03-29 09:37:05 UTC (rev 28848)
@@ -31,24 +31,22 @@
 
     $config = sfYaml::load($content);
 
-    if (!isset($config['generator']['param']))
+    if (!isset($config['generator']['param']['config']))
     {
       return array();
     }
 
-    $params = $config['generator']['param'];
+    $params = $config['generator']['param']['config'];
 
     // titles
-    if (isset($params['list']['title']))
+    foreach (array('list', 'edit', 'new') as $section)
     {
-      $this->strings[] = $params['list']['title'];
+      if (isset($params[$section]['title']))
+      {
+        $this->strings[] = $params[$section]['title'];
+      }
     }
 
-    if (isset($params['edit']['title']))
-    {
-      $this->strings[] = $params['edit']['title'];
-    }
-
     // names and help messages
     if (isset($params['fields']))
     {
@@ -65,20 +63,26 @@
       $this->getFromFields($params['edit']['fields']);
     }
 
-    // edit categories
-    if (isset($params['edit']['display']) && 
!isset($params['edit']['display'][0]))
+    if (isset($params['new']['fields']))
     {
-      foreach (array_keys($params['edit']['display']) as $string)
+      $this->getFromFields($params['new']['fields']);
+    }
+
+    // form categories
+    foreach (array('edit', 'new') as $section)
+    {
+      if (isset($params[$section]['display']) && 
!isset($params[$section]['display'][0]))
       {
-        if ('NONE' == $string)
+        foreach (array_keys($params[$section]['display']) as $string)
         {
-          continue;
+          if ('NONE' != $string)
+          {
+            $this->strings[] = $string;
+          }
         }
-
-        $this->strings[] = $string;
       }
     }
-
+  
     return $this->strings;
   }
 
@@ -91,6 +95,11 @@
         $this->strings[] = $options['name'];
       }
 
+      if (isset($options['label']))
+      {
+        $this->strings[] = $options['label'];
+      }
+
       if (isset($options['help']))
       {
         $this->strings[] = $options['help'];

Modified: branches/1.4/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php
===================================================================
--- branches/1.4/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php        
2010-03-29 09:09:54 UTC (rev 28847)
+++ branches/1.4/lib/i18n/extract/sfI18nYamlGeneratorExtractor.class.php        
2010-03-29 09:37:05 UTC (rev 28848)
@@ -31,24 +31,22 @@
 
     $config = sfYaml::load($content);
 
-    if (!isset($config['generator']['param']))
+    if (!isset($config['generator']['param']['config']))
     {
       return array();
     }
 
-    $params = $config['generator']['param'];
+    $params = $config['generator']['param']['config'];
 
     // titles
-    if (isset($params['list']['title']))
+    foreach (array('list', 'edit', 'new') as $section)
     {
-      $this->strings[] = $params['list']['title'];
+      if (isset($params[$section]['title']))
+      {
+        $this->strings[] = $params[$section]['title'];
+      }
     }
 
-    if (isset($params['edit']['title']))
-    {
-      $this->strings[] = $params['edit']['title'];
-    }
-
     // names and help messages
     if (isset($params['fields']))
     {
@@ -65,20 +63,26 @@
       $this->getFromFields($params['edit']['fields']);
     }
 
-    // edit categories
-    if (isset($params['edit']['display']) && 
!isset($params['edit']['display'][0]))
+    if (isset($params['new']['fields']))
     {
-      foreach (array_keys($params['edit']['display']) as $string)
+      $this->getFromFields($params['new']['fields']);
+    }
+
+    // form categories
+    foreach (array('edit', 'new') as $section)
+    {
+      if (isset($params[$section]['display']) && 
!isset($params[$section]['display'][0]))
       {
-        if ('NONE' == $string)
+        foreach (array_keys($params[$section]['display']) as $string)
         {
-          continue;
+          if ('NONE' != $string)
+          {
+            $this->strings[] = $string;
+          }
         }
-
-        $this->strings[] = $string;
       }
     }
-
+  
     return $this->strings;
   }
 
@@ -91,6 +95,11 @@
         $this->strings[] = $options['name'];
       }
 
+      if (isset($options['label']))
+      {
+        $this->strings[] = $options['label'];
+      }
+
       if (isset($options['help']))
       {
         $this->strings[] = $options['help'];

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" 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/symfony-svn?hl=en.

Reply via email to