diff options
Diffstat (limited to 'langs.inc.php')
-rw-r--r-- | langs.inc.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/langs.inc.php b/langs.inc.php index bd6af3bda..554d06cba 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -459,7 +459,7 @@ function read_translation_file($locale, $name_of_translation) if(is_array($name_of_translation)) { $dictionary = array(); foreach($name_of_translation as $single_filename) { - $dictionary = array_merge($dictionary, read_translation_file($locale, $single_filename)); + $dictionary = $dictionary + read_translation_file($locale, $single_filename); } return $dictionary; } else { @@ -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; } |