Initial commit.
[oddments/ddns.git] / ddns / i18n.py
CommitLineData
f22ab085
MT
1#!/usr/bin/python
2
3import gettext
4
5TEXTDOMAIN = "ddns"
6
7N_ = lambda x: x
8
9def _(singular, plural=None, n=None):
10 """
11 A function that returnes the translation of a string if available.
12
13 The language is taken from the system environment.
14 """
15 if not plural is None:
16 assert n is not None
17 return gettext.dngettext(TEXTDOMAIN, singular, plural, n)
18
19 return gettext.dgettext(TEXTDOMAIN, singular)
20