i18n:target does not work
Bug #142771 reported by
Bug Importer
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
ZPTInternationa
Specifying a target language (i18n:target=
It does not look like the target language is passed in TALInterpreter.py.
Changed in zope2: | |
importance: | Medium → Wishlist |
To post a comment you must log in.
Still doesn't work in Zope 2.10 :(
Here's a nasty monkey patch:
------- ------- ------- ------- ------- ------- ------- ------- ------- --
# $Id: i18ntargetpatch.py 1325 2006-10-19 15:30:59Z jdoyon $
from Products. PageTemplates. Expressions import ZopeContext PageTemplates. GlobalTranslati onService import getGlobalTransl ationService talinterpreter import TALInterpreter
from Products.
from zope.tal.
def zopecontexttran slate(self, msgid, domain=None, mapping=None, default=None,
target_ language= None): get('context' ) ationService( ).translate(
context= context, target_ language= target_ language, default=default)
context = self.contexts.
return getGlobalTransl
domain, msgid, mapping=mapping,
ZopeContext. translate = zopecontexttran slate
def talinterpretert ranslate( self, msgid, default=None, i18ndict=None,
obj=None, domain=None): t.domain)
i18ndict. update( obj) olate: translate( msgid, self.i18nContex t.domain,
i18ndict, default=default,
target_ language= self.i18nContex t.target)
if default is None:
default = getattr(msgid, 'default', unicode(msgid))
if i18ndict is None:
i18ndict = {}
if domain is None:
domain = getattr(msgid, 'domain', self.i18nContex
if obj:
if not self.i18nInterp
return msgid
# TODO: We need to pass in one of context or target_language
return self.engine.
TALInterpreter. translate = talinterpretert ranslate
------- ------- ------- ------- ------- ------- ------- ------- ------- -
NOTE: The value of i18n:target using this patch is the language itself, and not a TALES. So use i18n:target="fr" instead of i18n:target= "string: fr".