What is the LinguaPlone API to link an existing content item as the translation of another content item?

229 Views Asked by At

I would like to link one item as the translation of another item, programmatically, in LinguaPlone. What's the API?

2

There are 2 best solutions below

1
On BEST ANSWER

You need to make sure you have the canonical object first:

canonical = object.getCanonical()

You can then link your translation by calling addTranslationReference on the translation:

translatedObject.addTranslationReference(canonical)

That's all. The LinguaPlone API is rather under-documented, your best bet is to look at the I18NBaseObject source code. The most important thing to remember is that there is always one canonical object, with any translations linked to it via references, where the reference points from translations to the canonical object.

0
On

I think it's obj.addTranslationReference(tr_obj), the target language is taken from tr_obj. But that's only based on a brief look at I18NBaseObject.py: Plone is my day job and it's weekend. :)