From 78ddec3ac724d78907a20ba74cccb526721f664b Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 18 Jul 2013 18:51:23 +0200 Subject: [PATCH] [-] BO : translation copy is now easier #PSCFV-8886 --- classes/Language.php | 4 ++-- controllers/admin/AdminTranslationsController.php | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/classes/Language.php b/classes/Language.php index 5b4659f70..0228a63ac 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -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; diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 2d34a74d1..784f15c59 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -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.'); }