summaryrefslogtreecommitdiffstats
path: root/Lib/gettext.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-08-25 19:53:17 (GMT)
committerBarry Warsaw <barry@python.org>2000-08-25 19:53:17 (GMT)
commit84314b72d65471b0ae68432aefe36a4691e3b04e (patch)
treebc087bc00a9c2b0d69ab375990a8ce82e8a7a17a /Lib/gettext.py
parentff6d8136574e9f4e1b11f75a945af5f8ab44a6fd (diff)
downloadcpython-84314b72d65471b0ae68432aefe36a4691e3b04e.zip
cpython-84314b72d65471b0ae68432aefe36a4691e3b04e.tar.gz
cpython-84314b72d65471b0ae68432aefe36a4691e3b04e.tar.bz2
Group consensus is that supporting alternative locale categories is
useless. So the category argument on _find() is removed, as is the dcgettext() function.
Diffstat (limited to 'Lib/gettext.py')
-rw-r--r--Lib/gettext.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/Lib/gettext.py b/Lib/gettext.py
index a7f89b2..74c7c38 100644
--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -168,15 +168,13 @@ class GNUTranslations(UserDict):
Translations = GNUTranslations
# Locate a .mo file using the gettext strategy
-def _find(localedir=None, languages=None, category=None, domain=None):
+def _find(localedir=None, languages=None, domain=None):
global _current_domain
global _localedirs
# Get some reasonable defaults for arguments that were not supplied
if domain is None:
domain = _current_domain
- if category is None:
- category = 'LC_MESSAGES'
if localedir is None:
localedir = _localedirs.get(
domain,
@@ -199,7 +197,7 @@ def _find(localedir=None, languages=None, category=None, domain=None):
for lang in languages:
if lang == 'C':
break
- mofile = os.path.join(localedir, lang, category, '%s.mo' % domain)
+ mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)
# see if it's in the cache
mo = _translations.get(mofile)
if mo:
@@ -251,23 +249,6 @@ def dgettext(domain, message):
return _find(domain=domain).get(message, message)
-def dcgettext(domain, message, category):
- try:
- from locale import LC_CTYPE, LC_TIME, LC_COLLATE
- from locale import LC_MONETARY, LC_MESSAGES, LC_NUMERIC
- except ImportError:
- return message
- categories = {
- LC_CTYPE : 'LC_CTYPE',
- LC_TIME : 'LC_TIME',
- LC_COLLATE : 'LC_COLLATE',
- LC_MONETARY : 'LC_MONETARY',
- LC_MESSAGES : 'LC_MESSAGES',
- LC_NUMERIC : 'LC_NUMERIC'
- }
- return _find(domain=domain, category=category).get(message, message)
-
-
# A higher level API
def set(translation):