diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-07-04 12:10:00 +0200 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-07-04 12:16:58 +0200 |
commit | 7f29756196ce8743c474bb035d234a72af5381aa (patch) | |
tree | 026a8ccd858aea05a808d0c36d7b41bf0d6ed371 /web/lib/translator.inc.php | |
parent | b113764b0bdf98b7d1d643eb2f55c50988f31deb (diff) |
Handle plurals in translations
Use ngettext() to handle plurals properly. Also, split pagination
captions into two strings.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/translator.inc.php')
-rw-r--r-- | web/lib/translator.inc.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/web/lib/translator.inc.php b/web/lib/translator.inc.php index 5117b99..448c41b 100644 --- a/web/lib/translator.inc.php +++ b/web/lib/translator.inc.php @@ -70,6 +70,13 @@ function __() { return $translated; } +function _n($msgid1, $msgid2, $n) { + global $l10n; + + $translated = sprintf($l10n->ngettext($msgid1, $msgid2, $n), $n); + return htmlspecialchars($translated, ENT_QUOTES); +} + # set up the visitor's language # function set_lang() { |