[*] BO : #PSFV-94 - added AdminTranslationsController
This commit is contained in:
@@ -0,0 +1,165 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function chooseTypeTranslation(id_lang)
|
||||||
|
{
|
||||||
|
getE('translation_lang').value = id_lang;
|
||||||
|
document.getElementById('typeTranslationForm').submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<fieldset class="width3"><legend><img src="../img/admin/translation.gif" />{l s='Modify translations'}</legend>
|
||||||
|
{l s='Here you can modify translations for all text input into PrestaShop.'}<br />
|
||||||
|
{l s='First, select a section (such as Back Office or Modules), then click the flag representing the language you want to edit.'}<br /><br />
|
||||||
|
<form method="get" action="index.php" id="typeTranslationForm">
|
||||||
|
<input type="hidden" name="tab" value="AdminTranslations" />
|
||||||
|
<input type="hidden" name="lang" id="translation_lang" value="0" />
|
||||||
|
<select name="type" style="float:left; margin-right:10px;">
|
||||||
|
{foreach $translations as $key => $translation}
|
||||||
|
<option value="{$key}">{$translation} </option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<a href="javascript:chooseTypeTranslation('{$language['iso_code']}')">
|
||||||
|
<img src="{$theme_lang_dir}{$language['id_lang']}.jpg" alt="{$language['iso_code']}" title="{$language['iso_code']}" />
|
||||||
|
</a>
|
||||||
|
{/foreach}
|
||||||
|
<input type="hidden" name="token" value="{$token}" />
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br /><h2>{l s='Translation exchange'}</h2>
|
||||||
|
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
|
||||||
|
<fieldset class="width3">
|
||||||
|
<legend>
|
||||||
|
<img src="../img/admin/import.gif" />{l s='Add / Update a language'}
|
||||||
|
</legend>
|
||||||
|
<div id="submitAddLangContent" style="float:left;">
|
||||||
|
<p>{l s='You can add or update a language directly from prestashop.com here'}</p>
|
||||||
|
<div class="warn">
|
||||||
|
<img src="../img/admin/warn2.png">
|
||||||
|
{l s='If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.'}
|
||||||
|
</div>
|
||||||
|
{if $packs_to_update || $packs_to_install}
|
||||||
|
<div style="font-weight:bold; float:left;">{l s='Language you want to add or update:'}
|
||||||
|
<select id="params_import_language" name="params_import_language">
|
||||||
|
<optgroup label="{l s='Add a language'}">
|
||||||
|
{foreach $packs_to_install as $lang_pack}
|
||||||
|
<option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="{l s='Update a language'}">
|
||||||
|
{foreach $packs_to_update as $lang_pack}
|
||||||
|
<option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
<input type="submit" value="{l s='Add or update the language'}" name="submitAddLanguage" class="button" />
|
||||||
|
</div>
|
||||||
|
{else}
|
||||||
|
<br /><br /><p class="error">{l s='Cannot connect to prestashop.com to get languages list.'}</p></div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form><br /><br />
|
||||||
|
|
||||||
|
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
|
||||||
|
<fieldset class="width3">
|
||||||
|
<legend>
|
||||||
|
<img src="../img/admin/import.gif" />{l s='Import a language pack manually'}
|
||||||
|
</legend>
|
||||||
|
<div id="submitImportContent">
|
||||||
|
{l s='If the name format is: isocode.gzip (e.g. fr.gzip) and the language corresponding to this package does not exist, it will automatically be created.'}
|
||||||
|
{l s='Be careful, as it will replace all existing data for the destination language!'}<br /><br />
|
||||||
|
{l s='Language pack to import:'} <input type="file" name="file" /> <input type="submit" value="{l s='Import'}" name="submitImport" class="button" /></p>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
|
||||||
|
<fieldset class="width3">
|
||||||
|
<legend><img src="../img/admin/export.gif" />{l s='Export a language'}</legend>
|
||||||
|
<p>{l s='Export data from one language to a file (language pack).'}<br />
|
||||||
|
{l s='Choose the theme from which you want to export translations.'}<br />
|
||||||
|
<select name="iso_code" style="margin-top:10px;">
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<option value="{$language['iso_code']}">{$language['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="theme" style="margin-top:10px;">
|
||||||
|
{foreach $themes as $theme}
|
||||||
|
<option value="{$theme['name']}">{$theme['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
<input type="submit" class="button" name="submitExport" value="{l s='Export'}" />
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<br /><br />
|
||||||
|
<form action="{$url_submit}" method="post">
|
||||||
|
<fieldset class="width3">
|
||||||
|
<legend><img src="../img/admin/copy_files.gif" />{l s='Copy'}</legend>
|
||||||
|
<p>{l s='Copies data from one language to another.'}<br />
|
||||||
|
{l s='Be careful, as it will replace all existing data for the destination language!'}<br />
|
||||||
|
{l s='If necessary'}, <b><a href="{$url_create_language}">{l s='first create a new language'}</a></b>.</p>
|
||||||
|
<div style="float:left;">
|
||||||
|
<p>
|
||||||
|
<div style="width:75px; font-weight:bold; float:left;">{l s='From:'}</div>
|
||||||
|
<select name="fromLang">';
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<option value="{$language['iso_code']}">{$language['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="fromTheme">
|
||||||
|
{foreach $themes as $theme}
|
||||||
|
<option value="{$theme['name']}">{$theme['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select> <span style="font-style: bold; color: red;">*</span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<div style="width:75px; font-weight:bold; float:left;">{l s='To:'}</div>
|
||||||
|
<select name="toLang">
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<option value="{$language['iso_code']}">{$language['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="toTheme">
|
||||||
|
{foreach $themes as $theme}
|
||||||
|
<option value="{$theme['name']}">{$theme['name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div style="float:left;">
|
||||||
|
<input type="submit" value="{l s=' Copy '}" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" />
|
||||||
|
</div>
|
||||||
|
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> {l s='Language files (as indicated at Tools >> Languages >> Edition) must be complete to allow copying of translations'}</p>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
|
||||||
|
{l s='Errors to translate'} : <b>{$count}</b>
|
||||||
|
{$limit_warning}
|
||||||
|
{if !$suoshin_exceeded}
|
||||||
|
<form method="post" action="{$url_submit}" class="form">
|
||||||
|
{$auto_translate}
|
||||||
|
<input type="hidden" name="lang" value="{$lang}" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
<br /><br />
|
||||||
|
<table cellpadding="0" cellspacing="0" class="table">
|
||||||
|
{foreach $errorsArray as $key => $value}
|
||||||
|
<tr {if empty($value)}style="background-color:#FBB"{else}{cycle values='class="alt_row",'}{/if}>
|
||||||
|
<td>{$key|stripslashes}</td>
|
||||||
|
<td style="width: 430px">= <input type="text" name="{$key|md5}" value="{$value|regex_replace:'#"#':'"'|stripslashes}" style="width: 380px"></td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table><br />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
|
||||||
|
{l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
|
||||||
|
{$limit_warning}
|
||||||
|
{if !$suoshin_exceeded}
|
||||||
|
<form method="post" action="{$url_submit}" class="form">
|
||||||
|
{$toggle_button}
|
||||||
|
{$auto_translate}
|
||||||
|
<input type="hidden" name="lang" value="{$lang}" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
<br /><br />
|
||||||
|
{foreach $tabsArray as $k => $newLang}
|
||||||
|
{if !empty($newLang)}
|
||||||
|
{$occurrences = $newLang|array_count_values}
|
||||||
|
{if isset($occurrences[''])}
|
||||||
|
{$missing_translations = $occurrences['']}
|
||||||
|
{else}
|
||||||
|
{$missing_translations = 0}
|
||||||
|
{/if}
|
||||||
|
<fieldset>
|
||||||
|
<legend style="cursor : pointer" onclick="$('#{$k}-tpl').slideToggle();">{$k} - <font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations}</font>)</legend>
|
||||||
|
<div name="{$type}_div" id="{$k}-tpl" style="display:{if $missing_translations}block{else}none{/if}">
|
||||||
|
<table cellpadding="2">
|
||||||
|
{foreach $newLang as $key => $value}
|
||||||
|
<tr>
|
||||||
|
<td style="width: 40%">{$key|stripslashes}</td>
|
||||||
|
<td>=
|
||||||
|
{if $key|strlen < $textarea_sized}
|
||||||
|
<input type="text"
|
||||||
|
style="width: 450px"
|
||||||
|
name="{if $type == 'front' || $type == 'fields'}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}"
|
||||||
|
value="{$value|regex_replace:'#"#':'"'|stripslashes}" />
|
||||||
|
{else}
|
||||||
|
<textarea rows="{($key|strlen / $textarea_sized)|intval}"
|
||||||
|
style="width: 450px"
|
||||||
|
name="{if $type == 'front' || $type == 'fields'}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}">
|
||||||
|
{$value|regex_replace:'#"#':'"'|stripslashes}
|
||||||
|
</textarea>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset><br />
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
<br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form>
|
||||||
|
{/if}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
{$tinyMCE}
|
||||||
|
|
||||||
|
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
|
||||||
|
{l s='Click on the titles to open fieldsets'}.<br /><br />
|
||||||
|
{if !$suoshin_exceeded}
|
||||||
|
<form method="post" action="{$url_submit}" class="form">
|
||||||
|
{$toggle_button}
|
||||||
|
<input type="hidden" name="lang" value="{$lang}" />
|
||||||
|
<input type="hidden" name="type" value="{$type}" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
{l s='Core e-mails:'}
|
||||||
|
{$mail_content}
|
||||||
|
|
||||||
|
{l s='Modules e-mails:'}
|
||||||
|
{foreach $module_mails as $module_name => $mails}
|
||||||
|
{$mails['display']}
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
{if !empty($theme_mails)}
|
||||||
|
{l s='Themes e-mails:'}
|
||||||
|
{$bool_title = false}
|
||||||
|
{foreach $theme_mails as $theme_or_module_name => $mails}
|
||||||
|
{if $theme_or_module_name != 'theme_mail' && !$bool_title}
|
||||||
|
{$bool_title = true}
|
||||||
|
{l s='E-mails modules in theme:'}
|
||||||
|
{/if}
|
||||||
|
{$mails['display']}
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
<br />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
|
||||||
|
{l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
|
||||||
|
{$limit_warning}
|
||||||
|
{if !$suoshin_exceeded}
|
||||||
|
<form method="post" action="{$url_submit}" class="form">
|
||||||
|
{$toggle_button}
|
||||||
|
{$auto_translate}
|
||||||
|
<input type="hidden" name="lang" value="{$lang}" />
|
||||||
|
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
{if count($modules_translations) > 1}
|
||||||
|
<h3 style="padding:0;margin:0;">{l s='List of Themes - Click to access theme translation:'}</h3>
|
||||||
|
<ul style="list-style-type:none;padding:0;margin:0 0 10px 0;">
|
||||||
|
{foreach array_keys($modules_translations) as $theme}
|
||||||
|
<li><a href="#{$theme}" class="link">- {if $theme === 'default'}{l s='default'}{else}$theme{/if}</a></li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{foreach $modules_translations as $theme_name => $theme}
|
||||||
|
<h2>>{l s='Theme:'} <a name="{$theme_name}">{if $theme_name === $default_theme_name}{l s='default'}{else}{$theme_name}{/if} </h2>
|
||||||
|
{foreach $theme as $module_name => $module}
|
||||||
|
{l s='Module:'} <a name="{$module_name}" style="font-style:italic">{$module_name}</a>
|
||||||
|
{foreach $module as $template_name => $newLang}
|
||||||
|
{if !empty($newLang)}
|
||||||
|
{$occurrences = $newLang|array_count_values}
|
||||||
|
{if isset($occurrences[''])}
|
||||||
|
{$missing_translations = $occurrences['']}
|
||||||
|
{else}
|
||||||
|
{$missing_translations = 0}
|
||||||
|
{/if}
|
||||||
|
<fieldset>
|
||||||
|
<legend style="cursor : pointer" onclick="$('#{$theme_name}_{$module_name}_{$template_name}').slideToggle();">{if $theme_name === 'default'}{l s='default'}{else}{$theme_name}{/if} - {$template_name}
|
||||||
|
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations}</font>)
|
||||||
|
</legend>
|
||||||
|
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations}block{else}none{/if}">
|
||||||
|
<table cellpadding="2">
|
||||||
|
{foreach $newLang as $key => $value}
|
||||||
|
<tr>
|
||||||
|
<td style="width: 40%">{$key|stripslashes}</td>
|
||||||
|
<td>=
|
||||||
|
{* Prepare name string for md5() *}
|
||||||
|
{capture assign="name"}{strtolower($module_name)}_{strtolower($theme_name)}_{strtolower($template_name)}_{md5($key)}{/capture}
|
||||||
|
{if $key|strlen < $textarea_sized}
|
||||||
|
<input type="text"
|
||||||
|
style="width: 450px"
|
||||||
|
name="{$name|md5}"
|
||||||
|
value="{$value|regex_replace:'#"#':'"'|stripslashes}" />
|
||||||
|
{else}
|
||||||
|
<textarea rows="{($key|strlen / $textarea_sized)|intval}"
|
||||||
|
style="width: 450px"
|
||||||
|
name="{$name|md5}">
|
||||||
|
{$value|regex_replace:'#"#':'"'|stripslashes}
|
||||||
|
</textarea>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset><br />
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
{/foreach}
|
||||||
|
{/foreach}
|
||||||
|
<br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form>
|
||||||
|
{/if}
|
||||||
@@ -156,6 +156,7 @@ class AdminReturnControllerCore extends AdminController
|
|||||||
|
|
||||||
public function initToolbar()
|
public function initToolbar()
|
||||||
{
|
{
|
||||||
|
// If display list, we don't want the "add" button
|
||||||
if (!$this->display)
|
if (!$this->display)
|
||||||
return;
|
return;
|
||||||
parent::initToolbar();
|
parent::initToolbar();
|
||||||
|
|||||||
+201
-458
@@ -25,14 +25,12 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
|
|
||||||
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
|
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
|
||||||
include_once(_PS_ADMIN_DIR_.'/../tools/pear/PEAR.php');
|
include_once(_PS_ADMIN_DIR_.'/../tools/pear/PEAR.php');
|
||||||
define ('TEXTAREA_SIZED', 70);
|
define ('TEXTAREA_SIZED', 70);
|
||||||
|
|
||||||
class AdminTranslations extends AdminTab
|
class AdminTranslationsControllerCore extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $link_lang_pack = 'http://www.prestashop.com/download/lang_packs/get_each_language_pack.php';
|
protected $link_lang_pack = 'http://www.prestashop.com/download/lang_packs/get_each_language_pack.php';
|
||||||
protected $total_expression = 0;
|
protected $total_expression = 0;
|
||||||
protected $all_iso_lang = array();
|
protected $all_iso_lang = array();
|
||||||
@@ -56,6 +54,58 @@ class AdminTranslations extends AdminTab
|
|||||||
self::$php_regexp = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
self::$php_regexp = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initContent()
|
||||||
|
{
|
||||||
|
if ($type = Tools::getValue('type'))
|
||||||
|
$this->content .= $this->{'initForm'.ucfirst($type)}(Tools::strtolower(Tools::getValue('lang')));
|
||||||
|
else
|
||||||
|
$this->content .= $this->initMain();
|
||||||
|
|
||||||
|
$this->context->smarty->assign(array('content' => $this->content));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initMain()
|
||||||
|
{
|
||||||
|
// Block modify
|
||||||
|
$translations = array(
|
||||||
|
'front' => $this->l('Front Office translations'),
|
||||||
|
'back' => $this->l('Back Office translations'),
|
||||||
|
'errors' => $this->l('Error message translations'),
|
||||||
|
'fields' => $this->l('Field name translations'),
|
||||||
|
'modules' => $this->l('Module translations'),
|
||||||
|
'pdf' => $this->l('PDF translations'),
|
||||||
|
'mails' => $this->l('E-mail template translations'),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Block add/update
|
||||||
|
$packs_to_install = array();
|
||||||
|
$packs_to_update = array();
|
||||||
|
if ($lang_packs = Tools::file_get_contents($this->link_lang_pack .'?version='._PS_VERSION_, false, @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
||||||
|
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
|
||||||
|
if ($lang_packs != '' AND $lang_packs = Tools::jsonDecode($lang_packs,true))
|
||||||
|
foreach($lang_packs as $key => $lang_pack)
|
||||||
|
{
|
||||||
|
if (!Language::isInstalled($lang_pack['iso_code']))
|
||||||
|
$packs_to_install[$key] = $lang_pack;
|
||||||
|
else
|
||||||
|
$packs_to_update[$key] = $lang_pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->context->smarty->assign(array(
|
||||||
|
'theme_lang_dir' =>_THEME_LANG_DIR_,
|
||||||
|
'token' => $this->token,
|
||||||
|
'languages' => Language::getLanguages(false),
|
||||||
|
'translations' => $translations,
|
||||||
|
'packs_to_install' => $packs_to_install,
|
||||||
|
'packs_to_update' => $packs_to_update,
|
||||||
|
'url_submit' => self::$currentIndex.'&token='.$this->token,
|
||||||
|
'themes' => $themes = self::getThemesList(),
|
||||||
|
'url_create_language' => 'index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$this->context->employee->id),
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->context->smarty->fetch('translations/main.tpl');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method merge each arrays of modules translation in
|
* This method merge each arrays of modules translation in
|
||||||
* the array of modules translations
|
* the array of modules translations
|
||||||
@@ -188,6 +238,7 @@ class AdminTranslations extends AdminTab
|
|||||||
}
|
}
|
||||||
return $bool_flag;
|
return $bool_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitExportLang()
|
public function submitExportLang()
|
||||||
{
|
{
|
||||||
$lang = strtolower(Tools::getValue('iso_code'));
|
$lang = strtolower(Tools::getValue('iso_code'));
|
||||||
@@ -431,7 +482,7 @@ class AdminTranslations extends AdminTab
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* PrestaShop demo mode*/
|
/* PrestaShop demo mode*/
|
||||||
|
|
||||||
if (Tools::isSubmit('submitCopyLang'))
|
if (Tools::isSubmit('submitCopyLang'))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['add'] === '1')
|
if ($this->tabAccess['add'] === '1')
|
||||||
@@ -471,7 +522,7 @@ class AdminTranslations extends AdminTab
|
|||||||
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.');
|
||||||
}
|
}
|
||||||
elseif (Tools::isSubmit('submitTranslationsPDF'))
|
elseif (Tools::isSubmit('submitTranslationsPdf'))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
{
|
{
|
||||||
@@ -560,6 +611,7 @@ class AdminTranslations extends AdminTab
|
|||||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getMailPattern()
|
protected function getMailPattern()
|
||||||
{
|
{
|
||||||
// Let the indentation like it.
|
// Let the indentation like it.
|
||||||
@@ -683,157 +735,6 @@ class AdminTranslations extends AdminTab
|
|||||||
if (count($this->_errors) == 0)
|
if (count($this->_errors) == 0)
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.$params_redirect);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.$params_redirect);
|
||||||
}
|
}
|
||||||
public function display()
|
|
||||||
{
|
|
||||||
$translations = array(
|
|
||||||
'front' => $this->l('Front Office translations'),
|
|
||||||
'back' => $this->l('Back Office translations'),
|
|
||||||
'errors' => $this->l('Error message translations'),
|
|
||||||
'fields' => $this->l('Field name translations'),
|
|
||||||
'modules' => $this->l('Module translations'),
|
|
||||||
'pdf' => $this->l('PDF translations'),
|
|
||||||
'mails' => $this->l('E-mail template translations'),
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($type = Tools::getValue('type'))
|
|
||||||
$this->{'displayForm'.ucfirst($type)}(Tools::strtolower(Tools::getValue('lang')));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$languages = Language::getLanguages(false);
|
|
||||||
echo '<fieldset class="width3"><legend><img src="../img/admin/translation.gif" />'.$this->l('Modify translations').'</legend>'.
|
|
||||||
$this->l('Here you can modify translations for all text input into PrestaShop.').'<br />'.
|
|
||||||
$this->l('First, select a section (such as Back Office or Modules), then click the flag representing the language you want to edit.').'<br /><br />
|
|
||||||
<form method="get" action="index.php" id="typeTranslationForm">
|
|
||||||
<input type="hidden" name="tab" value="AdminTranslations" />
|
|
||||||
<input type="hidden" name="lang" id="translation_lang" value="0" />
|
|
||||||
<select name="type" style="float:left; margin-right:10px;">';
|
|
||||||
foreach ($translations AS $key => $translation)
|
|
||||||
echo '<option value="'.$key.'">'.$translation.' </option>';
|
|
||||||
echo '</select>';
|
|
||||||
foreach ($languages AS $language)
|
|
||||||
echo '<a href="javascript:chooseTypeTranslation(\''.$language['iso_code'].'\')">
|
|
||||||
<img src="'._THEME_LANG_DIR_.$language['id_lang'].'.jpg" alt="'.$language['iso_code'].'" title="'.$language['iso_code'].'" />
|
|
||||||
</a>';
|
|
||||||
echo '<input type="hidden" name="token" value="'.$this->token.'" /></form></fieldset>
|
|
||||||
<br /><br /><h2>'.$this->l('Translation exchange').'</h2>';
|
|
||||||
echo '<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
|
||||||
<fieldset class="width3">
|
|
||||||
<legend>
|
|
||||||
<img src="../img/admin/import.gif" />'.$this->l('Add / Update a language').'
|
|
||||||
</legend>
|
|
||||||
<div id="submitAddLangContent" style="float:left;"><p>'.$this->l('You can add or update a language directly from prestashop.com here').'</p>';
|
|
||||||
$this->displayWarning($this->l('If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.'));
|
|
||||||
echo '<div style="font-weight:bold; float:left;">'.$this->l('Language you want to add or update:').' ';
|
|
||||||
|
|
||||||
if ($lang_packs = Tools::file_get_contents($this->link_lang_pack .'?version='._PS_VERSION_, false, @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
|
||||||
{
|
|
||||||
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
|
|
||||||
if ($lang_packs != '' AND $lang_packs = Tools::jsonDecode($lang_packs,true))
|
|
||||||
{
|
|
||||||
echo '
|
|
||||||
<select id="params_import_language" name="params_import_language">
|
|
||||||
<optgroup label="'.$this->l('Add a language').'">';
|
|
||||||
|
|
||||||
$alreadyInstalled = '<optgroup label="'.$this->l('Update a language').'">';
|
|
||||||
foreach($lang_packs AS $lang_pack)
|
|
||||||
{
|
|
||||||
if (!Language::isInstalled($lang_pack['iso_code']))
|
|
||||||
echo '<option value="'.$lang_pack['iso_code'].'|'.$lang_pack['version'].'">'.$lang_pack['name'].'</option>';
|
|
||||||
else
|
|
||||||
$alreadyInstalled.='<option value="'.$lang_pack['iso_code'].'|'.$lang_pack['version'].'">'.$lang_pack['name'].'</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</optgroup>'.$alreadyInstalled.'</optgroup>
|
|
||||||
</select> <input type="submit" value="'.$this->l('Add or update the language').'" name="submitAddLanguage" class="button" />';
|
|
||||||
}
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '<br /><br /><p class="error">'.$this->l('Cannot connect to prestashop.com to get languages list.').'</p></div>';
|
|
||||||
echo ' </div>
|
|
||||||
</fieldset>
|
|
||||||
</form><br /><br />';
|
|
||||||
echo '<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
|
||||||
<fieldset class="width3">
|
|
||||||
<legend>
|
|
||||||
<img src="../img/admin/import.gif" />'.$this->l('Import a language pack manually').'
|
|
||||||
</legend>
|
|
||||||
<div id="submitImportContent">'.
|
|
||||||
$this->l('If the name format is: isocode.gzip (e.g. fr.gzip) and the language corresponding to this package does not exist, it will automatically be created.').
|
|
||||||
$this->l('Be careful, as it will replace all existing data for the destination language!').'<br /><br />'.
|
|
||||||
$this->l('Language pack to import:').' <input type="file" name="file" /> <input type="submit" value="'.$this->l('Import').'" name="submitImport" class="button" /></p>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<br /><br />
|
|
||||||
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
|
||||||
<fieldset class="width3"><legend><img src="../img/admin/export.gif" />'.$this->l('Export a language').'</legend>
|
|
||||||
<p>'.$this->l('Export data from one language to a file (language pack).').'<br />'.
|
|
||||||
$this->l('Choose the theme from which you want to export translations.').'<br />
|
|
||||||
<select name="iso_code" style="margin-top:10px;">';
|
|
||||||
foreach ($languages AS $language)
|
|
||||||
echo '<option value="'.$language['iso_code'].'">'.$language['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="theme" style="margin-top:10px;">';
|
|
||||||
$themes = self::getThemesList();
|
|
||||||
foreach ($themes AS $theme)
|
|
||||||
echo '<option value="'.$theme['name'].'">'.$theme['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select>
|
|
||||||
<input type="submit" class="button" name="submitExport" value="'.$this->l('Export').'" />
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<br /><br />';
|
|
||||||
$allLanguages = Language::getLanguages(false);
|
|
||||||
echo '
|
|
||||||
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post">
|
|
||||||
<fieldset class="width3"><legend><img src="../img/admin/copy_files.gif" />'.$this->l('Copy').'</legend>
|
|
||||||
<p>'.$this->l('Copies data from one language to another.').'<br />'.
|
|
||||||
$this->l('Be careful, as it will replace all existing data for the destination language!').'<br />'.
|
|
||||||
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$this->context->employee->id).'">'.$this->l('first create a new language').'</a></b>.</p>
|
|
||||||
<div style="float:left;">
|
|
||||||
<p>
|
|
||||||
<div style="width:75px; font-weight:bold; float:left;">'.$this->l('From:').'</div>
|
|
||||||
<select name="fromLang">';
|
|
||||||
foreach ($languages AS $language)
|
|
||||||
echo '<option value="'.$language['iso_code'].'">'.$language['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="fromTheme">';
|
|
||||||
$themes = self::getThemesList();
|
|
||||||
foreach ($themes AS $theme)
|
|
||||||
echo '<option value="'.$theme['name'].'">'.$theme['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select> <span style="font-style: bold; color: red;">*</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<div style="width:75px; font-weight:bold; float:left;">'.$this->l('To:').'</div>
|
|
||||||
<select name="toLang">';
|
|
||||||
foreach ($allLanguages AS $language)
|
|
||||||
echo '<option value="'.$language['iso_code'].'">'.$language['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="toTheme">';
|
|
||||||
$themes = self::getThemesList();
|
|
||||||
foreach ($themes AS $theme)
|
|
||||||
echo '<option value="'.$theme['name'].'">'.$theme['name'].'</option>';
|
|
||||||
echo '
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div style="float:left;">
|
|
||||||
<input type="submit" value="'.$this->l(' Copy ').'" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" />
|
|
||||||
</div>
|
|
||||||
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> '.$this->l('Language files (as indicated at Tools >> Languages >> Edition) must be complete to allow copying of translations').'</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function fileExists($dir, $file, $var)
|
public function fileExists($dir, $file, $var)
|
||||||
{
|
{
|
||||||
@@ -948,7 +849,7 @@ class AdminTranslations extends AdminTab
|
|||||||
return $str_output;
|
return $str_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFormFront($lang)
|
public function initFormFront($lang)
|
||||||
{
|
{
|
||||||
$_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG');
|
$_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG');
|
||||||
$str_output = '';
|
$str_output = '';
|
||||||
@@ -956,7 +857,7 @@ class AdminTranslations extends AdminTab
|
|||||||
/* List templates to parse */
|
/* List templates to parse */
|
||||||
$templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_));
|
$templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_));
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$files = array();
|
$tabsArray = array();
|
||||||
foreach ($templates AS $template)
|
foreach ($templates AS $template)
|
||||||
if (preg_match('/^(.*).tpl$/', $template) AND (file_exists($tpl = _PS_THEME_DIR_.$template) OR file_exists($tpl = _PS_ALL_THEMES_DIR_.$template)))
|
if (preg_match('/^(.*).tpl$/', $template) AND (file_exists($tpl = _PS_THEME_DIR_.$template) OR file_exists($tpl = _PS_ALL_THEMES_DIR_.$template)))
|
||||||
{
|
{
|
||||||
@@ -983,66 +884,42 @@ class AdminTranslations extends AdminTab
|
|||||||
$newLang[$key] = (key_exists($key2, $_LANG)) ? html_entity_decode($_LANG[$key2], ENT_COMPAT, 'UTF-8') : '';
|
$newLang[$key] = (key_exists($key2, $_LANG)) ? html_entity_decode($_LANG[$key2], ENT_COMPAT, 'UTF-8') : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$files[$template2] = $newLang;
|
$tabsArray[$template2] = $newLang;
|
||||||
$count += sizeof($newLang);
|
$count += sizeof($newLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_output .= '
|
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl');
|
||||||
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Front-Office translations').'</h2>
|
$tpl->assign(array(
|
||||||
'.$this->l('Total expressions').' : <b>'.$count.'</b>. '.$this->l('Click the fieldset title to expand or close the fieldset.').'.<br /><br />';
|
'lang' => Tools::strtoupper($lang),
|
||||||
$str_output .= $this->displayLimitPostWarning($count);
|
'translation_type' => $this->l('Front-Office translations'),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'count' => $count,
|
||||||
{
|
'limit_warning' => $this->displayLimitPostWarning($count),
|
||||||
$str_output .= '
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsFront=1&token='.$this->token.'" class="form">';
|
'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token,
|
||||||
$str_output .= $this->displayToggleButton(sizeof($_LANG) >= $count);
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
$str_output .= $this->displayAutoTranslate();
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
$str_output .= '<input type="hidden" name="lang" value="'.$lang.'" /><input type="submit" name="submitTranslationsFront" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
|
'tabsArray' => $tabsArray,
|
||||||
foreach ($files AS $k => $newLang)
|
'textarea_sized' => TEXTAREA_SIZED,
|
||||||
if (sizeof($newLang))
|
'type' => 'front'
|
||||||
{
|
));
|
||||||
$countValues = array_count_values($newLang);
|
return $tpl->fetch();
|
||||||
$empty = isset($countValues['']) ? $countValues[''] : 0;
|
|
||||||
$str_output .= '
|
|
||||||
<fieldset><legend style="cursor : pointer" onclick="$(\'#'.$k.'-tpl\').slideToggle();">'.$k.' - <font color="blue">'.sizeof($newLang).'</font> '.$this->l('expressions').' (<font color="red">'.$empty.'</font>)</legend>
|
|
||||||
<div name="front_div" id="'.$k.'-tpl" style="display: '.($empty ? 'block' : 'none').';">
|
|
||||||
<table cellpadding="2">';
|
|
||||||
foreach ($newLang AS $key => $value)
|
|
||||||
{
|
|
||||||
$str_output .= '<tr><td style="width: 40%">'.stripslashes($key).'</td><td>';
|
|
||||||
if (strlen($key) != 0 && strlen($key) < TEXTAREA_SIZED)
|
|
||||||
$str_output .= '= <input type="text" style="width: 450px" name="'.$k.'_'.md5($key).'" value="'.stripslashes(preg_replace('/"/', '\"', stripslashes($value))).'" />';
|
|
||||||
elseif(strlen($key))
|
|
||||||
$str_output .= '= <textarea rows="'.(int)(strlen($key) / TEXTAREA_SIZED).'" style="width: 450px" name="'.$k.'_'.md5($key).'">'.stripslashes(preg_replace('/"/', '\"', stripslashes($value))).'</textarea>';
|
|
||||||
else
|
|
||||||
$str_output .= '<span class="error-inline">'.implode(', ', $this->_errors).'</span>';
|
|
||||||
$str_output .= '</td></tr>';
|
|
||||||
}
|
|
||||||
$str_output .= '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</fieldset><br />';
|
|
||||||
}
|
|
||||||
$str_output .= '<br /><input type="submit" name="submitTranslationsFront" value="'.$this->l('Update translations').'" class="button" /></form>';
|
|
||||||
}
|
|
||||||
if (!empty($this->_errors))
|
|
||||||
$this->displayErrors();
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFormBack($lang)
|
public function initFormBack($lang)
|
||||||
{
|
{
|
||||||
$_LANGADM = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'admin.php', '_LANGADM');
|
$_LANGADM = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'admin.php', '_LANGADM');
|
||||||
$str_output = '';
|
$str_output = '';
|
||||||
/* List templates to parse */
|
/* List templates to parse */
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$tabs = scandir(_PS_ADMIN_DIR_.'/tabs');
|
$tabs = scandir(_PS_ADMIN_CONTROLLER_DIR_);
|
||||||
$tabs[] = '../../classes/AdminTab.php';
|
$tabs[] = '../../classes/AdminController.php';
|
||||||
$files = array();
|
$files = array();
|
||||||
|
$i=0;
|
||||||
foreach ($tabs AS $tab)
|
foreach ($tabs AS $tab)
|
||||||
if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_DIR_.'/tabs/'.$tab))
|
if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_CONTROLLER_DIR_.$tab))
|
||||||
{
|
{
|
||||||
$tab = basename(substr($tab, 0, -4));
|
// -4 becomes -14 to remove the ending "Controller.php" from the filename
|
||||||
|
$tab = basename(substr($tab, 0, -14));
|
||||||
$fd = fopen($tpl, 'r');
|
$fd = fopen($tpl, 'r');
|
||||||
$content = fread($fd, filesize($tpl));
|
$content = fread($fd, filesize($tpl));
|
||||||
fclose($fd);
|
fclose($fd);
|
||||||
@@ -1052,6 +929,7 @@ class AdminTranslations extends AdminTab
|
|||||||
$tabsArray[$tab][$key] = stripslashes(key_exists($tab.md5($key), $_LANGADM) ? html_entity_decode($_LANGADM[$tab.md5($key)], ENT_COMPAT, 'UTF-8') : '');
|
$tabsArray[$tab][$key] = stripslashes(key_exists($tab.md5($key), $_LANGADM) ? html_entity_decode($_LANGADM[$tab.md5($key)], ENT_COMPAT, 'UTF-8') : '');
|
||||||
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
|
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') AS $tab)
|
foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') AS $tab)
|
||||||
{
|
{
|
||||||
$tab = _PS_ADMIN_DIR_.'/'.$tab.'.php';
|
$tab = _PS_ADMIN_DIR_.'/'.$tab.'.php';
|
||||||
@@ -1065,59 +943,36 @@ class AdminTranslations extends AdminTab
|
|||||||
$count += isset($tabsArray['index']) ? sizeof($tabsArray['index']) : 0;
|
$count += isset($tabsArray['index']) ? sizeof($tabsArray['index']) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_output .= '
|
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl');
|
||||||
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Back-Office translations').'</h2>
|
$tpl->assign(array(
|
||||||
'.$this->l('Expressions to translate').' : <b>'.$count.'</b>. '.$this->l('Click on the titles to open fieldsets').'.<br /><br />';
|
'lang' => Tools::strtoupper($lang),
|
||||||
$str_output .= $this->displayLimitPostWarning($count);
|
'translation_type' => $this->l('Back-Office translations'),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'count' => $count,
|
||||||
{
|
'limit_warning' => $this->displayLimitPostWarning($count),
|
||||||
$str_output .= '
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token.'" class="form">';
|
'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token,
|
||||||
$str_output .= $this->displayToggleButton();
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
$str_output .= $this->displayAutoTranslate();
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
$str_output .= '<input type="hidden" name="lang" value="'.$lang.'" /><input type="submit" name="submitTranslationsBack" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
|
'tabsArray' => $tabsArray,
|
||||||
foreach ($tabsArray AS $k => $newLang)
|
'textarea_sized' => TEXTAREA_SIZED,
|
||||||
if (sizeof($newLang))
|
'type' => 'back'
|
||||||
{
|
));
|
||||||
$countValues = array_count_values($newLang);
|
return $tpl->fetch();
|
||||||
$empty = isset($countValues['']) ? $countValues[''] : 0;
|
|
||||||
$str_output .= '
|
|
||||||
<fieldset><legend style="cursor : pointer" onclick="$(\'#'.$k.'-tpl\').slideToggle();">'.$k.' - <font color="blue">'.sizeof($newLang).'</font> '.$this->l('expressions').' (<font color="red">'.$empty.'</font>)</legend>
|
|
||||||
<div name="back_div" id="'.$k.'-tpl" style="display: '.($empty ? 'block' : 'none').';">
|
|
||||||
<table cellpadding="2">';
|
|
||||||
foreach ($newLang AS $key => $value)
|
|
||||||
{
|
|
||||||
$str_output .= '<tr><td style="width: 40%">'.stripslashes($key).'</td><td>= ';
|
|
||||||
if (strlen($key) < TEXTAREA_SIZED)
|
|
||||||
$str_output .= '<input type="text" style="width: 450px" name="'.$k.md5($key).'" value="'.stripslashes(preg_replace('/"/', '\"', $value)).'" /></td></tr>';
|
|
||||||
else
|
|
||||||
$str_output .= '<textarea rows="'.(int)(strlen($key) / TEXTAREA_SIZED).'" style="width: 450px" name="'.$k.md5($key).'">'.stripslashes(preg_replace('/"/', '\"', $value)).'</textarea></td></tr>';
|
|
||||||
}
|
|
||||||
$str_output .= '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</fieldset><br />';
|
|
||||||
}
|
|
||||||
$str_output .= '<br /><input type="submit" name="submitTranslationsBack" value="'.$this->l('Update translations').'" class="button" /></form>';
|
|
||||||
}
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFormErrors($lang)
|
public function initFormErrors($lang)
|
||||||
{
|
{
|
||||||
$_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS');
|
$_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS');
|
||||||
|
|
||||||
$str_output = '';
|
|
||||||
|
|
||||||
/* List files to parse */
|
/* List files to parse */
|
||||||
$stringToTranslate = array();
|
$stringToTranslate = array();
|
||||||
$dirToParse = array(_PS_ADMIN_DIR_.'/../',
|
$dirToParse = array(_PS_ADMIN_DIR_.'/../',
|
||||||
_PS_ADMIN_DIR_.'/../classes/',
|
_PS_ADMIN_DIR_.'/../classes/',
|
||||||
_PS_ADMIN_DIR_.'/../controllers/',
|
_PS_ADMIN_DIR_.'/../controllers/front/',
|
||||||
|
_PS_ADMIN_DIR_.'/../controllers/admin/',
|
||||||
_PS_ADMIN_DIR_.'/../override/classes/',
|
_PS_ADMIN_DIR_.'/../override/classes/',
|
||||||
_PS_ADMIN_DIR_.'/../override/controllers/',
|
_PS_ADMIN_DIR_.'/../override/controllers/',
|
||||||
_PS_ADMIN_DIR_.'/',
|
_PS_ADMIN_DIR_.'/');
|
||||||
_PS_ADMIN_DIR_.'/tabs/');
|
|
||||||
if (!file_exists(_PS_MODULE_DIR_))
|
if (!file_exists(_PS_MODULE_DIR_))
|
||||||
die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')'));
|
die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')'));
|
||||||
if (!is_writable(_PS_MODULE_DIR_))
|
if (!is_writable(_PS_MODULE_DIR_))
|
||||||
@@ -1143,30 +998,29 @@ class AdminTranslations extends AdminTab
|
|||||||
$stringToTranslate[$key] = (key_exists(md5($key), $_ERRORS)) ? html_entity_decode($_ERRORS[md5($key)], ENT_COMPAT, 'UTF-8') : '';
|
$stringToTranslate[$key] = (key_exists(md5($key), $_ERRORS)) ? html_entity_decode($_ERRORS[md5($key)], ENT_COMPAT, 'UTF-8') : '';
|
||||||
}
|
}
|
||||||
$irow = 0;
|
$irow = 0;
|
||||||
$str_output .= $this->displayAutoTranslate();
|
|
||||||
$str_output .= '<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Error translations').'</h2>'
|
$tpl = $this->context->smarty->createTemplate('translations/translation_errors.tpl');
|
||||||
.$this->l('Errors to translate').' : <b>'.sizeof($stringToTranslate).'</b><br /><br />';
|
$tpl->assign(array(
|
||||||
$str_output .= $this->displayLimitPostWarning(sizeof($stringToTranslate));
|
'lang' => Tools::strtoupper($lang),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'translation_type' => $this->l('Error translations'),
|
||||||
{
|
'count' => count($stringToTranslate),
|
||||||
$str_output .= '
|
'limit_warning' => $this->displayLimitPostWarning($count),
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsErrors=1&lang='.$lang.'&token='.$this->token.'" class="form">
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
<input type="submit" name="submitTranslationsErrors" value="'.$this->l('Update translations').'" class="button" /><br /><br />
|
'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token,
|
||||||
<table cellpadding="0" cellspacing="0" class="table">';
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
ksort($stringToTranslate);
|
'type' => 'errors',
|
||||||
foreach ($stringToTranslate AS $key => $value)
|
'errorsArray' => $stringToTranslate,
|
||||||
$str_output .= '<tr '.(empty($value) ? 'style="background-color:#FBB"' : (++$irow % 2 ? 'class="alt_row"' : '')).'><td>'.stripslashes($key).'</td><td style="width: 430px">= <input type="text" name="'.md5($key).'" value="'.preg_replace('/"/', '"', stripslashes($value)).'" style="width: 380px"></td></tr>';
|
));
|
||||||
$str_output .= '</table><br /><input type="submit" name="submitTranslationsErrors" value="'.$this->l('Update translations').'" class="button" /></form>';
|
return $tpl->fetch();
|
||||||
}
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFormFields($lang)
|
public function initFormFields($lang)
|
||||||
{
|
{
|
||||||
$_FIELDS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'fields.php', '_FIELDS');
|
$_FIELDS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'fields.php', '_FIELDS');
|
||||||
|
|
||||||
$str_output = '';
|
$str_output = '';
|
||||||
$classArray = array();
|
$classArray = array();
|
||||||
|
$validArray = array();
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach (scandir(_PS_CLASS_DIR_) AS $classFile)
|
foreach (scandir(_PS_CLASS_DIR_) AS $classFile)
|
||||||
{
|
{
|
||||||
@@ -1179,50 +1033,38 @@ class AdminTranslations extends AdminTab
|
|||||||
if (!is_subclass_of($className, 'ObjectModel'))
|
if (!is_subclass_of($className, 'ObjectModel'))
|
||||||
continue;
|
continue;
|
||||||
$classArray[$className] = call_user_func(array($className, 'getValidationRules'), $className);
|
$classArray[$className] = call_user_func(array($className, 'getValidationRules'), $className);
|
||||||
|
|
||||||
|
foreach ($classArray AS $className => $rules)
|
||||||
|
{
|
||||||
|
if (isset($rules['validate']))
|
||||||
|
foreach ($rules['validate'] AS $key => $value)
|
||||||
|
$validArray[$className][$key] = array_key_exists($className.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$className.'_'.md5(addslashes($key))], ENT_NOQUOTES, 'UTF-8') : '';
|
||||||
|
|
||||||
|
if (isset($rules['validateLang']))
|
||||||
|
foreach ($rules['validateLang'] AS $key => $value)
|
||||||
|
$validArray[$className][$key] = array_key_exists($className.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$className.'_'.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '';
|
||||||
|
}
|
||||||
if (isset($classArray[$className]['validate']))
|
if (isset($classArray[$className]['validate']))
|
||||||
$count += sizeof($classArray[$className]['validate']);
|
$count += sizeof($classArray[$className]['validate']);
|
||||||
if (isset($classArray[$className]['validateLang']))
|
if (isset($classArray[$className]['validateLang']))
|
||||||
$count += sizeof($classArray[$className]['validateLang']);
|
$count += sizeof($classArray[$className]['validateLang']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_output .= $this->displayAutoTranslate();
|
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl');
|
||||||
$str_output .= '
|
$tpl->assign(array(
|
||||||
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Field name translations').'</h2>';
|
'lang' => Tools::strtoupper($lang),
|
||||||
$str_output .= $this->displayLimitPostWarning($count);
|
'translation_type' => $this->l('Field name translations'),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'count' => $count,
|
||||||
{
|
'limit_warning' => $this->displayLimitPostWarning($count),
|
||||||
$str_output .= $this->l('Fields to translate').' : <b>'.$count.'</b>. '.$this->l('Click on the titles to open fieldsets').'.<br /><br />
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token.'" class="form">';
|
'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token,
|
||||||
$str_output .= $this->displayToggleButton();
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
$str_output .= '<input type="hidden" name="lang" value="'.$lang.'" /><input type="submit" name="submitTranslationsFields" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
foreach ($classArray AS $className => $rules)
|
'tabsArray' => $validArray,
|
||||||
{
|
'textarea_sized' => TEXTAREA_SIZED,
|
||||||
$translated = 0;
|
'type' => 'fields'
|
||||||
$toTranslate = 0;
|
));
|
||||||
if (isset($rules['validate']))
|
return $tpl->fetch();
|
||||||
foreach ($rules['validate'] AS $key => $value)
|
|
||||||
(array_key_exists($className.'_'.md5($key), $_FIELDS)) ? ++$translated : ++$toTranslate;
|
|
||||||
if (isset($rules['validateLang']))
|
|
||||||
foreach ($rules['validateLang'] AS $key => $value)
|
|
||||||
(array_key_exists($className.'_'.md5($key), $_FIELDS)) ? ++$translated : ++$toTranslate;
|
|
||||||
$str_output .= '
|
|
||||||
<fieldset><legend style="cursor : pointer" onclick="$(\'#'.$className.'-tpl\').slideToggle();">'.$className.' - <font color="blue">'.($toTranslate + $translated).'</font> '.$this->l('fields').' (<font color="red">'.$toTranslate.'</font>)</legend>
|
|
||||||
<div name="fields_div" id="'.$className.'-tpl" style="display: '.($toTranslate ? 'block' : 'none').';">
|
|
||||||
<table cellpadding="2">';
|
|
||||||
if (isset($rules['validate']))
|
|
||||||
foreach ($rules['validate'] AS $key => $value)
|
|
||||||
$str_output .= '<tr><td style="text-align:right;width:200px;">'.stripslashes($key).'</td><td style="width: 680px">= <input type="text" name="'.$className.'_'.md5(addslashes($key)).'" value="'.(array_key_exists($className.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$className.'_'.md5(addslashes($key))], ENT_NOQUOTES, 'UTF-8') : '').'" style="width: 620px"></td></tr>';
|
|
||||||
if (isset($rules['validateLang']))
|
|
||||||
foreach ($rules['validateLang'] AS $key => $value)
|
|
||||||
$str_output .= '<tr><td style="text-align:right;width:200px;">'.stripslashes($key).'</td><td style="width: 680px">= <input type="text" name="'.$className.'_'.md5(addslashes($key)).'" value="'.(array_key_exists($className.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$className.'_'.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '').'" style="width: 620px"></td></tr>';
|
|
||||||
$str_output .= '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</fieldset><br />';
|
|
||||||
}
|
|
||||||
$str_output .= '<br /><input type="submit" name="submitTranslationsFields" value="'.$this->l('Update translations').'" class="button" /></form>';
|
|
||||||
}
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1482,12 +1324,12 @@ class AdminTranslations extends AdminTab
|
|||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
public function displayFormMails($lang, $noDisplay = false)
|
public function initFormMails($lang, $noDisplay = false)
|
||||||
{
|
{
|
||||||
$core_mails = array();
|
$core_mails = array();
|
||||||
$module_mails = array();
|
$module_mails = array();
|
||||||
$theme_mails = array();
|
$theme_mails = array();
|
||||||
$str_output = '';
|
$obj_lang = new Language(Language::getIdByIso($lang));
|
||||||
|
|
||||||
// get all mail subjects, this method parse each files in Prestashop !!
|
// get all mail subjects, this method parse each files in Prestashop !!
|
||||||
$subject_mail = array();
|
$subject_mail = array();
|
||||||
@@ -1495,8 +1337,8 @@ class AdminTranslations extends AdminTab
|
|||||||
$arr_files_to_parse = array(
|
$arr_files_to_parse = array(
|
||||||
_PS_ROOT_DIR_.'/controllers',
|
_PS_ROOT_DIR_.'/controllers',
|
||||||
_PS_ROOT_DIR_.'/classes',
|
_PS_ROOT_DIR_.'/classes',
|
||||||
_PS_ADMIN_DIR_.'/tabs',
|
_PS_ADMIN_DIR_.'/tabs',
|
||||||
PS_ADMIN_DIR,
|
_PS_ADMIN_DIR_,
|
||||||
);
|
);
|
||||||
$arr_files_to_parse = array_merge($arr_files_to_parse, $modules_has_mails);
|
$arr_files_to_parse = array_merge($arr_files_to_parse, $modules_has_mails);
|
||||||
foreach ($arr_files_to_parse as $path) {
|
foreach ($arr_files_to_parse as $path) {
|
||||||
@@ -1509,12 +1351,13 @@ class AdminTranslations extends AdminTab
|
|||||||
{
|
{
|
||||||
$module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail');
|
$module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail');
|
||||||
$module_mails[$module_name]['subject'] = $core_mails['subject'];
|
$module_mails[$module_name]['subject'] = $core_mails['subject'];
|
||||||
|
$module_mails[$module_name]['display'] = $this->displayMailContent($module_mails[$module_name], $subject_mail, $obj_lang, Tools::strtolower($module_name), sprintf($this->l('E-mails for %s module'), '<em>'.$module_name.'</em>'), $module_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before 1.4.0.14 each theme folder was parsed,
|
// Before 1.4.0.14 each theme folder was parsed,
|
||||||
// This page was really to low to load.
|
// This page was really to low to load.
|
||||||
// Now just use the current theme.
|
// Now just use the current theme.
|
||||||
if(_THEME_NAME_ !== AdminTranslations::DEFAULT_THEME_NAME)
|
if(_THEME_NAME_ !== self::DEFAULT_THEME_NAME)
|
||||||
{
|
{
|
||||||
if(file_exists(_PS_THEME_DIR_.'mails'))
|
if(file_exists(_PS_THEME_DIR_.'mails'))
|
||||||
{
|
{
|
||||||
@@ -1529,6 +1372,8 @@ class AdminTranslations extends AdminTab
|
|||||||
{
|
{
|
||||||
$theme_mails[$module_dir] = $this->getMailFiles(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails/', $lang, 'theme_module_mail');
|
$theme_mails[$module_dir] = $this->getMailFiles(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails/', $lang, 'theme_module_mail');
|
||||||
$theme_mails[$module_dir]['subject'] = $theme_mails['theme_mail']['subject'];
|
$theme_mails[$module_dir]['subject'] = $theme_mails['theme_mail']['subject'];
|
||||||
|
$title = $theme_or_module_name != 'theme_mail' ? ucfirst(_THEME_NAME_).' '.sprintf($this->l('E-mails for %s module'), '<em>'.$theme_or_module_name.'</em>') : ucfirst(_THEME_NAME_).' '.$this->l('e-mails');
|
||||||
|
$theme_mails[$module_dir]['display'] = $this->displayMailContent($theme_mails[$module_dir], $subject_mail, $obj_lang, 'theme_'.Tools::strtolower($theme_or_module_name), $title, ($theme_or_module_name != 'theme_mail' ? $theme_or_module_name : false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1553,54 +1398,22 @@ class AdminTranslations extends AdminTab
|
|||||||
return array('total' => $total, 'empty' => $empty);
|
return array('total' => $total, 'empty' => $empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj_lang = new Language(Language::getIdByIso($lang));
|
$tpl = $this->context->smarty->createTemplate('translations/translation_mails.tpl');
|
||||||
|
$tpl->assign(array(
|
||||||
// TinyMCE
|
'lang' => Tools::strtoupper($lang),
|
||||||
$str_output .= $this->getTinyMCEForMails($obj_lang->iso_code);
|
'translation_type' => $this->l('E-mail template translations'),
|
||||||
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
$str_output .= '<!--'.$this->l('Language').'-->';
|
'url_submit' => self::$currentIndex.'&submitTranslationsMails=1&token='.$this->token,
|
||||||
$str_output .= '
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('E-mail template translations').'</h2>'
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
.$this->l('Click on the titles to open fieldsets').'.<br /><br />';
|
'type' => 'mails',
|
||||||
|
'tinyMCE' => $this->getTinyMCEForMails($obj_lang->iso_code),
|
||||||
// display form
|
'mail_content' => $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails')),
|
||||||
$str_output .= '
|
'module_mails' => $module_mails,
|
||||||
<form method="post" action="'.self::$currentIndex.'&token='.$this->token.'&type=mails&lang='.$obj_lang->iso_code.'" class="form">';
|
'theme_mails' => $theme_mails
|
||||||
$str_output .= $this->displayToggleButton();
|
));
|
||||||
$str_output .= $this->displaySubmitButtons(Tools::getValue('type'));
|
return $tpl->fetch();
|
||||||
$str_output .= '<br/><br/>';
|
//<input type="hidden" name="type" value="'.Tools::getValue('type').'" />';
|
||||||
|
|
||||||
// core emails
|
|
||||||
$str_output .= $this->l('Core e-mails:');
|
|
||||||
$str_output .= $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails'));
|
|
||||||
// module mails
|
|
||||||
$str_output .= $this->l('Modules e-mails:');
|
|
||||||
foreach ($module_mails as $module_name => $mails)
|
|
||||||
{
|
|
||||||
$str_output .= $this->displayMailContent($mails, $subject_mail, $obj_lang, Tools::strtolower($module_name), sprintf($this->l('E-mails for %s module'), '<em>'.$module_name.'</em>'), $module_name);
|
|
||||||
}
|
|
||||||
// mail theme and module theme
|
|
||||||
if (!empty($theme_mails))
|
|
||||||
{
|
|
||||||
$str_output .= $this->l('Themes e-mails:');
|
|
||||||
$bool_title = false;
|
|
||||||
foreach ($theme_mails as $theme_or_module_name => $mails)
|
|
||||||
{
|
|
||||||
$title = $theme_or_module_name != 'theme_mail' ? ucfirst(_THEME_NAME_).' '.sprintf($this->l('E-mails for %s module'), '<em>'.$theme_or_module_name.'</em>') : ucfirst(_THEME_NAME_).' '.$this->l('e-mails');
|
|
||||||
if ($theme_or_module_name != 'theme_mail' && !$bool_title) {
|
|
||||||
$bool_title = true;
|
|
||||||
$str_output .= $this->l('E-mails modules in theme:');
|
|
||||||
}
|
|
||||||
$str_output .= $this->displayMailContent($mails, $subject_mail, $obj_lang, 'theme_'.Tools::strtolower($theme_or_module_name), $title, ($theme_or_module_name != 'theme_mail' ? $theme_or_module_name : false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$str_output .= '
|
|
||||||
<input type="hidden" name="lang" value="'.$lang.'" />
|
|
||||||
<input type="hidden" name="type" value="'.Tools::getValue('type').'" />';
|
|
||||||
$str_output .= $this->displaySubmitButtons(Tools::getValue('type'));
|
|
||||||
$str_output .= '<br /><br />';
|
|
||||||
$str_output .= '</form>';
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getSubjectMail($directory, $subject_mail)
|
protected static function getSubjectMail($directory, $subject_mail)
|
||||||
@@ -1738,17 +1551,14 @@ class AdminTranslations extends AdminTab
|
|||||||
}
|
}
|
||||||
return $array_files;
|
return $array_files;
|
||||||
}
|
}
|
||||||
public function displayFormModules($lang)
|
public function initFormModules($lang)
|
||||||
{
|
{
|
||||||
global $_MODULES;
|
global $_MODULES;
|
||||||
|
|
||||||
$array_lang_src = Language::getLanguages(false);
|
$array_lang_src = Language::getLanguages(false);
|
||||||
$str_output = '';
|
|
||||||
|
|
||||||
foreach ($array_lang_src as $language)
|
foreach ($array_lang_src as $language)
|
||||||
{
|
|
||||||
$this->all_iso_lang[] = $language['iso_code'];
|
$this->all_iso_lang[] = $language['iso_code'];
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists(_PS_MODULE_DIR_))
|
if (!file_exists(_PS_MODULE_DIR_))
|
||||||
die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')'));
|
die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')'));
|
||||||
@@ -1772,61 +1582,23 @@ class AdminTranslations extends AdminTab
|
|||||||
foreach ($arr_find_and_fill as $value)
|
foreach ($arr_find_and_fill as $value)
|
||||||
$this->findAndFillTranslations($value['files'], $value['theme'], $value['module'], $value['dir'], $lang);
|
$this->findAndFillTranslations($value['files'], $value['theme'], $value['module'], $value['dir'], $lang);
|
||||||
|
|
||||||
$str_output .= '
|
$tpl = $this->context->smarty->createTemplate('translations/translation_modules.tpl');
|
||||||
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Modules translations').'</h2>
|
$tpl->assign(array(
|
||||||
'.$this->l('Total expressions').' : <b>'.$this->total_expression.'</b>. '.$this->l('Click the fieldset title to expand or close the fieldset.').'.<br /><br />';
|
'default_theme_name' => self::DEFAULT_THEME_NAME,
|
||||||
$str_output .= $this->displayLimitPostWarning($this->total_expression);
|
'lang' => Tools::strtoupper($lang),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'translation_type' => $this->l('Modules translations'),
|
||||||
{
|
'count' => $this->total_expression,
|
||||||
$str_output .= '
|
'limit_warning' => $this->displayLimitPostWarning($this->total_expression),
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsModules=1&token='.$this->token.'" class="form">';
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
$str_output .= $this->displayToggleButton();
|
'url_submit' => self::$currentIndex.'&submitTranslationsModules=1&token='.$this->token,
|
||||||
$str_output .= $this->displayAutoTranslate();
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
$str_output .= '<input type="hidden" name="lang" value="'.$lang.'" /><input type="submit" name="submitTranslationsModules" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
|
'textarea_sized' => TEXTAREA_SIZED,
|
||||||
if (count($this->modules_translations) > 1)
|
'type' => 'modules',
|
||||||
{
|
'modules_translations' => isset($this->modules_translations) ? $this->modules_translations : array(),
|
||||||
$str_output .= '<h3 style="padding:0;margin:0;">'.$this->l('List of Themes - Click to access theme translation:').'</h3>';
|
));
|
||||||
$str_output .= '<ul style="list-style-type:none;padding:0;margin:0 0 10px 0;">';
|
return $tpl->fetch();
|
||||||
foreach (array_keys($this->modules_translations) as $theme)
|
|
||||||
$str_output .= '<li><a href="#'.$theme.'" class="link">- '.($theme === 'default' ? $this->l('default') : $theme ).'</a></li>';
|
|
||||||
$str_output .= '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->modules_translations AS $theme_name => $theme)
|
|
||||||
{
|
|
||||||
$str_output .= '<h2>>'.$this->l('Theme:').' <a name="'.$theme_name.'">'.($theme_name === self::DEFAULT_THEME_NAME ? $this->l('default') : $theme_name ).'</h2>';
|
|
||||||
foreach ($theme AS $module_name => $module)
|
|
||||||
{
|
|
||||||
$str_output .= ''.$this->l('Module:').' <a name="'.$module_name.'" style="font-style:italic">'.$module_name.'</a>';
|
|
||||||
foreach ($module AS $template_name => $newLang)
|
|
||||||
if (sizeof($newLang))
|
|
||||||
{
|
|
||||||
$countValues = array_count_values($newLang);
|
|
||||||
$empty = isset($countValues['']) ? $countValues[''] : 0;
|
|
||||||
$str_output .= '
|
|
||||||
<fieldset style="margin-top:5px"><legend style="cursor : pointer" onclick="$(\'#'.$theme_name.'_'.$module_name.'_'.$template_name.'\').slideToggle();">'.($theme_name === 'default' ? $this->l('default') : $theme_name ).' - '.$template_name.' - <font color="blue">'.sizeof($newLang).'</font> '.$this->l('expressions').' (<font color="red">'.$empty.'</font>)</legend>
|
|
||||||
<div name="modules_div" id="'.$theme_name.'_'.$module_name.'_'.$template_name.'" style="display: '.($empty ? 'block' : 'none').';">
|
|
||||||
<table cellpadding="2">';
|
|
||||||
foreach ($newLang AS $key => $value)
|
|
||||||
{
|
|
||||||
$str_output .= '<tr><td style="width: 40%">'.stripslashes($key).'</td><td>= ';
|
|
||||||
if (strlen($key) < TEXTAREA_SIZED)
|
|
||||||
$str_output .= '<input type="text" style="width: 450px" name="'.md5(strtolower($module_name).'_'.strtolower($theme_name).'_'.strtolower($template_name).'_'.md5($key)).'" value="'.stripslashes(preg_replace('/"/', '\"', stripslashes($value))).'" /></td></tr>';
|
|
||||||
else
|
|
||||||
$str_output .= '<textarea rows="'.(int)(strlen($key) / TEXTAREA_SIZED).'" style="width: 450px" name="'.md5(strtolower($module_name).'_'.strtolower($theme_name).'_'.strtolower($template_name).'_'.md5($key)).'">'.stripslashes(preg_replace('/"/', '\"', stripslashes($value))).'</textarea></td></tr>';
|
|
||||||
}
|
|
||||||
$str_output .= '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</fieldset><br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$str_output .= '<br /><input type="submit" name="submitTranslationsModules" value="'.$this->l('Update translations').'" class="button" /></form>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** parse $filepath to find expression which match $regex, and return an
|
/** parse $filepath to find expression which match $regex, and return an
|
||||||
@@ -1848,11 +1620,10 @@ class AdminTranslations extends AdminTab
|
|||||||
return $tabsArray;
|
return $tabsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFormPDF()
|
public function initFormPDF()
|
||||||
{
|
{
|
||||||
$lang = Tools::strtolower(Tools::getValue('lang'));
|
$lang = Tools::strtolower(Tools::getValue('lang'));
|
||||||
$_LANG = array();
|
$_LANG = array();
|
||||||
$str_output = '';
|
|
||||||
|
|
||||||
if (!file_exists(_PS_TRANSLATIONS_DIR_.$lang))
|
if (!file_exists(_PS_TRANSLATIONS_DIR_.$lang))
|
||||||
if (!mkdir(_PS_TRANSLATIONS_DIR_.$lang, 0700))
|
if (!mkdir(_PS_TRANSLATIONS_DIR_.$lang, 0700))
|
||||||
@@ -1874,50 +1645,22 @@ class AdminTranslations extends AdminTab
|
|||||||
$tabsArray = $this->_parsePdfClass(_PS_ROOT_DIR_.'/override/classes/PDF.php', $regex, $_LANGPDF, $tab, $tabsArray);
|
$tabsArray = $this->_parsePdfClass(_PS_ROOT_DIR_.'/override/classes/PDF.php', $regex, $_LANGPDF, $tab, $tabsArray);
|
||||||
|
|
||||||
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
|
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
|
||||||
$closed = sizeof($_LANGPDF) >= $count;
|
|
||||||
|
|
||||||
$str_output .= $this->displayAutoTranslate();
|
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl');
|
||||||
$str_output .= '<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).'</h2>'
|
$tpl->assign(array(
|
||||||
.$this->l('Expressions to translate').' : <b>'.$count.'</b>. '.$this->l('Click on the titles to open fieldsets').'.<br /><br />';
|
'lang' => Tools::strtoupper($lang),
|
||||||
$str_output .= $this->displayLimitPostWarning($count);
|
'translation_type' => $this->l('PDF translations'),
|
||||||
if (!$this->suhosin_limit_exceed)
|
'count' => $count,
|
||||||
{
|
'limit_warning' => $this->displayLimitPostWarning($this->total_expression),
|
||||||
$str_output .= '
|
'suoshin_exceeded' => $this->suhosin_limit_exceed,
|
||||||
<form method="post" action="'.self::$currentIndex.'&submitTranslationsPDF=1&token='.$this->token.'" class="form">
|
'url_submit' => self::$currentIndex.'&submitTranslationsPdf=1&token='.$this->token,
|
||||||
<script type="text/javascript">
|
'toggle_button' => $this->displayToggleButton(),
|
||||||
var openAll = \''.html_entity_decode($this->l('Expand all fieldsets'), ENT_NOQUOTES, 'UTF-8').'\';
|
'auto_translate' => $this->displayAutoTranslate(),
|
||||||
var closeAll = \''.html_entity_decode($this->l('Close all fieldsets'), ENT_NOQUOTES, 'UTF-8').'\';
|
'textarea_sized' => TEXTAREA_SIZED,
|
||||||
</script>
|
'type' => 'pdf',
|
||||||
<input type="hidden" name="lang" value="'.$lang.'" />
|
'tabsArray' => $tabsArray,
|
||||||
<input type="button" class="button" id="buttonall" onclick="openCloseAllDiv(\'pdf_div\', this.value == openAll); toggleElemValue(this.id, openAll, closeAll);" />
|
));
|
||||||
<script type="text/javascript">
|
return $tpl->fetch();
|
||||||
toggleElemValue(\'buttonall\', '.($closed ? 'openAll' : 'closeAll').', '.($closed ? 'closeAll' : 'openAll').');
|
|
||||||
</script>';
|
|
||||||
$str_output .= '<input type="submit" name="submitTranslationsPDF" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
|
|
||||||
foreach ($tabsArray AS $k => $newLang)
|
|
||||||
if (sizeof($newLang))
|
|
||||||
{
|
|
||||||
$countValues = array_count_values($newLang);
|
|
||||||
$empty = isset($countValues['']) ? $countValues[''] : 0;
|
|
||||||
$str_output .= '<fieldset><legend style="cursor : pointer" onclick="$(\'#'.$k.'-tpl\').slideToggle();">'.$k.' - <font color="blue">'.sizeof($newLang).'</font> '.$this->l('expressions').' (<font color="red">'.$empty.'</font>)</legend>
|
|
||||||
<div name="pdf_div" id="'.$k.'-tpl" style="display: '.($empty ? 'block' : 'none').';">
|
|
||||||
<table cellpadding="2">';
|
|
||||||
foreach ($newLang AS $key => $value)
|
|
||||||
{
|
|
||||||
$str_output .= '<tr>
|
|
||||||
<td>'.stripslashes($key).'</td>
|
|
||||||
<td style="width: 580px">
|
|
||||||
= <input type="text" name="'.$k.md5($key).'" value="'.stripslashes(preg_replace('/"/', '\"', $value)).'" style="width: 515px">
|
|
||||||
</td>
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
$str_output .= '</table>
|
|
||||||
</div>
|
|
||||||
</fieldset><br />';
|
|
||||||
}
|
|
||||||
$str_output .= '<br /><input type="submit" name="submitTranslationsPDF" value="'.$this->l('Update translations').'" class="button" /></form>';
|
|
||||||
}
|
|
||||||
echo $str_output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reference in New Issue
Block a user