// Fix Message in AdminTranslationsController when use sprintf()

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15663 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2012-05-24 13:52:49 +00:00
parent 874e8924e7
commit daa22a31cd
6 changed files with 53 additions and 17 deletions
@@ -46,7 +46,7 @@
{else}
<div class="hint" style="display:block;">
{l s='Some sentences to translate uses this syntax: %s...: You must let it in your translations.' sprintf='%d, %s, %1$s, %2$d'}
{l s='Some sentences to translate use this syntax: %s... These are variables, and PrestaShop take care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.' sprintf='%d, %s, %1$s, %2$d'}
</div><br /><br />
<p>
@@ -58,7 +58,7 @@
$(document).ready(function(){
$('a.useSpecialSyntax').click(function(){
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax);
$('#BoxUseSpecialSyntax .syntax span').html(syntax+".");
$('#BoxUseSpecialSyntax').toggle(1000);
});
$('#BoxUseSpecialSyntax').click(function(){
@@ -70,8 +70,8 @@
<div id="BoxUseSpecialSyntax">
<div class="warn">
<p class="syntax">
{l s='This expression uses this special syntax:'} <span>%d</span><br />
{l s='You must use this syntax in your tanslations. Here are several examples of use:'}
{l s='This expression uses this special syntax:'} <span>%d.</span><br />
{l s='You must use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li><em>There are <strong>%d</strong> products</em> ("<strong>%d</strong>" {l s='will be replaced by a number'}).</li>
@@ -48,7 +48,7 @@
<div class="hint" style="display:block;">
<ul style="margin-left:30px;list-style-type:disc;">
<li>{l s='Click on the titles to open fieldsets'}.</li>
<li>{l s='Some sentences to translate uses this syntax: %s...: You must let it in your translations.' sprintf='%d, %s, %1$s, %2$d'}</li>
<li>{l s='Some sentences to translate use this syntax: %s... These are variables, and PrestaShop take care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.' sprintf='%d, %s, %1$s, %2$d'}</li>
</ul>
</div><br /><br />
@@ -68,7 +68,7 @@
$(document).ready(function(){
$('a.useSpecialSyntax').click(function(){
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax);
$('#BoxUseSpecialSyntax .syntax span').html(syntax+".");
$('#BoxUseSpecialSyntax').toggle(1000);
});
$('#BoxUseSpecialSyntax').click(function(){
@@ -80,8 +80,8 @@
<div id="BoxUseSpecialSyntax">
<div class="warn">
<p class="syntax">
{l s='This expression uses this special syntax:'} <span>%d</span><br />
{l s='You must use this syntax in your tanslations. Here are several examples of use:'}
{l s='This expression uses this special syntax:'} <span>%d.</span><br />
{l s='You must use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li><em>There are <strong>%d</strong> products</em> ("<strong>%d</strong>" {l s='will be replaced by a number'}).</li>
@@ -50,6 +50,7 @@
<div class="hint" style="display:block;">
<ul style="margin-left:30px;list-style-type:disc;">
<li>{l s='Click on the titles to open fieldsets'}.</li>
<li>{l s='Some sentences to translate use this syntax: %s... These are variables, and PrestaShop take care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.' sprintf='%d, %s, %1$s, %2$d'}</li>
</ul>
</div><br /><br />
@@ -60,6 +61,33 @@
<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" />
<script type="text/javascript">
$(document).ready(function(){
$('a.useSpecialSyntax').click(function(){
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax+".");
$('#BoxUseSpecialSyntax').toggle(1000);
});
$('#BoxUseSpecialSyntax').click(function(){
$('#BoxUseSpecialSyntax').toggle(1000);
});
});
</script>
<div id="BoxUseSpecialSyntax">
<div class="warn">
<p class="syntax">
{l s='This expression uses this special syntax:'} <span>%d.</span><br />
{l s='You must use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li><em>There are <strong>%d</strong> products</em> ("<strong>%d</strong>" {l s='will be replaced by a number'}).</li>
<li><em>List of pages in <strong>%s</strong>:</em> ("<strong>%s</strong>" {l s='will be replaced by a string'}).</li>
<li><em>Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)</em> ("<strong>n$</strong>" {l s='is used for the order of the arguments'}).</li>
</ul>
</div>
</div>
<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}
@@ -48,7 +48,7 @@
<div class="hint" style="display:block;">
<ul style="margin-left:30px;list-style-type:disc;">
<li>{l s='Click on the titles to open fieldsets'}.</li>
<li>{l s='Some sentences to translate uses this syntax: %s...: You must let it in your translations.' sprintf='%d, %s, %1$s, %2$d'}</li>
<li>{l s='Some sentences to translate use this syntax: %s... These are variables, and PrestaShop take care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.' sprintf='%d, %s, %1$s, %2$d'}</li>
</ul>
</div><br /><br />
@@ -61,7 +61,7 @@
$(document).ready(function(){
$('a.useSpecialSyntax').click(function(){
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax);
$('#BoxUseSpecialSyntax .syntax span').html(syntax+".");
$('#BoxUseSpecialSyntax').toggle(1000);
});
$('#BoxUseSpecialSyntax').click(function(){
@@ -73,8 +73,8 @@
<div id="BoxUseSpecialSyntax">
<div class="warn">
<p class="syntax">
{l s='This expression uses this special syntax:'} <span>%d</span><br />
{l s='You must use this syntax in your tanslations. Here are several examples of use:'}
{l s='This expression uses this special syntax:'} <span>%d.</span><br />
{l s='You must use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li><em>There are <strong>%d</strong> products</em> ("<strong>%d</strong>" {l s='will be replaced by a number'}).</li>
@@ -1907,6 +1907,7 @@ class AdminTranslationsControllerCore extends AdminController
{
if (array_key_exists('html', $mail_files) || array_key_exists('txt', $mail_files))
{
//d(array($mail_name, $all_subject_mail));
if (array_key_exists($mail_name, $all_subject_mail))
{
$subject_mail = $all_subject_mail[$mail_name];
@@ -1916,8 +1917,14 @@ class AdminTranslationsControllerCore extends AdminController
<label style="text-align:right">'.sprintf($this->l('Subject for %s:'), '<em>'.$mail_name.'</em>').'</label>
<div class="mail-form" style="text-align:left">
<b>'.$subject_mail.'</b><br />
<input type="text" name="subject['.$group_name.']['.$subject_mail.']" value="'.$value_subject_mail.'" />
</div>
<input type="text" name="subject['.$group_name.']['.$subject_mail.']" value="'.$value_subject_mail['trad'].'" />';
if (isset($value_subject_mail['use_sprintf']) && $value_subject_mail['use_sprintf'])
{
$str_return .= '<a class="useSpecialSyntax" title="'.$this->l('This expression uses a special syntax:').' '.$value_subject_mail['use_sprintf'].'" style="cursor:pointer">
<img src="'._PS_IMG_.'admin/error.png" alt="'.$value_subject_mail['use_sprintf'].'" />
</a>';
}
$str_return .= '</div>
</div>';
}
else
@@ -2189,7 +2196,8 @@ class AdminTranslationsControllerCore extends AdminController
$subject = str_replace('\n', ' ', $subject);
$subject = str_replace("\\'", "\'", $subject);
$subject_mail_content[$key] = htmlentities($subject, ENT_QUOTES, 'UTF-8');
$subject_mail_content[$key]['trad'] = htmlentities($subject, ENT_QUOTES, 'UTF-8');
$subject_mail_content[$key]['use_sprintf'] = $this->checkIfKeyUseSprintf($key);
}
}
else
+2 -2
View File
@@ -4004,6 +4004,7 @@ $_LANGADM['AdminTranslations521ade85487f9f4fc04fa6549cb2ff79'] = 'Attention, vot
$_LANGADM['AdminTranslations524d7e787cc63c50e0d1946ee8ef0bef'] = 'Ajouter ou mettre à jour la langue';
$_LANGADM['AdminTranslations5362fd08e83f50a2866c7b4c23356877'] = 'Choisissez le thème duquel vous souhaitez exporter les traductions.';
$_LANGADM['AdminTranslations53b3cae42737979c884275593a01f468'] = 'Module :';
$_LANGADM['AdminTranslations54524210ee89080b3da6c88a11c6d438'] = 'Vous devez utilisé cette syntaxe dans vos traductions. Voici quelques exemples :';
$_LANGADM['AdminTranslations5607dc45ebdfc0baaab64d944aa88f47'] = 'pour max_input_vars';
$_LANGADM['AdminTranslations57fa5be19cbdbe09aa4f555b2ee710b3'] = 'Mettre à jour';
$_LANGADM['AdminTranslations5fb63579fc981698f97d55bfecb213ea'] = 'Copier';
@@ -4011,7 +4012,6 @@ $_LANGADM['AdminTranslations6700e23ddf33bd4421249c9ef94d6295'] = 'Exporter des t
$_LANGADM['AdminTranslations693fe609a9e3f79343ab35da56fb5eed'] = 'Traductions modèles d\'e-mails';
$_LANGADM['AdminTranslations6b13904f9eecabe20d88f942e84e1cb8'] = '%1$s (Langue: %2$s, Thème: %3$s)';
$_LANGADM['AdminTranslations6c68b66c8d52abd404c6e59fa3287860'] = 'Expression à traduire : %d.';
$_LANGADM['AdminTranslations6dc11ca4c18457c07c0c0de8a53bd0ad'] = 'Quelques expressions à traduire utilise cette syntaxe: %s...: Vous devez les laisser dans vos traductions.';
$_LANGADM['AdminTranslations6e4fd86b4ea240672daa3c2fe1118fe0'] = 'Déplier tous les blocs';
$_LANGADM['AdminTranslations7084cbcddaa2af4a713a1727727b86f8'] = 'E-mails du coeur :';
$_LANGADM['AdminTranslations72d6d7a1885885bb55a565fd1070581a'] = 'Importer';
@@ -4044,7 +4044,6 @@ $_LANGADM['AdminTranslationsb3cb7b15aa2fb2cb6675414233a3aa1b'] = 'Objet pour %s
$_LANGADM['AdminTranslationsc06a778aeea1249390e1e61d4772e96d'] = 'Aucun sujet n\'a été trouvé pour %s, ou le sujet est généré depuis la base de données.';
$_LANGADM['AdminTranslationsc21f969b5f03d33d43e04f8f136e7682'] = 'par défaut';
$_LANGADM['AdminTranslationsc55cb507e1107a57a37791ec42635ca4'] = 'Si nécessaire';
$_LANGADM['AdminTranslationsc95ceccd47239766e52e0345da697eb6'] = 'Vous devez utilisé cette syntaxe dans vos traductions. Voici quelques exemples d\'utilisations :';
$_LANGADM['AdminTranslationscab84f79f4bb552ebe0a62fa1965ec7b'] = 'Si vous décidez de mettre à jour une langue existante, toutes les modifications de traduction que vous avez apportées au thème \"prestashop\" pour cette langue seront perdues. Cela inclus les traductions du front-office et des e-mails par défaut.';
$_LANGADM['AdminTranslationscb7c902e308b5e3a793da2256253cec6'] = 'Attention, votre configuration PHP limite le nombre maximum de champs d\'un formulaire';
$_LANGADM['AdminTranslationsd2298f4722b53d97039abbe9d1c11a44'] = 'Veuillez vous assurer que les fichiers anglais existent dans le dossier %s';
@@ -4058,6 +4057,7 @@ $_LANGADM['AdminTranslationsdae1228a5ffa648c6c756b680a6d4925'] = 'Liste des emai
$_LANGADM['AdminTranslationsdc270a086ec1b0304c86591f402ade8d'] = 'Pack de langue à importer :';
$_LANGADM['AdminTranslationsdedb1be889dd8a3069986451df540216'] = 'Google Translate suggère :';
$_LANGADM['AdminTranslationse1686cbdbfefdc838c58469866922b6c'] = 'Fermer tous les blocs';
$_LANGADM['AdminTranslationse5c00f5a2a221016210f0f721943fe1b'] = 'Certaines des expressions à traduire utilisent la syntaxe suivante : %s... Ce sont des variables, et PrestaShop s\'occupe de les remplacer par une valeur avec d\'afficher votre traduction. Vous devez donc les laisser dans vos traductions, et les placer dans vos phrases de la manière la plus appropriée.';
$_LANGADM['AdminTranslationsea21841da70e6405af19fabc4ff8bdd9'] = 'manquantes';
$_LANGADM['AdminTranslationsea4788705e6873b424c65e91c2846b19'] = 'Annuler';
$_LANGADM['AdminTranslationseeafac73c8b9aade3a0baa5c4f371d69'] = 'Traductions Front Office';