[-] BO : translation copy is now easier #PSCFV-8886

This commit is contained in:
Damien Metzger
2013-07-18 18:51:37 +02:00
parent a6a700c9d8
commit 78ddec3ac7
2 changed files with 10 additions and 8 deletions
+2 -2
View File
@@ -262,7 +262,7 @@ class LanguageCore extends ObjectModel
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/';
}
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php', 'index.php');
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php');
// Added natives mails files
$mFiles = array(
@@ -297,7 +297,7 @@ class LanguageCore extends ObjectModel
'test.html', 'test.txt',
'voucher.html', 'voucher.txt',
'voucher_new.html', 'voucher_new.txt',
'order_changed.html', 'order_changed.txt', 'index.php'
'order_changed.html', 'order_changed.txt'
);
$number = -1;
@@ -353,13 +353,15 @@ class AdminTranslationsControllerCore extends AdminController
$items = Language::getFilesList($from_lang, $from_theme, $to_lang, $to_theme, false, false, true);
foreach ($items as $source => $dest)
{
$bool &= $this->checkDirAndCreate($dest);
$bool &= @copy($source, $dest);
if (strpos($dest, 'modules') && basename($source) === $from_lang.'.php' && $bool !== false)
$bool &= $this->changeModulesKeyTranslation($dest, $from_theme, $to_theme);
if (!$this->checkDirAndCreate($dest))
$this->errors[] = sprintf($this->l('Impossible to create the directory "%s".'), $dest);
elseif (!copy($source, $dest))
$this->errors[] = sprintf($this->l('Impossible to copy "%s" to "%s".'), $source, $dest);
elseif (strpos($dest, 'modules') && basename($source) === $from_lang.'.php' && $bool !== false)
if (!$this->changeModulesKeyTranslation($dest, $from_theme, $to_theme))
$this->errors[] = sprintf($this->l('Impossible to translate "$dest".'), $dest);
}
if ($bool)
if (!count($this->errors))
$this->redirect(false, 14);
$this->errors[] = $this->l('A part of the data has been copied but some of the language files could not be found.');
}