Development

#9153 (sfI18nModuleExtract.class.php always assumes a file based message source)

You must first sign up to be able to contribute.

Ticket #9153 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

sfI18nModuleExtract.class.php always assumes a file based message source

Reported by: daReaper Assigned to: fabien
Priority: minor Milestone: 1.3.9
Component: i18n Version: 1.4.8
Keywords: Cc:
Qualification: Unreviewed

Description

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);
  }

Change History

10/26/10 15:54:12 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [31248]) [1.3, 1.4] fixed sfI18nModuleExtract.class.php always assumes a file based message source (closes #9153 - patch from daReaper)

10/26/10 15:55:00 changed by fabien

  • milestone set to 1.3.9.