When i add a content type (default in french), i would like to automatically add a english version of this object (french content unchanged).
I tried to do it with subscriber, but i failed. I think i may override the createdEvent subscriber (plone.app.multilingual)
Thanks for your help
It might help if you showed what you did and what specifically happened when you say it failed. It's not clear what you're trying to do.
def addTranslation(object, event):
current = ILanguage(object).get_language()
logger.info('current: %s' % current)
if current in [ 'fr', 'en' ]:
if len(ITranslationManager(object).get_translated_languages()) == 0:
target = 'en'
if current == 'en':
target = 'fr'
logger.info('target: %s' % target)
Current is always empty. I think it's because of plone.multilingual.
Thank for your help
I have no experience with the translation mechanism unfortunately. Are you sure that's how you are supposed to get the current language? Are you following code that you know is good? I often look at test case code that ships with the package.
I added print messages to understand when the set_language function is called. I found it's called in the createEvent function (plone.multilingual > subscriber) after my addTranslation function. I don't know how to change this order.