// Refacto AdminTranslationsController : now you can translated your files by themes

This commit is contained in:
lLefevre
2012-04-23 08:11:54 +00:00
parent dd37dfa337
commit 0c4f360474
9 changed files with 1124 additions and 881 deletions
@@ -33,6 +33,25 @@
getE('translation_lang').value = id_lang;
document.getElementById('typeTranslationForm').submit();
}
function addThemeSelect(el)
{
var list_type_for_theme = [{foreach $translations_type_for_theme as $type}'{$type}', {/foreach}];
var type = el.value;
$('select[name=theme]').hide();
for (i=0; i < list_type_for_theme.length; i++)
if (list_type_for_theme[i] == type)
$('select[name=theme]').show();
else
$('select[name=theme]').val('{$theme_default}');
}
$(document).ready(function(){
$('select[name=type]').change(function() {
addThemeSelect(this);
});
});
</script>
<fieldset>
@@ -40,15 +59,20 @@
{l s='Here you can modify translations for all text input in 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="controller" 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 $translations_type as $type => $array}
<option value="{$type}">{$array.name} &nbsp;</option>
{/foreach}
</select>
<select name="theme" style="float:left; margin-right:10px;">
{foreach $themes as $theme}
<option value="{$theme->directory}">{$theme->name} &nbsp;</option>
{/foreach}
</select>
{foreach $languages as $language}
<a href="javascript:chooseTypeTranslation('{$language['iso_code']}')">
<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}
@@ -117,7 +141,7 @@
&nbsp;&nbsp;&nbsp;
<select name="theme" style="margin-top:10px;">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
<option value="{$theme->directory}">{$theme->name}</option>
{/foreach}
</select>&nbsp;&nbsp;
<input type="submit" class="button" name="submitExport" value="{l s='Export'}" />
@@ -141,7 +165,7 @@
&nbsp;&nbsp;&nbsp;
<select name="fromTheme">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
<option value="{$theme->directory}">{$theme->name}</option>
{/foreach}
</select> <span style="font-style: bold; color: red;">*</span>
</p>
@@ -155,7 +179,7 @@
&nbsp;&nbsp;&nbsp;
<select name="toTheme">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
<option value="{$theme->directory}">{$theme->name}</option>
{/foreach}
</select>
</p>
@@ -27,10 +27,12 @@
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{l s='Expressions to translate'} : <b>{$count}</b>.
<p>{l s='Total missing expresssions:'} {$count_empty} </p>
<p>
{l s='Expressions to translate'} : <b>{$count}</b>.<br />
{l s='Total missing expresssions:'} {$missing_translations}<br />
</p>
{if $post_limit_exceeded}
<div class="warn">
{if $limit_warning['error_type'] == 'suhosin'}
@@ -50,6 +52,8 @@
<form method="post" id="{$table}_form" action="{$url_submit}" class="form">
{*{$auto_translate}$*}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<br /><br />
<table cellpadding="0" cellspacing="0" class="table">
@@ -28,10 +28,13 @@
{block name="override_tpl"}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{l s='Expressions to translate'} : <b>{$count}</b>.
<div class="hint" style="display:block;">{l s='Click on the titles to open fieldsets'}.</div><br /><br />
<p>{l s='total missing expresssions:'} {$missing_translations|array_sum} </p>
<p>
{l s='Expressions to translate'} : <b>{$count}</b>.<br />
{l s='Total missing expresssions:'} {$missing_translations|array_sum}.<br />
</p>
{if $post_limit_exceeded}
<div class="warn">
{if $limit_warning['error_type'] == 'suhosin'}
@@ -51,6 +54,8 @@
<form method="post" id="{$table}_form" action="{$url_submit}" class="form">
{$toggle_button}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<br /><br />
{foreach $tabsArray as $k => $newLang}
@@ -27,10 +27,11 @@
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<div class="hint" style="display:block;">{l s='Click on the titles to open fieldsets'}.</div><br /><br />
{$tinyMCE}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{if $post_limit_exceeded}
<div class="warn">
{if $limit_warning['error_type'] == 'suhosin'}
@@ -47,37 +48,22 @@
<u><b>{$limit_warning['needed_limit']}</b></u> {l s='at least.'} {l s='or edit the translation file manually.'}
</div>
{else}
<div class="hint" style="display:block;">{l s='Click on the titles to open fieldsets'}.</div><br />
<form method="post" id="{$table}_form" action="{$url_submit}" class="form">
{$toggle_button}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="submit" id="{$table}_form_submit_btn" 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" />*}
<h2>{l s='Core e-mails:'}</h2>
<p class="preference_description">{l s='List of emails which are in the folder'} <strong>"mails/{$lang|strtolower}/"</strong></p>
{$mail_content}
{$toggle_button}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<h2>{l s='Module e-mails:'}</h2>
<p class="preference_description">{l s='List of emails which are in the folder'} <strong>"modules/name_of_module/mails/{$lang|strtolower}/"</strong></p>
{foreach $module_mails as $module_name => $mails}
{$mails['display']}
{/foreach}
<h2>{l s='Core e-mails:'}</h2>
<p class="preference_description">{l s='List of emails which are in the folder'} <strong>"mails/{$lang|strtolower}/"</strong></p>
{$mail_content}
{if !empty($theme_mails)}
<h2>{l s='Theme e-mails:'}</h2>
<p class="preference_description" style="width:100%">{l s='List of emails of theme'} {$theme_name|ucfirst} {l s='which are in the folder'}" <strong>{$theme_name}/mails/{$lang|strtolower}/"</strong></p>
{$bool_title = false}
{foreach $theme_mails as $theme_or_module_name => $mails}
{if $theme_or_module_name != 'theme_mail' && !$bool_title}
{$bool_title = true}
<h2>{l s='E-mail modules in theme:'}</h2>
<p class="preference_description" style="width:100%">{l s='List of emails of theme'} {$theme_name|ucfirst} {l s='which are in the folder'}" <strong>{$theme_name}/modules/name_of_module/mails/{$lang|strtolower}/"</strong></p>
{/if}
<h2>{l s='Module e-mails:'}</h2>
<p class="preference_description">{l s='List of emails which are in the folder'} <strong>"modules/name_of_module/mails/{$lang|strtolower}/"</strong></p>
{foreach $module_mails as $module_name => $mails}
{$mails['display']}
{/foreach}
{/if}
</form>
{/if}
@@ -27,9 +27,14 @@
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{l s='Expressions to translate'} : <b>{$count}</b>.
<div class="hint" style="display:block;">{l s='Click on the titles to open fieldsets'}.</div><br /><br />
<p>
{l s='Expressions to translate'} : <b>{$count}</b>.<br />
{l s='Total missing expresssions:'} {$missing_translations}.<br />
</p>
{if $post_limit_exceeded}
<div class="warn">
{if $limit_warning['error_type'] == 'suhosin'}
@@ -46,10 +51,11 @@
<u><b>{$limit_warning['needed_limit']}</b></u> {l s='at least.'} {l s='or edit the translation file manually.'}
</div>
{else}
<div class="hint" style="display:block;">{l s='Click on the titles to open fieldsets'}.</div><br />
<form method="post" id="{$table}_form" action="{$url_submit}" class="form">
{$toggle_button}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<br />
@@ -70,15 +76,15 @@
{if !empty($newLang)}
{$occurrences = $newLang|array_count_values}
{if isset($occurrences[''])}
{$missing_translations = $occurrences['']}
{$missing_translations_module = $occurrences['']}
{else}
{$missing_translations = 0}
{$missing_translations_module = 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>)
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations_module}</font>)
</legend>
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations}block{else}none{/if}">
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations_module}block{else}none{/if}">
<table cellpadding="2">
{foreach $newLang as $key => $value}
<tr>