From 1b4710da72a4804fbc491862692a0e6b8f354cf3 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 19 Mar 2015 19:43:39 -0700 Subject: [PATCH] CRM-16080 - CRM.strings - Preserve variable placeholders --- CRM/Core/I18n.php | 5 ++++- CRM/Core/Resources.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php index a7feda2695..fee6c84dd2 100644 --- a/CRM/Core/I18n.php +++ b/CRM/Core/I18n.php @@ -268,6 +268,9 @@ class CRM_Core_I18n { $domain = NULL; } + $raw = !empty($params['raw']); + unset($params['raw']); + if (!empty($domain)) { // It might be prettier to cast to an array, but this is high-traffic stuff. if (is_array($domain)) { @@ -288,7 +291,7 @@ class CRM_Core_I18n { } // replace the numbered %1, %2, etc. params if present - if (count($params)) { + if (count($params) && !$raw) { $text = $this->strarg($text, $params); } diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index f098456209..0c463d07e2 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -387,6 +387,7 @@ class CRM_Core_Resources { foreach ((array) $text as $str) { $translated = ts($str, array( 'domain' => ($domain == 'civicrm') ? NULL : array($domain, NULL), + 'raw' => TRUE, )); // We only need to push this string to client if the translation -- 2.25.1