- <?php
- // Plural forms: http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
- // $LANG["PLURAL_FORMS"] is in the plural= format
- function T_ ($s) {
- GLOBAL $LANG;
- if ($ret = $LANG[$s])
- return $ret;
- if ($ret = $LANG["{$s}[0]"])
- return $ret;
- return $s;
- }
- function P_ ($s, $num) {
- GLOBAL $LANG;
- $num = (int) $num;
- if ($ret = $LANG["{$s}[$i]"])
- return $ret;
- return $s;
- }
- $LANG["PLURAL_FORMS"] = "n != 1";
- $LANG["TORRENT[0]"] = "torrent";
- $LANG["TORRENT[1]"] = "torrents";
- echo "Singular: ".T_("TORRENT")."<br/>";
- echo "Plural: (n != 1): ".P_("TORRENT", 0)."<br/>";
- echo "Plural: (n == 1): ".P_("TORRENT", 1);
- ?>
TT Languages example
Posted by Admin on Sun 21st Mar 2010 23:47
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.