Automatically add translated version

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.

subscribers.zcml :

<configure xmlns="http://namespaces.zope.org/zope"
           i18n_domain="my.product">

        <subscriber
            for="my.product.mycontenttype.IMyContentType
                 zope.app.container.interfaces.IObjectAddedEvent"
            handler="my.product.subscribers.addTranslation"
            />

</configure>

subscriber.py :

def addTranslation(object, event):
        logger.info('addTranslation')
        current = ILanguage(object).get_language()
        logger.info('current: %s' % current)
        if current in [ 'fr', 'en' ]:
                logger.info(ITranslationManager(object).get_translated_languages())
                if len(ITranslationManager(object).get_translated_languages()) == 0:
                        logger.info(object.absolute_url())
                        target = 'en'
                        if current == 'en':
                                target = 'fr'
                        logger.info('target: %s' % target)
                        ITranslationManager(object).add_translation(target)

Current is always empty. I think it's because of plone.multilingual.

plone.multilingual-1.2.1-py2.7.egg/plone/multilingual/profiles/default/componentregistry.xml :

 <subscriber
      for="plone.multilingual.interfaces.ITranslatable
         zope.app.container.interfaces.IObjectAddedEvent"
      handler="plone.multilingual.subscriber.createdEvent"/>

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.