aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--langs.inc.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/langs.inc.php b/langs.inc.php
index bd6af3bda..a28b9775c 100644
--- a/langs.inc.php
+++ b/langs.inc.php
@@ -491,6 +491,9 @@ function read_translation_file($locale, $name_of_translation)
* Examples:
* echo _r("Hello!", ' ') . _r("How are you?")
* which should return translated: Hello! How are you?
+ *
+ * change order of placeholders
+ * sprintf(_r('<a href=%1$s>Mageia %2$s</a> updated to %3$s.'), '"../8/"', '8', _r('8.1'))
*
* @param string $string_for_translation which we want to translate
* @param string $sufix append (usually space)
@@ -500,18 +503,16 @@ function read_translation_file($locale, $name_of_translation)
function _r($string_for_translation, $sufix = '')
{
global $dictionary;
- $escapeded_string = str_replace(array('"'), array('\\"'), $string_for_translation);
+ $escapeded_string = str_replace(array('"', '$'), array('\\"', '\$'), $string_for_translation);
if(!empty($dictionary[$escapeded_string][0][0])) {
- $find = array('\\"', '\n', ' ', '{ok}', '{OK}', '{Ok}', '{oK}');
- $replace = array('"','<br>', ' ');
+ $find = array('\$', '\\"', '\n', ' ', '{ok}', '{OK}', '{Ok}', '{oK}');
+ $replace = array('$', '"','<br>', ' ');
$prepared_string = trim(str_replace($find, $replace, $dictionary[$escapeded_string][0][0]));
}
if(empty($prepared_string)) {
$prepared_string = $string_for_translation;
}
- if(!empty($sufix)) {
- $prepared_string .= $sufix;
- }
+ $prepared_string .= $sufix;
return $prepared_string;
}