aboutsummaryrefslogtreecommitdiffstats
path: root/langs.inc.php
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2021-02-28 22:11:34 +0100
committerfilip <filip.komar@gmail.com>2021-02-28 22:11:34 +0100
commit906427113f0a87a45b19f46f175a4ef39ff40009 (patch)
tree1b8439ededed863772e1044617257f0409b4e149 /langs.inc.php
parentd5935eaabe5ad8b5ce0f07f5868d241fb8819761 (diff)
downloadwww-906427113f0a87a45b19f46f175a4ef39ff40009.tar
www-906427113f0a87a45b19f46f175a4ef39ff40009.tar.gz
www-906427113f0a87a45b19f46f175a4ef39ff40009.tar.bz2
www-906427113f0a87a45b19f46f175a4ef39ff40009.tar.xz
www-906427113f0a87a45b19f46f175a4ef39ff40009.zip
it's now possible to change order of placeholders in l10n
Diffstat (limited to 'langs.inc.php')
-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;
}