[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[OpenTAL-checkins] opental/PlacelessTranslationService PlacelessTr...
From: |
Fernando Lalo Martins |
Subject: |
[OpenTAL-checkins] opental/PlacelessTranslationService PlacelessTr... |
Date: |
Mon, 06 Oct 2003 17:34:38 -0400 |
CVSROOT: /cvsroot/opental
Module name: opental
Branch:
Changes by: Fernando Lalo Martins <address@hidden> 03/10/06 17:34:38
Modified files:
PlacelessTranslationService: PlacelessTranslationService.py
__init__.py
Log message:
using the new generic Negotiator
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/PlacelessTranslationService.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/__init__.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
Patches:
Index: opental/PlacelessTranslationService/PlacelessTranslationService.py
diff -u opental/PlacelessTranslationService/PlacelessTranslationService.py:1.30
opental/PlacelessTranslationService/PlacelessTranslationService.py:1.31
--- opental/PlacelessTranslationService/PlacelessTranslationService.py:1.30
Mon Oct 6 13:20:15 2003
+++ opental/PlacelessTranslationService/PlacelessTranslationService.py Mon Oct
6 17:34:38 2003
@@ -17,7 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
"""Placeless Translation Service for providing I18n to file-based code.
-$Id: PlacelessTranslationService.py,v 1.30 2003/10/06 17:20:15 lalo Exp $
+$Id: PlacelessTranslationService.py,v 1.31 2003/10/06 21:34:38 lalo Exp $
"""
import sys, re, zLOG, Globals, fnmatch
@@ -89,7 +89,6 @@
all_meta_types = ()
security = ClassSecurityInfo()
- security.declarePublic('negotiate')
security.declarePublic('translate')
security.declarePublic('getLanguages')
security.declarePublic('getLanguageName')
@@ -210,9 +209,6 @@
l.sort()
return l
- def negotiate(self, langs, context):
- return negotiator.getLanguage(langs, context)
-
def translate(self, domain, msgid, mapping=None, context=None,
target_language=None, default=None):
"""
@@ -272,14 +268,12 @@
def negotiate_language(self, context, domain):
if context is None:
raise TypeError, 'No destination language'
- else:
- langs = [m[0] for m in catalogRegistry.keys() if m[1] == domain] +
\
- [m[0] for m in fbcatalogRegistry.keys() if m[1] == domain]
- for fallback in self._fallbacks:
- if fallback not in langs:
- langs.append(fallback)
- target_language = self.negotiate(langs, context)
- return target_language
+ langs = [m[0] for m in catalogRegistry.keys() if m[1] == domain] + \
+ [m[0] for m in fbcatalogRegistry.keys() if m[1] == domain]
+ for fallback in self._fallbacks:
+ if fallback not in langs:
+ langs.append(fallback)
+ return negotiator.negotiate(langs, context, 'language')
def getDomain(self, domain):
"""
Index: opental/PlacelessTranslationService/__init__.py
diff -u opental/PlacelessTranslationService/__init__.py:1.19
opental/PlacelessTranslationService/__init__.py:1.20
--- opental/PlacelessTranslationService/__init__.py:1.19 Mon Sep 29
12:30:16 2003
+++ opental/PlacelessTranslationService/__init__.py Mon Oct 6 17:34:38 2003
@@ -16,12 +16,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
__version__ = '''
-$Id: __init__.py,v 1.19 2003/09/29 16:30:16 lalo Exp $
+$Id: __init__.py,v 1.20 2003/10/06 21:34:38 lalo Exp $
'''.strip()
from OFS.Application import get_products
from AccessControl import ModuleSecurityInfo, allow_module, allow_class,
allow_type
from PlacelessTranslationService import PlacelessTranslationService, log
+from Negotiator import negotiator
from Products.PageTemplates.GlobalTranslationService import
setGlobalTranslationService
import os, fnmatch, zLOG, sys, Zope, Globals, TranslateTags
@@ -57,10 +58,13 @@
translate = translation_service.translate
getLanguages = translation_service.getLanguages
getLanguageName = translation_service.getLanguageName
-negotiate = translation_service.negotiate
+def negotiate(langs, context):
+ # deprecated!
+ return negotiator.negotiate(langs, context, 'language')
# import permissions
security = ModuleSecurityInfo('Products.PlacelessTranslationService')
+security.declarePublic('negotiator')
security.declarePublic('negotiate')
security.declarePublic('translate')
security.declarePublic('getLanguages')