diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 7c4d18ce9..ec7f70738 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; // Parse this content - $matches = $this->userParseFile($content, $this->type_selected, $type_file); + $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name); // Write each translation on its module file $template_name = substr(basename($file), 0, -4); @@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; // Parse this content - $matches = $this->userParseFile($content, $this->type_selected, $type_file); + $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name); // Write each translation on its module file $template_name = substr(basename($file), 0, -4); @@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController * @param $content * @param $type_translation : front, back, errors, modules... * @param string|bool $type_file : (tpl|php) + * @param string $module_name : name of the module * @return return $matches */ - protected function userParseFile($content, $type_translation, $type_file = false) + protected function userParseFile($content, $type_translation, $type_file = false, $module_name = '') { switch ($type_translation) { @@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController if ($type_file == 'php') $regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U'; else - $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"](\s*sprintf=.*)?(\s*mod=\'.+\')?(\s*js=1)?\s*\}/U'; + // In tpl file look for something that should contain mod='module_name' according to the documentation + $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"].*\s+mod=\''.$module_name.'\'.*\}/U'; break; case 'pdf':