summaryrefslogtreecommitdiff
path: root/core/libraries/I18n.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/libraries/I18n.php')
-rw-r--r--core/libraries/I18n.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/libraries/I18n.php b/core/libraries/I18n.php
index 0aa6652b..04176b75 100644
--- a/core/libraries/I18n.php
+++ b/core/libraries/I18n.php
@@ -68,7 +68,7 @@ class I18n_Core {
/**
* Translates a localizable message.
* @param $message String|array The message to be translated. E.g. "Hello world"
- * or array("one" => "One album", "other" => "{{count}} albums")
+ * or array("one" => "One album", "other" => "%count albums")
* @param $options array (optional) Options array for key value pairs which are used
* for pluralization and interpolation. Special keys are "count" and "locale",
* the latter to override the currently configured locale.
@@ -118,9 +118,13 @@ class I18n_Core {
private function interpolate($locale, $string, $values) {
// TODO: Handle locale specific number formatting.
+
+ // Replace x_y before replacing x.
+ krsort($values, SORT_STRING);
+
$keys = array();
foreach (array_keys($values) as $key) {
- $keys[] = "{{" . $key . "}}";
+ $keys[] = "%$key";
}
return str_replace($keys, array_values($values), $string);
}