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@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@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 )