[Zope3-checkins] CVS: Zope3/src/zope/i18n - negotiator.py:1.6.48.2
translate.py:1.9.12.2
Sidnei da Silva
sidnei at x3ng.com.br
Mon Mar 1 07:16:30 EST 2004
Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv4062/i18n
Modified Files:
Tag: runyaga-sip-branch
negotiator.py translate.py
Log Message:
Merge srichter's fixes to my branch.
=== Zope3/src/zope/i18n/negotiator.py 1.6.48.1 => 1.6.48.2 ===
--- Zope3/src/zope/i18n/negotiator.py:1.6.48.1 Fri Feb 27 12:36:37 2004
+++ Zope3/src/zope/i18n/negotiator.py Mon Mar 1 07:15:59 2004
@@ -11,11 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Language Negotiator
$Id$
"""
-
from zope.i18n.interfaces import INegotiator
from zope.i18n.interfaces import IUserPreferredLanguages
from zope.component import getAdapter
@@ -37,7 +36,6 @@
return n_langs
class Negotiator:
-
implements(INegotiator)
def getLanguage(self, langs, env):
=== Zope3/src/zope/i18n/translate.py 1.9.12.1 => 1.9.12.2 ===
--- Zope3/src/zope/i18n/translate.py:1.9.12.1 Fri Feb 27 12:57:57 2004
+++ Zope3/src/zope/i18n/translate.py Mon Mar 1 07:15:59 2004
@@ -26,28 +26,18 @@
It is expected that object be constructed with enough information to find
the domain, context, and target language.
"""
-
implements(ITranslator)
- def __init__(self, locale, domain, context=None):
- """locale comes from the request, domain specifies the application,
- and context specifies the place (it may be none for global contexts).
- """
- self._locale = locale
+ def __init__(self, domain, context, location=None):
+ """Initialize the object."""
self._domain = domain
self._context = context
- self._translation_service = getService(context, 'Translation')
+ self._translation_service = getService(location, 'Translation')
+
- def translate(self, msgid, mapping=None, context=None, default=None):
- """Translate the source msgid using the given mapping.
+ def translate(self, msgid, mapping=None, default=None):
+ """See zope.i18n.interfaces.ITranslator."""
- See ITranslationService for details.
- """
- # XXX Temporary fix while Stephan Richter provides
- # provides a better one. Ignore locale, and pass context
- # instead, which should be the request or an object
- # that can be adapted to IUserPreferredLangs.
return self._translation_service.translate(
- msgid, self._domain, mapping=mapping,
- context=context,
+ msgid, self._domain, mapping=mapping, context=self._context,
default=default)
More information about the Zope3-Checkins
mailing list