diff options
author | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
---|---|---|
committer | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
commit | 4cff911939b263993eb41682ca558c975e2db01f (patch) | |
tree | 78f58e08d04413827744689d0f5df7660bee6caa /include/pgettext.php | |
parent | 2cf696d0b5d647e1741d2f94ee379aa19b25ae1b (diff) | |
parent | f3f063c0dd7fd8b706987b856d79c7b58924acbb (diff) | |
download | volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.gz volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.bz2 volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.zip |
merged multipart email changes
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 |