[Zope] i18n from a python script or external method

Josef Meile jmeile at hotmail.com
Mon Sep 15 05:07:05 EDT 2008


Looking at the source from PTS v. 1.4.13, it seems that this method will
get the PTS-Object:

from Products.PlacelessTranslationService import getTranslationService
translationService = getTranslationService()

Josef Meile schrieb:
> Hi,
> 
>> However, I have failed to get it to work from a python script or external python method. 
>>
>> I have found several different methods via google however none of them work (ie none will translate a msg).
>>
>> Can someone please give me a valid method to do this for Zope 2.10 .3 or later. 
> I used to use PTS; however, now I'm using five, so, I don't know if my
> code still works:
> 
> translationService = context.Control_Panel.TranslationService
> translation = translationService.translate(domain,msgid)
> if translation is None:
>    translation = msgid
> 
> I think there is a cleaner way of doing this by using the PTS API to get 
> the TranslationService object, so, you may look at the source code of 
> this product.
> 
> Best regards
> Josef
> _______________________________________________
> Zope maillist  -  Zope-CWUwpEBWKX0 at public.gmane.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 



More information about the Zope mailing list