Skip to content

Commit 964c27c

Browse files
author
Alexander Smishlajev
committed
export gettext and ngettext functions
1 parent dc42d0e commit 964c27c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

roundup/i18n.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: i18n.py,v 1.5 2004-05-14 10:40:47 a1s Exp $
18+
# $Id: i18n.py,v 1.6 2004-05-18 19:20:47 a1s Exp $
1919

2020
"""
2121
RoundUp Internationalization (I18N)
@@ -43,11 +43,15 @@
4343
import gettext
4444
except ImportError:
4545
# fall-back to dummy on errors (returning the english text)
46-
_ = lambda text: text
46+
_ = gettext = lambda text: text
47+
def ngettext(singular, plural, count):
48+
if count == 1: return singular
49+
return plural
4750
else:
4851
# use roundup messages
4952
gettext.textdomain("roundup")
50-
# export gettext function
51-
_ = gettext.gettext
53+
# export gettext functions
54+
ngettext = gettext.ngettext
55+
_ = gettext = gettext.gettext
5256

5357
# vim: set filetype=python ts=4 sw=4 et si

0 commit comments

Comments
 (0)