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

This commit is contained in:
Damien Metzger committed 2013-07-18 18:51:37 +02:00
1 parent a6a700c9d8
commit 78ddec3ac7
2 files changed
+10 -8

No files matched your search

+2 -2
View File
@@ -262,7 +262,7 @@ class LanguageCore extends ObjectModel
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/'; $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 // Added natives mails files
$mFiles = array( $mFiles = array(
@@ -297,7 +297,7 @@ class LanguageCore extends ObjectModel
'test.html', 'test.txt', 'test.html', 'test.txt',
'voucher.html', 'voucher.txt', 'voucher.html', 'voucher.txt',
'voucher_new.html', 'voucher_new.txt', 'voucher_new.html', 'voucher_new.txt',
'order_changed.html', 'order_changed.txt', 'index.php' 'order_changed.html', 'order_changed.txt'
); );
$number = -1; $number = -1;
@@ -353,13 +353,15 @@ class AdminTranslationsControllerCore extends AdminController
$items = Language::getFilesList($from_lang, $from_theme, $to_lang, $to_theme, false, false, true); $items = Language::getFilesList($from_lang, $from_theme, $to_lang, $to_theme, false, false, true);
foreach ($items as $source => $dest) foreach ($items as $source => $dest)
{ {
$bool &= $this->checkDirAndCreate($dest); if (!$this->checkDirAndCreate($dest))
$bool &= @copy($source, $dest); $this->errors[] = sprintf($this->l('Impossible to create the directory "%s".'), $dest);
elseif (!copy($source, $dest))
if (strpos($dest, 'modules') && basename($source) === $from_lang.'.php' && $bool !== false) $this->errors[] = sprintf($this->l('Impossible to copy "%s" to "%s".'), $source, $dest);
$bool &= $this->changeModulesKeyTranslation($dest, $from_theme, $to_theme); 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->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.'); $this->errors[] = $this->l('A part of the data has been copied but some of the language files could not be found.');
} }