From 9fec968488ca4ab08082af3cb340415dcf9add0f Mon Sep 17 00:00:00 2001 From: Sylvain WITMEYER Date: Fri, 12 Jul 2013 15:17:09 +0200 Subject: [PATCH] Update Translate.php Translations shouldn't be cached if they contain dynamic vars (sprintf) On productcomments,
  • {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful, $comment.total_advice] mod='productcomments'}
  • was always printing the same sentence --- classes/Translate.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/Translate.php b/classes/Translate.php index 549158861..bbf4a5bdd 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -180,7 +180,13 @@ class TranslateCore if ($js) $ret = addslashes($ret); - $lang_cache[$cache_key] = str_replace('"', '"', $ret); + $ret = str_replace('"', '"', $ret); + + if ($sprintf === null) + $lang_cache[$cache_key] = $ret; + else + return $ret; + } return $lang_cache[$cache_key]; }