[Zope] i18n from a python script or external method
Adam Molyneaux
adam.molyneaux at bluewin.ch
Mon Sep 15 05:33:45 EDT 2008
The first method (with context added), works.
translationService = context.Control_Panel.TranslationService
translation = translationService.translate(domain,msgid,context=context)
The second does not - i get an access error.
However, I dont need to do this with PTS - i would be happy to know the
five solution !
adam
Josef Meile wrote:
>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 )
>>
>>
>>
>
>_______________________________________________
>Zope maillist - Zope at zope.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