[*] BO : #PSFV-94 - added AdminTranslationsController

This commit is contained in:
tDidierjean
2011-11-10 10:56:29 +00:00
parent 0a4cb9321a
commit 36d3c9e409
7 changed files with 644 additions and 458 deletions
File diff suppressed because it is too large Load Diff
@@ -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}&nbsp;</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> &nbsp;
<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" /> &nbsp;<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>
&nbsp;&nbsp;&nbsp;
<select name="theme" style="margin-top:10px;">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
{/foreach}
</select>&nbsp;&nbsp;
<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>
&nbsp;&nbsp;&nbsp;
<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>
&nbsp;&nbsp;&nbsp;
<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:'#"#':'&quot;'|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:'#"#':'&quot;'|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:'#"#':'&quot;'|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>&gt;{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:'#"#':'&quot;'|stripslashes}" />
{else}
<textarea rows="{($key|strlen / $textarea_sized)|intval}"
style="width: 450px"
name="{$name|md5}">
{$value|regex_replace:'#"#':'&quot;'|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}