You are not logged in Log in Join
You are here: Home » Members » hewei » Zope RPMs for RedHat » Plone 2.0 » CMFPlone Member Folder Description Translation Bugfix » View Document

Log in
Name

Password

 

CMFPlone Member Folder Description Translation Bugfix

--- CMFPlone/PloneUtilities.py.orig 2004-04-23 04:44:34.000000000 +0800
+++ CMFPlone/PloneUtilities.py 2004-05-16 23:25:06.000000000 +0800
@@ -4,6 +4,7 @@

import Globals
import OFS
+import re
from Products.CMFCore.utils import ToolInit as CMFCoreToolInit

class IndexIterator:
@@ -44,12 +45,24 @@

service = None
translate = None
+hascharset_re=re.compile(r';\s*charset=', re.IGNORECASE)

def translate_wrapper(domain, msgid, mapping=None, context=None,
target_language=None, default=None):
# wrapper for calling the translate() method with a fallback value
if service == None:
initialize()
+
+ default_charset = context.portal_properties.site_properties.default_charset
+ if context.REQUEST.RESPONSE.headers.has_key('content-type'):
+ content_type = context.REQUEST.RESPONSE.headers['content-type']
+ if not hascharset_re.search(content_type):
+ content_type += '; charset=' + default_charset
+ context.REQUEST.RESPONSE.setHeader('content-type', content_type)
+ else:
+ content_type = 'text/html; charset=' + default_charset
+ context.REQUEST.RESPONSE.setHeader('content-type', content_type)
+
try:
res = service.translate(domain, msgid, mapping=mapping,
context=context,