aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-18 05:07:42 -0700
committerFriendika <info@friendika.com>2011-03-18 05:07:42 -0700
commit9838245c6c9b2e311650b53a1c3aa1ef778ef935 (patch)
treeceb9f5edd50cd039e28362a59c4c2d354bb88e67 /include
parent43234a667878327a825914070884161c6d57271e (diff)
parente307846c2d89cf450ed2e7ddf8f325f5f4581f8f (diff)
downloadvolse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.gz
volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.bz2
volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.zip
Merge branch 'gettext' of https://github.com/fabrixxm/friendika into fabrixxm-gettext
Diffstat (limited to 'include')
-rw-r--r--include/pgettext.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/pgettext.php b/include/pgettext.php
new file mode 100644
index 000000000..2ffee70bc
--- /dev/null
+++ b/include/pgettext.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * translation support
+ */
+
+// load string translation table for alternate language
+
+if(! function_exists('load_translation_table')) {
+function load_translation_table($lang) {
+ global $a;
+
+ if(file_exists("view/$lang/strings.php"))
+ include("view/$lang/strings.php");
+}}
+
+// translate string if translation exists
+
+if(! function_exists('t')) {
+function t($s) {
+
+ $a = get_app();
+
+ if(x($a->strings,$s)) {
+ $t = $a->strings[$s];
+ return is_array($t)?$t[0]:$t;
+ }
+ return $s;
+}}
+
+if(! function_exists('tt')){
+function tt($singular, $plural, $count){
+
+ $a = get_app();
+
+ if(x($a->strings,$singular)) {
+ $t = $a->strings[$singular];
+ $k = string_plural_select($count);
+ return is_array($t)?$t[$k]:$t;
+ }
+
+ if ($count!=1){
+ return $plural;
+ } else {
+ return $singular;
+ }
+}} \ No newline at end of file