aboutsummaryrefslogtreecommitdiffstats
path: root/include/pgettext.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-21 15:37:16 -0700
committerFriendika <info@friendika.com>2011-09-21 15:37:16 -0700
commit030e1e82c32a3061abf71ffb90e65f2b9197d8a4 (patch)
treecb1764419691742ace43b6e5a4e47d0ee13fd76d /include/pgettext.php
parentc63adcfae061809ce25217207f638b1e6c1d1bee (diff)
downloadvolse-hubzilla-030e1e82c32a3061abf71ffb90e65f2b9197d8a4.tar.gz
volse-hubzilla-030e1e82c32a3061abf71ffb90e65f2b9197d8a4.tar.bz2
volse-hubzilla-030e1e82c32a3061abf71ffb90e65f2b9197d8a4.zip
finish up ability to switch languages without function collision
Diffstat (limited to 'include/pgettext.php')
-rw-r--r--include/pgettext.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/pgettext.php b/include/pgettext.php
index c7fc58698..83e76ba9d 100644
--- a/include/pgettext.php
+++ b/include/pgettext.php
@@ -119,6 +119,8 @@ function tt($singular, $plural, $count){
if(x($a->strings,$singular)) {
$t = $a->strings[$singular];
$f = 'string_plural_select_' . str_replace('-','_',$lang);
+ if(! function_exists($f))
+ $f = 'string_plural_select_default';
$k = $f($count);
return is_array($t)?$t[$k]:$t;
}
@@ -128,4 +130,13 @@ function tt($singular, $plural, $count){
} else {
return $singular;
}
-}} \ No newline at end of file
+}}
+
+// provide a fallback which will not collide with
+// a function defined in any language file
+
+if(! function_exists('string_plural_select_default')) {
+function string_plural_select_default($n) {
+ return ($n != 1);
+}}
+