summaryrefslogtreecommitdiffstats
path: root/Lib/gettext.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/gettext.py')
-rw-r--r--Lib/gettext.py36
1 files changed, 9 insertions, 27 deletions
diff --git a/Lib/gettext.py b/Lib/gettext.py
index 6e14a93..d1f20bf 100644
--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -210,19 +210,6 @@ class NullTranslations:
else:
return msgid2
- def ugettext(self, message):
- if self._fallback:
- return self._fallback.ugettext(message)
- return str(message)
-
- def ungettext(self, msgid1, msgid2, n):
- if self._fallback:
- return self._fallback.ungettext(msgid1, msgid2, n)
- if n == 1:
- return str(msgid1)
- else:
- return str(msgid2)
-
def info(self):
return self._info
@@ -235,15 +222,14 @@ class NullTranslations:
def set_output_charset(self, charset):
self._output_charset = charset
- def install(self, str=False, names=None):
+ def install(self, names=None):
import builtins
- builtins.__dict__['_'] = str and self.ugettext or self.gettext
+ builtins.__dict__['_'] = self.gettext
if hasattr(names, "__contains__"):
if "gettext" in names:
builtins.__dict__['gettext'] = builtins.__dict__['_']
if "ngettext" in names:
- builtins.__dict__['ngettext'] = (str and self.ungettext
- or self.ngettext)
+ builtins.__dict__['ngettext'] = self.ngettext
if "lgettext" in names:
builtins.__dict__['lgettext'] = self.lgettext
if "lngettext" in names:
@@ -367,31 +353,27 @@ class GNUTranslations(NullTranslations):
else:
return msgid2
- def ugettext(self, message):
+ def gettext(self, message):
missing = object()
tmsg = self._catalog.get(message, missing)
if tmsg is missing:
if self._fallback:
- return self._fallback.ugettext(message)
+ return self._fallback.gettext(message)
return str(message)
return tmsg
- gettext = ugettext
-
- def ungettext(self, msgid1, msgid2, n):
+ def ngettext(self, msgid1, msgid2, n):
try:
tmsg = self._catalog[(msgid1, self.plural(n))]
except KeyError:
if self._fallback:
- return self._fallback.ungettext(msgid1, msgid2, n)
+ return self._fallback.ngettext(msgid1, msgid2, n)
if n == 1:
tmsg = str(msgid1)
else:
tmsg = str(msgid2)
return tmsg
- ngettext = ungettext
-
# Locate a .mo file using the gettext strategy
def find(domain, localedir=None, languages=None, all=0):
@@ -465,9 +447,9 @@ def translation(domain, localedir=None, languages=None,
return result
-def install(domain, localedir=None, str=False, codeset=None, names=None):
+def install(domain, localedir=None, codeset=None, names=None):
t = translation(domain, localedir, fallback=True, codeset=codeset)
- t.install(str, names)
+ t.install(names)