I'm trying to create my own message source based on MySQL, but I ran into a problem when trying to extract i18n from the command line. Even though in my factories.yml I have configured I18n as follows:
i18n:
param:
source: SitDB
which works fine when displaying pages, sfI18nModuleExtract.class.php always sets the MessageSource? to sfMessageSource_Aggregate. Here's why:
public function setMessageSource($dirs, $culture = null)
{
if (null === $dirs)
{
$this->messageSource = $this->createMessageSource();
}
else
{
$this->messageSource = sfMessageSource::factory('Aggregate', array_map(array($this, 'createMessageSource'), $dirs));
}
[...]
Most methods calling this method check if the MessageSource? is file based, before sending the "$dirs" argument, however, in sfI18nModuleExtract.class.php it says:
public function configure()
{
if (!isset($this->parameters['module']))
{
throw new sfException('You must give a "module" parameter when extracting for a module.');
}
$this->module = $this->parameters['module'];
$this->i18n->setMessageSource($this->i18n->getConfiguration()->getI18NDirs($this->module), $this->culture);
}
This should be:
public function configure()
{
if (!isset($this->parameters['module']))
{
throw new sfException('You must give a "module" parameter when extracting for a module.');
}
$this->module = $this->parameters['module'];
$options = $this->i18n->getOptions();
$dirs = ($this->i18n->isMessageSourceFileBased($options['source'])) ? $this->i18n->getConfiguration()->getI18NDirs($this->module) : null;
$this->i18n->setMessageSource($dirs, $this->culture);
}