[-] BO : don't show unecessary tpl module translations - complience with documentation
This commit is contained in:
@@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||||
|
|
||||||
// Parse this content
|
// 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
|
// Write each translation on its module file
|
||||||
$template_name = substr(basename($file), 0, -4);
|
$template_name = substr(basename($file), 0, -4);
|
||||||
@@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||||
|
|
||||||
// Parse this content
|
// 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
|
// Write each translation on its module file
|
||||||
$template_name = substr(basename($file), 0, -4);
|
$template_name = substr(basename($file), 0, -4);
|
||||||
@@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
* @param $content
|
* @param $content
|
||||||
* @param $type_translation : front, back, errors, modules...
|
* @param $type_translation : front, back, errors, modules...
|
||||||
* @param string|bool $type_file : (tpl|php)
|
* @param string|bool $type_file : (tpl|php)
|
||||||
|
* @param string $module_name : name of the module
|
||||||
* @return return $matches
|
* @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)
|
switch ($type_translation)
|
||||||
{
|
{
|
||||||
@@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
if ($type_file == 'php')
|
if ($type_file == 'php')
|
||||||
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
||||||
else
|
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;
|
break;
|
||||||
|
|
||||||
case 'pdf':
|
case 'pdf':
|
||||||
|
|||||||
Reference in New Issue
Block a user