[*] LO : 1.5 Localization Pack

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12197 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fBrignoli
2012-01-05 14:58:05 +00:00
parent a880921e7a
commit db989ce7d7
2 changed files with 20 additions and 6 deletions
@@ -99,9 +99,14 @@ class AdminLocalizationControllerCore extends AdminController
{ {
if (Tools::isSubmit('submitLocalizationPack')) if (Tools::isSubmit('submitLocalizationPack'))
{ {
$pack = @Tools::file_get_contents('http://api.prestashop.com/download/localization/'.Tools::getValue('iso_localization_pack').'.xml'); $version = str_replace('.', '', _PS_VERSION_);
if (!$pack || !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml'))) $version = substr($version, 0, 2);
$pack = @Tools::file_get_contents('http://api.prestashop.com/download/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml');
if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml')))
$this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")'); $this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
if (!$selection = Tools::getValue('selection')) if (!$selection = Tools::getValue('selection'))
$this->_errors[] = Tools::displayError('Please select at least one content item to import.'); $this->_errors[] = Tools::displayError('Please select at least one content item to import.');
else else
+13 -4
View File
@@ -377,12 +377,21 @@ class InstallModelInstall extends InstallAbstractModel
} }
// Set localization configuration // Set localization configuration
$localization_file = _PS_ROOT_DIR_.'/localization/default.xml'; $version = str_replace('.', '', _PS_VERSION_);
if (file_exists(_PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml')) $version = substr($version, 0, 2);
$localization_file = _PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml';
$localization_file_content = @Tools::file_get_contents('http://api.prestashop.com/download/localization/'.$version.'/'.$data['shop_country'].'.xml');
if (!$localization_file_content)
{
$localization_file = _PS_ROOT_DIR_.'/localization/default.xml';
if (file_exists(_PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml'))
$localization_file = _PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml';
$localization_file_content = file_get_contents($localization_file);
}
$locale = new LocalizationPackCore(); $locale = new LocalizationPackCore();
$locale->loadLocalisationPack(file_get_contents($localization_file), '', true); $locale->loadLocalisationPack($localization_file_content, '', true);
// Create default employee // Create default employee
if (isset($data['admin_firstname']) && isset($data['admin_lastname']) && isset($data['admin_password']) && isset($data['admin_email'])) if (isset($data['admin_firstname']) && isset($data['admin_lastname']) && isset($data['admin_password']) && isset($data['admin_email']))