// Installer can be translated at /install-dev/dev/translate.php

This commit is contained in:
Damien Metzger
2013-02-27 14:53:51 +01:00
parent cf249aa2dc
commit 52435c2fad
10 changed files with 341 additions and 241 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ a.module_toggle_all{color: #268CCD;}
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:500;} div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:500;width:90% !important;margin:auto}
/*button upload files*/ /*button upload files*/
#content .qq-upload-button { #content .qq-upload-button {
+2 -2
View File
@@ -2232,7 +2232,7 @@ exit;
$filtered_files = array(); $filtered_files = array();
$real_ext = ''; $real_ext = false;
if (!empty($ext)) if (!empty($ext))
$real_ext = '.'.$ext; $real_ext = '.'.$ext;
$real_ext_length = strlen($real_ext); $real_ext_length = strlen($real_ext);
@@ -2240,7 +2240,7 @@ exit;
$subdir = ($dir) ? $dir.'/' : ''; $subdir = ($dir) ? $dir.'/' : '';
foreach ($files as $file) foreach ($files as $file)
{ {
if (strpos($file, $real_ext) && strpos($file, $real_ext) == (strlen($file) - $real_ext_length)) if (!$real_ext || (strpos($file, $real_ext) && strpos($file, $real_ext) == (strlen($file) - $real_ext_length)))
$filtered_files[] = $subdir.$file; $filtered_files[] = $subdir.$file;
if ($recursive && $file[0] != '.' && is_dir($real_path.$file)) if ($recursive && $file[0] != '.' && is_dir($real_path.$file))
@@ -585,7 +585,7 @@ class AdminPerformanceControllerCore extends AdminController
$this->errors[] = Tools::displayError('You do not have permission to delete here.'); $this->errors[] = Tools::displayError('You do not have permission to delete here.');
} }
$redirecAdmin = false; $redirectAdmin = false;
if ((bool)Tools::getValue('smarty_up')) if ((bool)Tools::getValue('smarty_up'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
@@ -593,7 +593,7 @@ class AdminPerformanceControllerCore extends AdminController
Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_)); Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0)); Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0)); Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0));
$redirecAdmin = true; $redirectAdmin = true;
} }
else else
$this->errors[] = Tools::displayError('You do not have permission to edit here.'); $this->errors[] = Tools::displayError('You do not have permission to edit here.');
@@ -606,7 +606,7 @@ class AdminPerformanceControllerCore extends AdminController
if (!Combination::isCurrentlyUsed()) if (!Combination::isCurrentlyUsed())
Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination')); Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination'));
Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature')); Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature'));
$redirecAdmin = true; $redirectAdmin = true;
} }
else else
$this->errors[] = Tools::displayError('You do not have permission to edit here.'); $this->errors[] = Tools::displayError('You do not have permission to edit here.');
@@ -624,7 +624,7 @@ class AdminPerformanceControllerCore extends AdminController
$this->errors[] = Tools::displayError('Unknown error.'); $this->errors[] = Tools::displayError('Unknown error.');
else else
{ {
$redirecAdmin = true; $redirectAdmin = true;
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) if (Configuration::get('PS_HTACCESS_CACHE_CONTROL'))
Tools::generateHtaccess(); Tools::generateHtaccess();
} }
@@ -654,7 +654,7 @@ class AdminPerformanceControllerCore extends AdminController
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
$redirecAdmin = true; $redirectAdmin = true;
} }
} }
else else
@@ -705,7 +705,7 @@ class AdminPerformanceControllerCore extends AdminController
)) ))
{ {
Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo); Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo);
$redirecAdmin = true; $redirectAdmin = true;
} }
else else
$this->errors[] = Tools::displayError('Cannot overwrite settings file.'); $this->errors[] = Tools::displayError('Cannot overwrite settings file.');
@@ -772,7 +772,7 @@ class AdminPerformanceControllerCore extends AdminController
copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php') copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php')
&& file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings) && file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings)
)) ))
$redirecAdmin = true; $redirectAdmin = true;
else else
$this->errors[] = Tools::displayError('Cannot overwrite settings file.'); $this->errors[] = Tools::displayError('Cannot overwrite settings file.');
} }
@@ -780,7 +780,7 @@ class AdminPerformanceControllerCore extends AdminController
else else
$this->errors[] = Tools::displayError('You do not have permission to edit here.'); $this->errors[] = Tools::displayError('You do not have permission to edit here.');
} }
if ($redirecAdmin && (!isset($this->errors) || !count($this->errors))) if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
else else
return parent::postProcess(); return parent::postProcess();
+19 -16
View File
@@ -37,25 +37,28 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
*/ */
public function processNextStep() public function processNextStep()
{ {
// Save shop configuration if (Tools::isSubmit('shop_name'))
$this->session->shop_name = trim(Tools::getValue('shop_name')); {
$this->session->shop_activity = Tools::getValue('shop_activity'); // Save shop configuration
$this->session->install_type = Tools::getValue('db_mode'); $this->session->shop_name = trim(Tools::getValue('shop_name'));
$this->session->shop_country = Tools::getValue('shop_country'); $this->session->shop_activity = Tools::getValue('shop_activity');
$this->session->shop_timezone = Tools::getValue('shop_timezone'); $this->session->install_type = Tools::getValue('db_mode');
$this->session->shop_country = Tools::getValue('shop_country');
$this->session->shop_timezone = Tools::getValue('shop_timezone');
// Save admin configuration // Save admin configuration
$this->session->admin_firstname = trim(Tools::getValue('admin_firstname')); $this->session->admin_firstname = trim(Tools::getValue('admin_firstname'));
$this->session->admin_lastname = trim(Tools::getValue('admin_lastname')); $this->session->admin_lastname = trim(Tools::getValue('admin_lastname'));
$this->session->admin_email = trim(Tools::getValue('admin_email')); $this->session->admin_email = trim(Tools::getValue('admin_email'));
$this->session->send_informations = Tools::getValue('send_informations'); $this->session->send_informations = Tools::getValue('send_informations');
// If password fields are empty, but are already stored in session, do not fill them again // If password fields are empty, but are already stored in session, do not fill them again
if (!$this->session->admin_password || trim(Tools::getValue('admin_password'))) if (!$this->session->admin_password || trim(Tools::getValue('admin_password')))
$this->session->admin_password = trim(Tools::getValue('admin_password')); $this->session->admin_password = trim(Tools::getValue('admin_password'));
if (!$this->session->admin_password_confirm || trim(Tools::getValue('admin_password_confirm'))) if (!$this->session->admin_password_confirm || trim(Tools::getValue('admin_password_confirm')))
$this->session->admin_password_confirm = trim(Tools::getValue('admin_password_confirm')); $this->session->admin_password_confirm = trim(Tools::getValue('admin_password_confirm'));
}
} }
/** /**
-4
View File
@@ -355,10 +355,6 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme')); $this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme'));
// Mail is send only if option is selected
if ($this->session->send_informations)
$this->process_steps[] = array('key' => 'sendEmail', 'lang' => $this->l('Send information e-mail'));
$this->displayTemplate('process'); $this->displayTemplate('process');
} }
} }
+102
View File
@@ -0,0 +1,102 @@
<?php
// echo '<pre>';
// print_r($_POST);
// die;
include_once('../init.php');
$iso = Tools::getValue('iso');
if (Tools::isSubmit('submitTranslations'))
{
if (!file_exists('../langs/'.$iso.'/install.php'))
die('translation file does not exists');
$translated_content = include('../langs/'.$iso.'/install.php');
unset($_POST['iso']);
unset($_POST['submitTranslations']);
foreach ($_POST as $post_key => $post_value)
if (!empty($post_value))
$translated_content['translations'][my_urldecode($post_key)] = $post_value;
$new_content = "<?php\nreturn array(\n";
foreach ($translated_content as $key1 => $value1)
{
$new_content .= "\t'".just_quotes($key1)."' => array(\n";
foreach ($value1 as $key2 => $value2)
$new_content .= "\t\t'".just_quotes($key2)."' => '".just_quotes($value2)."',\n";
$new_content .= "\t),\n";
}
$new_content .= ");";
file_put_contents('../langs/'.$iso.'/install.php', $new_content);
echo '<span class="label label-success">Translations Updated</span><br /><br />';
}
$regex = '/->l\(\'(.*[^\\\\])\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
$dirs = array('classes', 'controllers', 'models', 'theme');
$languages = scandir('../langs');
$files = $translations = $translations_source = array();
foreach ($dirs as $dir)
{
$files = array_merge($files, Tools::scandir('..', 'php', $dir, true));
$files = array_merge($files, Tools::scandir('..', 'phtml', $dir, true));
}
foreach ($files as $file)
{
$content = file_get_contents('../'.$file);
preg_match_all($regex, $content, $matches);
$translations_source = array_merge($translations_source, $matches[1]);
}
$translations_source = array_map('stripslashes', $translations_source);
if ($iso && (file_exists('../langs/'.$iso.'/install.php')))
{
$translated_content = include('../langs/'.$iso.'/install.php');
$translations = $translated_content['translations'];
}
echo '
<html>
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<style type="text/css">
body {padding: 20px}
input[type=text] {width:600px}
</style>
</head>
<body>
<form action="translate.php" method="post">
<select name="iso" onchange="document.location = \'translate.php?iso=\'+this.value;">
<option>-- Choose your language --</option>';
foreach ($languages as $language)
if (file_exists('../langs/'.$language.'/install.php'))
echo '<option value="'.htmlspecialchars($language, ENT_COMPAT, 'utf-8').'" '.($iso == $language ? 'selected="selected"' : '').'>'.htmlspecialchars($language, ENT_NOQUOTES, 'utf-8').'</option>'."\n";
echo ' </select>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Source</th>
<th>Your translation</th>
</tr>
</thead>
<tbody>';
foreach ($translations_source as $translation_source)
echo ' <tr '.(!isset($translations[$translation_source]) ? 'class="error"' : '').'>
<td>
'.htmlspecialchars($translation_source, ENT_NOQUOTES, 'utf-8').'
</td>
<td>
<input type="text" name="'.my_urlencode($translation_source).'"
'.(isset($translations[$translation_source]) ? 'value="'.htmlspecialchars($translations[$translation_source], ENT_COMPAT, 'utf-8').'"' : '').'
/>
</td>
</tr>';
echo ' </tbody>
</table>
<input type="submit" name="submitTranslations" class="btn btn-primary" />
</form>
</body>
</html>';
function just_quotes($s) {return str_replace('\'', '\\\'', $s);}
function my_urlencode($s) {return str_replace('.', '_dot_', urlencode($s));}
function my_urldecode($s) {return str_replace('_dot_', '.', urldecode($s));}
-1
View File
@@ -152,7 +152,6 @@ return array(
'Welcome to the PrestaShop %s Installer.' => 'Bienvenue sur l\'installation de PrestaShop %s', 'Welcome to the PrestaShop %s Installer.' => 'Bienvenue sur l\'installation de PrestaShop %s',
'The installation process should take only few minutes!' => 'Le processus d\'installation devrait vous prendre quelques minutes seulement !', 'The installation process should take only few minutes!' => 'Le processus d\'installation devrait vous prendre quelques minutes seulement !',
'If you need help, do not hesitate to check <a href="%1$s" target="_blank">our documentation</a> or to contact our support team: %2$s' => 'Si vous avez besoin d\'aide, n\'hésitez pas à visiter <a href="%1$s" target="_blank">notre documentation</a> ou à contacter notre équipe de support : %2$s', 'If you need help, do not hesitate to check <a href="%1$s" target="_blank">our documentation</a> or to contact our support team: %2$s' => 'Si vous avez besoin d\'aide, n\'hésitez pas à visiter <a href="%1$s" target="_blank">notre documentation</a> ou à contacter notre équipe de support : %2$s',
'Choose the installer language:' => 'Choisissez la langue pour l\'installation :',
'Did you know?' => 'Le saviez vous ?', 'Did you know?' => 'Le saviez vous ?',
'PrestaShop and its community offers over %d different languages for free, directly accessible from your Back Office on the Localization tab.' => 'PrestaShop et sa communauté vous proposent gratuitement des traductions dans %d langues directement accessibles depuis votre administration.', 'PrestaShop and its community offers over %d different languages for free, directly accessible from your Back Office on the Localization tab.' => 'PrestaShop et sa communauté vous proposent gratuitement des traductions dans %d langues directement accessibles depuis votre administration.',
'License Agreements' => 'Contrats de licence', 'License Agreements' => 'Contrats de licence',
+5 -5
View File
@@ -149,19 +149,19 @@ var default_iso = '<?php echo $this->session->shop_country ?>';
<?php echo $this->displayError('admin_password_confirm') ?> <?php echo $this->displayError('admin_password_confirm') ?>
</div> </div>
<!-- Recieve by email --> <!-- Newsletter -->
<div class="field clearfix" id="contentInfosNotification"> <div class="field clearfix" id="contentInfosNotification">
<div class="contentinput"> <div class="contentinput">
<input type="checkbox" name="send_informations" id="infosNotification" class="aligned" style="vertical-align: middle;" <?php if ($this->session->send_informations): ?>checked="checked"<?php endif; ?> /> <input type="checkbox" name="send_informations" id="infosNotification" class="aligned" style="vertical-align:middle" <?php if ($this->session->send_informations): ?>checked="checked"<?php endif; ?> />
<label for="infosNotification"><?php echo $this->l('Receive this information by e-mail') ?></label> <label for="infosNotification"><?php echo $this->l('Sign-up to the newsletter') ?></label>
<br/> <br/>
<span id="resultInfosNotification" class="result aligned"></span> <span id="resultInfosNotification" class="result aligned"></span>
</div> </div>
<p class="userInfos aligned"><?php echo $this->l('Warning: You will receive this information only if your e-mail configuration is correct.') ?></p> <p class="userInfos aligned"><?php echo $this->l('PrestaShop can provide you with guidance on a regular basis by sending you tips on how to optimize the management of your store which will help you grow your business. If you do not wish to receive these tips, please uncheck this box.') ?></p>
</div> </div>
</div> </div>
<!-- Partners form --> <!-- Partners form -->
<div id="benefitsBlock" style="display: none;"></div> <div id="benefitsBlock" style="display:none"></div>
<?php $this->displayTemplate('footer') ?> <?php $this->displayTemplate('footer') ?>
+1 -1
View File
@@ -71,7 +71,7 @@ var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
</div> </div>
<?php if (@fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)): ?> <?php if (@fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)): ?>
<iframe src="http://addons.prestashop.com/psinstall.php?lang=<?php echo $this->language->getLanguageIso() ?>" scrolling="no" id="prestastore"> <iframe src="http://addons.prestashop.com/psinstall.php?version=2&lang=<?php echo $this->language->getLanguageIso() ?>&email=<?php echo $this->session->admin_email ?>&activity=<?php echo $this->session->shop_activity ?>" scrolling="no" id="prestastore">
<p>Your browser does not support iframes.</p> <p>Your browser does not support iframes.</p>
</iframe> </iframe>
<?php endif; ?> <?php endif; ?>
+1 -1
View File
@@ -7,7 +7,7 @@
<?php if ($this->tests['required']['success']): ?> <?php if ($this->tests['required']['success']): ?>
<h3 class="okBlock"><?php echo $this->l('PrestaShop compatibility with your system environment has been verified!') ?></h3> <h3 class="okBlock"><?php echo $this->l('PrestaShop compatibility with your system environment has been verified!') ?></h3>
<?php else: ?> <?php else: ?>
<h3 class="errorBlock"><?php echo $this->l('Oops! Please correct the item(s) below, and then click “Refresh information” to test the compatibility of your new system.') ?></h3> <h3 class="errorBlock"><?php echo $this->l('Oops! Please correct the item(s) below, and then click "Refresh information" to test the compatibility of your new system.') ?></h3>
<?php endif; ?> <?php endif; ?>
<!-- Display tests results --> <!-- Display tests results -->
<?php foreach ($this->tests_render as $type => $categories): ?> <?php foreach ($this->tests_render as $type => $categories): ?>