// Add tabs file when add a new language

This commit is contained in:
lLefevre
2012-07-04 09:47:24 +00:00
parent 80c47e9eee
commit 37d60956fa
+15 -2
View File
@@ -83,6 +83,7 @@ class LanguageCore extends ObjectModel
'errors' => '_ERRORS', 'errors' => '_ERRORS',
'admin' => '_LANGADM', 'admin' => '_LANGADM',
'pdf' => '_LANGPDF', 'pdf' => '_LANGPDF',
'tabs' => 'tabs',
); );
public function __construct($id = null, $id_lang = null) public function __construct($id = null, $id_lang = null)
@@ -113,11 +114,23 @@ class LanguageCore extends ObjectModel
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code)) if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code); mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
foreach ($this->translationsFilesAndVars as $file => $var) foreach ($this->translationsFilesAndVars as $file => $var)
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php')) {
file_put_contents(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php', '<?php $path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
if (!file_exists($path_file))
if ($file != 'tabs')
file_put_contents($path_file, '<?php
global $'.$var.'; global $'.$var.';
$'.$var.' = array(); $'.$var.' = array();
?>'); ?>');
else
file_put_contents($path_file, '<?php
$'.$var.' = array();
return $'.$var.';
?>');
@chmod($path_file, 0777);
}
} }
/** /**