diff --git a/classes/Language.php b/classes/Language.php
index 8c943a743..0cf5e98e8 100644
--- a/classes/Language.php
+++ b/classes/Language.php
@@ -718,14 +718,18 @@ class LanguageCore extends ObjectModel
else
Language::_copyNoneFlag($insert_id);
- $files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
- $tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
- foreach ($tos as $to)
+ $files_copy = array(
+ '/en.jpg',
+ '/en-default-thickbox_default.jpg',
+ '/en-default-home_default.jpg',
+ '/en-default-large_default.jpg',
+ '/en-default-medium_default.jpg',
+ '/en-default-small_default.jpg',
+ '/en-default-scene_default.jpg'
+ );
+ foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
foreach ($files_copy as $file)
- {
- $name = str_replace('/en', '/'.$iso_code, $file);
- copy(dirname(__FILE__).'/../img/l'.$file, $to.$name);
- }
+ @copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
return true;
}
else
diff --git a/classes/LocalizationPack.php b/classes/LocalizationPack.php
index cf1e0011b..d7629f809 100644
--- a/classes/LocalizationPack.php
+++ b/classes/LocalizationPack.php
@@ -53,9 +53,7 @@ class LocalizationPackCore
$res &= $this->installConfiguration($xml);
$res &= $this->installModules($xml);
$res &= $this->updateDefaultGroupDisplayMethod($xml);
-
- if (!defined('_PS_MODE_DEV_') || !_PS_MODE_DEV_)
- $res &= $this->_installLanguages($xml, $install_mode);
+ $res &= $this->_installLanguages($xml, $install_mode);
if ($res && isset($this->iso_code_lang))
{
@@ -158,9 +156,9 @@ class LocalizationPackCore
$tax->rate = (float)$attributes['rate'];
$tax->active = 1;
- if (!$tax->validateFields())
+ if ($error = $tax->validateFields(false, true) || $error = $tax->validateFieldsLang(false, true))
{
- $this->_errors[] = Tools::displayError('Invalid tax properties.');
+ $this->_errors[] = Tools::displayError('Invalid tax properties.').' '.$error;
return false;
}
@@ -301,44 +299,40 @@ class LocalizationPackCore
$native_iso_code = array();
foreach ($native_lang as $lang)
$native_iso_code[] = $lang['iso_code'];
- if ((in_array((string)$attributes['iso_code'], $native_iso_code) && !$install_mode)
- || !in_array((string)$attributes['iso_code'], $native_iso_code))
+ // if we are not in an installation context or if the pack is not available in the local directory
+ if (!$install_mode || !in_array((string)$attributes['iso_code'], $native_iso_code))
+ {
$errno = 0;
$errstr = '';
- if (@fsockopen('api.prestashop.com', 80, $errno, $errstr, 10))
+ if (!@fsockopen('api.prestashop.com', 80, $errno, $errstr, 5))
+ $this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
+ elseif (!($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code']))))
+ $this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
+ elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
{
- if ($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code'])))
+ $file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
+ if (file_put_contents($file, $content))
{
- if ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
+ $gz = new Archive_Tar($file, true);
+
+ if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
{
- $file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
- if (file_put_contents($file, $content))
- {
- $gz = new Archive_Tar($file, true);
-
- if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
- {
- $this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
- return false;
- }
-
- if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
- {
- $this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
- return false;
- }
-
- @unlink($file);
- }
- else
- $this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
+ $this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
+ return false;
}
+
+ if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
+ {
+ $this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
+ return false;
+ }
+
+ @unlink($file);
}
else
- $this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
+ $this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
}
- else
- $this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
+ }
}
// change the default language if there is only one language in the localization pack
diff --git a/localization/ua.xml b/localization/ua.xml
index 570dbee03..6a4e7e30a 100644
--- a/localization/ua.xml
+++ b/localization/ua.xml
@@ -1,23 +1,52 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+