CRM-16080 - CRM.strings - Preserve variable placeholders
authorTim Otten <totten@civicrm.org>
Fri, 20 Mar 2015 02:43:39 +0000 (19:43 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 20 Mar 2015 02:43:39 +0000 (19:43 -0700)
CRM/Core/I18n.php
CRM/Core/Resources.php

index a7feda269502592c4a04458334b0dfed6e8743f6..fee6c84dd2c2e094ca6e500f562a14cd1b5adb5f 100644 (file)
@@ -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);
     }
 
index f098456209a92473a7f7391fec47c79d35ac59cb..0c463d07e20265a6bba80464dd138a835ec03908 100644 (file)
@@ -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