[Zope] TranslationService and charset

Gilles Lenfant gilles at pilotsystems.net
Mon Sep 22 17:21:06 EDT 2003


Hi,

I use the translation_service object from a Plone Python product to get the
translaltion of texts with this method...

    def translate(text)
        ts = getattr(self, 'translation_service', None)
        if not ts:
            return text
        translated = ts.translate('newsletter', text)
        if not translated:
            return text
        else:
            return translated

It works but returns the translated text in the original charset (ascii,
latin1, ...) from the MessageCatalog and not in my plone publishing charset
(utf-8).

I need to know the charset used in the associated MessageCatalog object to
recode that translated text into the plone publishing charset.

There's certainly a way to do this because Plone recodes all that comes from
a MessageCatalog through a TranslationService into the Plone publishing
charset, but I'm stucked hacking TranslationService and Localizer code !

Any hint including RTFM welcome

Cheers

--Gilles





More information about the Zope mailing list