aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--langs.inc.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/langs.inc.php b/langs.inc.php
index 42bb3a748..3a67aa463 100644
--- a/langs.inc.php
+++ b/langs.inc.php
@@ -500,7 +500,9 @@ function _r($string_for_translation, $sufix = '')
* will just echo translation
*
* _g('Download Mageia %d!', array(5), 'a href="" style="color: blue;"')
- * will echo blue link
+ * OR for only one member of array:
+ * _g('Download Mageia %s!', 5, 'a href="" style="color: blue;"')
+ * will both echo blue link
*
* _g("Hey there.", null, ' '); _g("How are you?")
* will just echo translation: Hey there. How are you?
@@ -509,7 +511,7 @@ function _r($string_for_translation, $sufix = '')
* Do not exit the process.
*
* @param string $string_for_translation which we want to translate
- * @param array $args for vsprintf
+ * @param array OR string $args for vsprintf/sprintf
* @param string $tag_or_space HTML tag or space to append
*
* @return null
@@ -517,8 +519,12 @@ function _r($string_for_translation, $sufix = '')
function _g($string_for_translation, $args = null, $tag_or_space = '')
{
$translated_string = _r($string_for_translation);
- if(is_array($args)) {
- $translated_string = vsprintf($translated_string, $args);
+ if(!is_null($args)) {
+ if(is_array($args)) {
+ $translated_string = vsprintf($translated_string, $args);
+ } else {
+ $translated_string = sprintf($translated_string, $args);
+ }
}
if(!empty($tag_or_space) && $tag_or_space != ' ') {
$tag_or_space_w_args = explode(' ', $tag_or_space);