[ZCM] [ZC] 1114/ 3 Comment "i18n:target does not work"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Mon Jan 8 16:30:59 EST 2007
Issue #1114 Update (Comment) "i18n:target does not work"
Status Pending, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/1114
==============================================================
= Comment - Entry #3 by jdoyon on Jan 8, 2007 4:30 pm
Uploaded: "i18ntargetpatch.py"
- http://www.zope.org/Collectors/Zope/1114/i18ntargetpatch.py/view
Find attached an updated version of the monkey patch which actually implements i18n:target as documented (Where the content of the attribute is a TALES). This code depends on CMF for convenience however.
________________________________________
= Comment - Entry #2 by jdoyon on Oct 19, 2006 11:33 am
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
from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService
from zope.tal.talinterpreter import TALInterpreter
def zopecontexttranslate(self, msgid, domain=None, mapping=None, default=None,
target_language=None):
context = self.contexts.get('context')
return getGlobalTranslationService().translate(
domain, msgid, mapping=mapping,
context=context, target_language=target_language, default=default)
ZopeContext.translate = zopecontexttranslate
def talinterpretertranslate(self, msgid, default=None, i18ndict=None,
obj=None, domain=None):
if default is None:
default = getattr(msgid, 'default', unicode(msgid))
if i18ndict is None:
i18ndict = {}
if domain is None:
domain = getattr(msgid, 'domain', self.i18nContext.domain)
if obj:
i18ndict.update(obj)
if not self.i18nInterpolate:
return msgid
# TODO: We need to pass in one of context or target_language
return self.engine.translate(msgid, self.i18nContext.domain,
i18ndict, default=default,
target_language=self.i18nContext.target)
TALInterpreter.translate = talinterpretertranslate
----------------------------------------------------------------
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".
________________________________________
= Request - Entry #1 by Anonymous User on Nov 7, 2003 4:58 pm
ZPTInternationalizationSupport
Specifying a target language (i18n:target="string:es") does not work. 'None' is always passed in to the translation service which causes the translation service to negotiate a language based on the browser.
It does not look like the target language is passed in TALInterpreter.py.
==============================================================
More information about the Zope-Collector-Monitor
mailing list