From daa22a31cd6ed7297f0a8b093f3057323448d288 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Thu, 24 May 2012 13:52:49 +0000 Subject: [PATCH] // 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 --- .../helpers/view/translation_errors.tpl | 8 +++--- .../helpers/view/translation_form.tpl | 8 +++--- .../helpers/view/translation_mails.tpl | 28 +++++++++++++++++++ .../helpers/view/translation_modules.tpl | 8 +++--- .../admin/AdminTranslationsController.php | 14 ++++++++-- translations/fr/admin.php | 4 +-- 6 files changed, 53 insertions(+), 17 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_errors.tpl b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_errors.tpl index d78702060..5b526688d 100644 --- a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_errors.tpl +++ b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_errors.tpl @@ -46,7 +46,7 @@ {else}
- {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'}


@@ -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 @@

- {l s='This expression uses this special syntax:'} %d
- {l s='You must use this syntax in your tanslations. Here are several examples of use:'} + {l s='This expression uses this special syntax:'} %d.
+ {l s='You must use this syntax in your translations. Here are several examples:'}

  • There are %d products ("%d" {l s='will be replaced by a number'}).
  • diff --git a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_form.tpl b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_form.tpl index 9aa8979a9..131626c72 100644 --- a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_form.tpl +++ b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_form.tpl @@ -48,7 +48,7 @@
    • {l s='Click on the titles to open fieldsets'}.
    • -
    • {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'}


    @@ -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 @@

    - {l s='This expression uses this special syntax:'} %d
    - {l s='You must use this syntax in your tanslations. Here are several examples of use:'} + {l s='This expression uses this special syntax:'} %d.
    + {l s='You must use this syntax in your translations. Here are several examples:'}

    • There are %d products ("%d" {l s='will be replaced by a number'}).
    • diff --git a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_mails.tpl b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_mails.tpl index 759ead65c..5e0a758c3 100644 --- a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_mails.tpl +++ b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_mails.tpl @@ -50,6 +50,7 @@
      • {l s='Click on the titles to open fieldsets'}.
      • +
      • {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'}


      @@ -60,6 +61,33 @@ + + +
      +
      +

      + {l s='This expression uses this special syntax:'} %d.
      + {l s='You must use this syntax in your translations. Here are several examples:'} +

      +
        +
      • There are %d products ("%d" {l s='will be replaced by a number'}).
      • +
      • List of pages in %s: ("%s" {l s='will be replaced by a string'}).
      • +
      • Feature: %1$s (%2$d values) ("n$" {l s='is used for the order of the arguments'}).
      • +
      +
      +
      +

      {l s='Core e-mails:'}

      {l s='List of emails which are in the folder'} "mails/{$lang|strtolower}/"

      {$mail_content} diff --git a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_modules.tpl b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_modules.tpl index 4254f8e5e..114ac827e 100644 --- a/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_modules.tpl +++ b/admin-dev/themes/default/template/controllers/translations/helpers/view/translation_modules.tpl @@ -48,7 +48,7 @@
      • {l s='Click on the titles to open fieldsets'}.
      • -
      • {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'}


      @@ -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 @@

      - {l s='This expression uses this special syntax:'} %d
      - {l s='You must use this syntax in your tanslations. Here are several examples of use:'} + {l s='This expression uses this special syntax:'} %d.
      + {l s='You must use this syntax in your translations. Here are several examples:'}

      • There are %d products ("%d" {l s='will be replaced by a number'}).
      • diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 39daa03dc..10ac7a475 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -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
        '.$subject_mail.'
        - -
        + '; + if (isset($value_subject_mail['use_sprintf']) && $value_subject_mail['use_sprintf']) + { + $str_return .= ' + '.$value_subject_mail['use_sprintf'].' + '; + } + $str_return .= '
      '; } 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 diff --git a/translations/fr/admin.php b/translations/fr/admin.php index b6d42be3c..9faa8c1af 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -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';