[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[OpenTAL-checkins] opental/PlacelessTranslationService TranslateTa...
From: |
Fernando Lalo Martins |
Subject: |
[OpenTAL-checkins] opental/PlacelessTranslationService TranslateTa... |
Date: |
Fri, 26 Sep 2003 12:36:51 -0400 |
CVSROOT: /cvsroot/opental
Module name: opental
Branch:
Changes by: Fernando Lalo Martins <address@hidden> 03/09/26 12:36:51
Modified files:
PlacelessTranslationService: TranslateTags.py __init__.py
Log message:
some aesthetic cleanups
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/TranslateTags.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/__init__.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: opental/PlacelessTranslationService/TranslateTags.py
diff -u opental/PlacelessTranslationService/TranslateTags.py:1.1
opental/PlacelessTranslationService/TranslateTags.py:1.2
--- opental/PlacelessTranslationService/TranslateTags.py:1.1 Fri Sep 26
11:31:01 2003
+++ opental/PlacelessTranslationService/TranslateTags.py Fri Sep 26
12:36:51 2003
@@ -16,7 +16,7 @@
# 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: TranslateTags.py,v 1.1 2003/09/26 15:31:01 lalo Exp $
+$Id: TranslateTags.py,v 1.2 2003/09/26 16:36:51 lalo Exp $
'''.strip()
from PlacelessTranslationService import log
@@ -51,8 +51,6 @@
if args.has_key('domain'): self._domain=args['domain']
def render(self, md):
- from Products.PlacelessTranslationService import translate
-
r=[]
for tname, args, section in self.blocks:
__traceback_info__=tname
@@ -71,5 +69,9 @@
__call__=render
-for c in (TranslateTag,):
- String.commands[c.name] = c
+def initialize():
+ global translate
+ from Products.PlacelessTranslationService import translate
+
+ for c in (TranslateTag,):
+ String.commands[c.name] = c
Index: opental/PlacelessTranslationService/__init__.py
diff -u opental/PlacelessTranslationService/__init__.py:1.16
opental/PlacelessTranslationService/__init__.py:1.17
--- opental/PlacelessTranslationService/__init__.py:1.16 Fri Sep 26
11:31:01 2003
+++ opental/PlacelessTranslationService/__init__.py Fri Sep 26 12:36:51 2003
@@ -16,14 +16,14 @@
# 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.16 2003/09/26 15:31:01 lalo Exp $
+$Id: __init__.py,v 1.17 2003/09/26 16:36:51 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 Products.PageTemplates.GlobalTranslationService import
setGlobalTranslationService
-import os, fnmatch, zLOG, sys, Zope, Globals
+import os, fnmatch, zLOG, sys, Zope, Globals, TranslateTags
# in python 2.1 fnmatch doesn't have the filter function
if not hasattr(fnmatch, 'filter'):
@@ -73,8 +73,7 @@
make_translation_service(cp)
pkg.translation_service = getattr(cp, cp_id)
- # don't touch - this is the last version
- # that didn't have the attribute (0.4)
+ # don't touch - this is the last version that didn't have the attribute
(0.4)
instance_version = getattr(translation_service, '_instance_version', (0,
4, 0, 0))
if instance_version < PlacelessTranslationService._class_version:
log('outdated translation service found, recreating',
@@ -87,13 +86,14 @@
# set ZPT's translation service
setGlobalTranslationService(translation_service)
+ # set product-wide attrs for importing
pkg.translate = translation_service.translate
pkg.getLanguages = translation_service.getLanguages
pkg.getLanguageName = translation_service.getLanguageName
pkg.negotiate = translation_service.negotiate
- log('products: %r' % get_products(), zLOG.BLATHER)
# sweep products
+ log('products: %r' % get_products(), zLOG.BLATHER)
for prod in get_products():
# prod is a tuple in the form:
#(priority, dir_name, index, base_dir) for each Product directory
@@ -107,7 +107,6 @@
log('no translations found!', zLOG.PROBLEM)
# notify anyone who needs it
+ TranslateTags.initialize()
for function in notify_initialized:
function()
-
-import TranslateTags
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [OpenTAL-checkins] opental/PlacelessTranslationService TranslateTa...,
Fernando Lalo Martins <=