Translation of modules templates files

This commit is contained in:
Franck Allimant
2014-04-21 00:25:34 +02:00
parent 4720c410cb
commit b768d15eac
3 changed files with 22 additions and 13 deletions

View File

@@ -40,6 +40,7 @@ class TranslationsController extends BaseAdminController
);
}
protected function getModuleTemplateNames(Module $module, $template_type) {
$templates =
TemplateHelper::getInstance()->getList(
@@ -119,16 +120,16 @@ class TranslationsController extends BaseAdminController
else {
throw new \InvalidArgumentException("Undefined module template type: '$type'.");
}
$walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
$walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
}
// List front and back office templates defined by this module
$templateArguments['back_office_templates'] =
$this->getModuleTemplateNames($module, TemplateDefinition::BACK_OFFICE);
implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::BACK_OFFICE));
$templateArguments['front_office_templates'] =
$this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE);
implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE));
break;

View File

@@ -116,6 +116,7 @@ class TemplateHelper
// Every subdir of the basedir is supposed to be a template.
$di = new \DirectoryIterator($baseDir);
/** @var \DirectoryIterator $file */
foreach ($di as $file) {
// Ignore 'dot' elements
if ($file->isDot() || ! $file->isDir()) continue;
@@ -169,7 +170,7 @@ class TemplateHelper
$num_texts = 0;
if ($walkMode == self::WALK_MODE_PHP) {
$prefix = '\-\>[\s]*trans[\s]*\(';
$prefix = '\-\>[\s]*trans[\s]*\([\s]*';
$allowed_exts = array('php');
} elseif ($walkMode == self::WALK_MODE_TEMPLATE) {