Author: david
Date: Thu Nov 11 13:24:52 2010
New Revision: 8821
Log:
Extract app + all plugin messages at the same time.
Modified:
trunk/vendor/symfony/lib/i18n/extract/sfI18nApplicationExtract.class.php
trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php
trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php
Modified:
trunk/vendor/symfony/lib/i18n/extract/sfI18nApplicationExtract.class.php
==============================================================================
--- trunk/vendor/symfony/lib/i18n/extract/sfI18nApplicationExtract.class.php
Thu Nov 11 00:02:47 2010 (r8820)
+++ trunk/vendor/symfony/lib/i18n/extract/sfI18nApplicationExtract.class.php
Thu Nov 11 13:24:52 2010 (r8821)
@@ -31,6 +31,16 @@
{
$this->extractObjects[] = new sfI18nModuleExtract($this->i18n,
$this->culture, array('module' => $moduleName));
}
+
+ // Plugins
+ if ($this->parameters['extractPlugins'])
+ {
+ $pluginNames =
sfFinder::type('dir')->maxdepth(0)->relative()->not_name('.')->in(sfConfig::get('sf_plugins_dir'));
+ foreach ($pluginNames as $pluginName)
+ {
+ $this->extractObjects[] = new sfI18nPluginExtract($this->i18n,
$this->culture, array('path' =>
sfConfig::get('sf_plugins_dir').'/'.$pluginName));
+ }
+ }
}
/**
Modified: trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php
==============================================================================
--- trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php Thu Nov
11 00:02:47 2010 (r8820)
+++ trunk/vendor/symfony/lib/i18n/extract/sfI18nPluginExtract.class.php Thu Nov
11 13:24:52 2010 (r8821)
@@ -29,14 +29,14 @@
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->extracts = array();
+ $this->extractObjects = array();
- // Modules
+ // Modules (usually one per plugin)
foreach
(sfFinder::type('dir')->maxdepth(0)->relative()->in($this->parameters['path'].'/modules')
as $name)
{
- $this->extracts[] = new sfI18nModuleExtract($this->i18n, $this->culture,
array('module' => $name, 'path' =>
$this->parameters['path'].'/modules/'.$name));
+ $this->extractObjects[] = new sfI18nModuleExtract($this->i18n,
$this->culture, array('module' => $name, 'path' =>
$this->parameters['path'].'/modules/'.$name));
}
}
@@ -45,18 +45,21 @@
*/
public function extract()
{
- foreach ($this->extracts as $extract)
+ foreach ($this->extractObjects as $extractObject)
{
- $extract->extract();
+ $extractObject->extract();
}
+
+ // Extract from lib files
+ $this->extractFromPhpFiles($this->parameters['path'].'/lib');
}
protected function aggregateMessages($name)
{
$messages = array();
- foreach ($this->extracts as $extract)
+ foreach ($this->extractObjects as $extractObject)
{
- $messages = array_merge($messages, $extract->$name());
+ $messages = array_merge($messages, $extractObject->$name());
}
return array_unique($messages);
Modified: trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php
==============================================================================
--- trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php Thu Nov
11 00:02:47 2010 (r8820)
+++ trunk/vendor/symfony/lib/task/i18n/sfI18nExtractTask.class.php Thu Nov
11 13:24:52 2010 (r8821)
@@ -38,7 +38,7 @@
// http://trac.symfony-project.org/ticket/8352
new sfCommandOption('application', null,
sfCommandOption::PARAMETER_REQUIRED, 'The application name', true),
- new sfCommandOption('plugin', null, sfCommandOption::PARAMETER_REQUIRED,
'The plugin name'),
+ 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'),
@@ -94,11 +94,7 @@
$params = $config['i18n']['param'];
unset($params['cache']);
- $extract = new sfI18nApplicationExtract(new $class($this->configuration,
new sfNoCache(), $params), $arguments['culture']);
- if (isset($options['plugin']))
- {
- $extract = new sfI18nPluginExtract(new $class($this->configuration, new
sfNoCache, $params), $arguments['culture'], array('path' =>
sfConfig::get('sf_plugins_dir').'/'.$options['plugin']));
- }
+ $extract = new sfI18nApplicationExtract(new $class($this->configuration,
new sfNoCache(), $params), $arguments['culture'], array('extractPlugins' =>
!$options['ignore-plugins']));
$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.