Author: david
Date: Thu Nov 11 14:40:43 2010
New Revision: 8822

Log:
Add separate i18n extract task for plugins.

Added:
   trunk/vendor/symfony/lib/task/i18n/sfI18nPluginExtractTask.class.php   
(contents, props changed)
      - copied, changed from r8821, 
trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php
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 Thu Nov 
11 13:24:52 2010        (r8821)
+++ trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php Thu Nov 
11 14:40:43 2010        (r8822)
@@ -29,7 +29,7 @@
       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->i18n->setMessageSource(array($this->parameters['path'].'/i18n'), 
$this->culture);
 
     $this->extractObjects = array();
 

Copied and modified: 
trunk/vendor/symfony/lib/task/i18n/sfI18nPluginExtractTask.class.php (from 
r8821, trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php)
==============================================================================
--- trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php      Thu Nov 
11 13:24:52 2010        (r8821, copy source)
+++ trunk/vendor/symfony/lib/task/i18n/sfI18nPluginExtractTask.class.php        
Thu Nov 11 14:40:43 2010        (r8822)
@@ -19,10 +19,10 @@
  *
  * @package    symfony
  * @subpackage task
- * @author     Fabien Potencier <[email protected]>
+ * @author     David Juhasz <[email protected]>
  * @version    SVN: $Id: sfI18nExtractTask.class.php 9883 2008-06-26 09:04:13Z 
FabianLange $
  */
-class sfI18nExtractTask extends sfBaseTask
+class sfI18nExtractPluginTask extends sfBaseTask
 {
   /**
    * @see sfTask
@@ -30,7 +30,8 @@
   protected function configure()
   {
     $this->addArguments(array(
-      new sfCommandArgument('culture', sfCommandArgument::REQUIRED, 'The 
target culture'),
+      new sfCommandArgument('plugin', sfCommandArgument::REQUIRED, 'The plugin 
name'),
+      new sfCommandArgument('culture', sfCommandArgument::REQUIRED, 'The 
target culture')
     ));
 
     $this->addOptions(array(
@@ -38,7 +39,6 @@
       // http://trac.symfony-project.org/ticket/8352
       new sfCommandOption('application', null, 
sfCommandOption::PARAMETER_REQUIRED, 'The application name', true),
 
-      new sfCommandOption('ignore-plugins', null, 
sfCommandOption::PARAMETER_NONE, 'Don\'t extract strings in plugin files'),
       new sfCommandOption('display-new', null, 
sfCommandOption::PARAMETER_NONE, 'Output all new found strings'),
       new sfCommandOption('display-old', null, 
sfCommandOption::PARAMETER_NONE, 'Output all old strings'),
       new sfCommandOption('auto-save', null, sfCommandOption::PARAMETER_NONE, 
'Save the new strings'),
@@ -46,37 +46,37 @@
     ));
 
     $this->namespace = 'i18n';
-    $this->name = 'extract';
-    $this->briefDescription = 'Extracts i18n strings from php files';
+    $this->name = 'extractPlugin';
+    $this->briefDescription = 'Extracts i18n strings for a plugin from php 
files';
 
     $this->detailedDescription = <<<EOF
-The [i18n:extract|INFO] task extracts i18n strings from your project files
-for the given application and target culture:
+The [i18n:extractPlugin sfPluginName|INFO] task extracts i18n strings from 
your project files
+for the given plugin and target culture:
 
-  [./symfony i18n:extract fr|INFO]
+  [./symfony i18n:extractPlugin sfPluginName fr|INFO]
 
 By default, the task only displays the number of new and old strings
 it found in the current project.
 
 If you want to display the new strings, use the [--display-new|COMMENT] option:
 
-  [./symfony i18n:extract --display-new fr|INFO]
+  [./symfony i18n:extractPlugin sfPluginName --display-new fr|INFO]
 
 To save them in the i18n message catalogue, use the [--auto-save|COMMENT] 
option:
 
-  [./symfony i18n:extract --auto-save fr|INFO]
+  [./symfony i18n:extractPlugin sfPluginName --auto-save fr|INFO]
 
 If you want to display strings that are present in the i18n messages
-catalogue but are not found in the application, use the 
+catalogue but are not found in the plugin, use the 
 [--display-old|COMMENT] option:
 
-  [./symfony i18n:extract --display-old fr|INFO]
+  [./symfony i18n:extractPlugin sfPluginName --display-old fr|INFO]
 
 To automatically delete old strings, use the [--auto-delete|COMMENT] but
 be careful, especially if you have translations for plugins as they will
 appear as old strings but they are not:
 
-  [./symfony i18n:extract --auto-delete fr|INFO]
+  [./symfony i18n:extractPlugin sfPluginName --auto-delete fr|INFO]
 EOF;
   }
 
@@ -85,7 +85,13 @@
    */
   public function execute($arguments = array(), $options = array())
   {
-    $this->logSection('i18n', sprintf('extracting i18n strings for the "%s" 
application', $options['application']));
+    $path = sfConfig::get('sf_plugins_dir').'/'.$arguments['plugin'];
+    if (!is_dir($path))
+    {
+      throw new sfException('The plugin you specified is not valid.');
+    }
+
+    $this->logSection('i18n', sprintf('extracting i18n strings for the "%s" 
plugin', $arguments['plugin']));
 
     // get i18n configuration from factories.yml
     $config = 
sfFactoryConfigHandler::getConfiguration($this->configuration->getConfigPaths('config/factories.yml'));
@@ -94,7 +100,7 @@
     $params = $config['i18n']['param'];
     unset($params['cache']);
 
-    $extract = new sfI18nApplicationExtract(new $class($this->configuration, 
new sfNoCache(), $params), $arguments['culture'], array('extractPlugins' => 
!$options['ignore-plugins']));
+    $extract = new sfI18nPluginExtract(new $class($this->configuration, new 
sfNoCache(), $params), $arguments['culture'], array('path' => $path));
 
     $extract->extract();
 

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