diff options
author | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-03-18 18:07:37 +0100 |
---|---|---|
committer | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-03-18 18:07:37 +0100 |
commit | 878bdeccfd66b7b8229fd761c23ba13bc51c7454 (patch) | |
tree | 6b881c4f71389ef6aa49776e8b99ac65f30f4ec2 /include/pgettext.php | |
parent | f4f5095e19badcc85453182b86bff97f57228257 (diff) | |
parent | 9838245c6c9b2e311650b53a1c3aa1ef778ef935 (diff) | |
download | volse-hubzilla-878bdeccfd66b7b8229fd761c23ba13bc51c7454.tar.gz volse-hubzilla-878bdeccfd66b7b8229fd761c23ba13bc51c7454.tar.bz2 volse-hubzilla-878bdeccfd66b7b8229fd761c23ba13bc51c7454.zip |
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'include/pgettext.php')
-rw-r--r-- | include/pgettext.php | 46 |
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 |