/**
  * Extracts i18n strings.
  *
  * This class must be implemented by subclasses.
  */
 public function extract()
 {
     // Extract from PHP files to find __() calls in actions/ lib/ and templates/ directories
     $moduleDir = sfConfig::get('sf_app_module_dir') . '/' . $this->module;
     $this->extractFromPhpFiles(array($moduleDir . '/actions', $moduleDir . '/lib', $moduleDir . '/templates'));
     // Extract from generator.yml files
     $generator = $moduleDir . '/config/generator.yml';
     if (file_exists($generator)) {
         $yamlExtractor = new sfI18nYamlGeneratorExtractor();
         $this->updateMessages($yamlExtractor->extract(file_get_contents($generator)));
     }
     // Extract from validate/*.yml files
     $validateFiles = glob($moduleDir . '/validate/*.yml');
     if (is_array($validateFiles)) {
         foreach ($validateFiles as $validateFile) {
             $yamlExtractor = new sfI18nYamlValidateExtractor();
             $this->updateMessages($yamlExtractor->extract(file_get_contents($validateFile)));
         }
     }
 }
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap/unit.php';
$t = new lime_test(3);
// __construct()
$t->diag('__construct()');
$e = new sfI18nYamlGeneratorExtractor();
$t->ok($e instanceof sfI18nExtractorInterface, 'sfI18nYamlGeneratorExtractor implements the sfI18nExtractorInterface interface');
// ->extract();
$t->diag('->extract()');
$content = <<<EOF
generator:
  param:
    config:
      fields:
        name: { name: "Global Field Name", help: "Global Help for Name" }
      list:
        title: List title
        fields:
          name: { name: "List Field Name", help: "List Help for Name" }
      edit:
        title: Edit title
        display:
          NONE: []
/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once(dirname(__FILE__).'/../../../bootstrap/unit.php');

$t = new lime_test(3);

// __construct()
$t->diag('__construct()');
$e = new sfI18nYamlGeneratorExtractor();
$t->ok($e instanceof sfI18nExtractorInterface, 'sfI18nYamlGeneratorExtractor implements the sfI18nExtractorInterface interface');

// ->extract();
$t->diag('->extract()');

$content = <<<EOF
generator:
  param:
    config:
      fields:
        name: { name: "Global Field Name", help: "Global Help for Name" }
      list:
        title: List title
        fields:
          name: { name: "List Field Name", help: "List Help for Name" }