Commit 84314b72 authored by Barry Warsaw's avatar Barry Warsaw

Group consensus is that supporting alternative locale categories is

useless.  So the category argument on _find() is removed, as is the
dcgettext() function.
parent ff6d8136
...@@ -168,15 +168,13 @@ class GNUTranslations(UserDict): ...@@ -168,15 +168,13 @@ class GNUTranslations(UserDict):
Translations = GNUTranslations Translations = GNUTranslations
# Locate a .mo file using the gettext strategy # 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 _current_domain
global _localedirs global _localedirs
# Get some reasonable defaults for arguments that were not supplied # Get some reasonable defaults for arguments that were not supplied
if domain is None: if domain is None:
domain = _current_domain domain = _current_domain
if category is None:
category = 'LC_MESSAGES'
if localedir is None: if localedir is None:
localedir = _localedirs.get( localedir = _localedirs.get(
domain, domain,
...@@ -199,7 +197,7 @@ def _find(localedir=None, languages=None, category=None, domain=None): ...@@ -199,7 +197,7 @@ def _find(localedir=None, languages=None, category=None, domain=None):
for lang in languages: for lang in languages:
if lang == 'C': if lang == 'C':
break 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 # see if it's in the cache
mo = _translations.get(mofile) mo = _translations.get(mofile)
if mo: if mo:
...@@ -251,23 +249,6 @@ def dgettext(domain, message): ...@@ -251,23 +249,6 @@ def dgettext(domain, message):
return _find(domain=domain).get(message, 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 # A higher level API
def set(translation): def set(translation):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment