I would like to link one item as the translation of another item, programmatically, in LinguaPlone. What's the API?
Asked
Active
Viewed 214 times
2 Answers
3
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.

Martijn Pieters
- 1,048,767
- 296
- 4,058
- 3,343
-
It seems that the canonical language may need to be the argument to addTranslationReference(), not the other way around. I also found the API tests. http://dev.plone.org/plone/browser/Products.LinguaPlone/trunk/Products/LinguaPlone/tests/test_api.py – joeforker Jan 14 '11 at 18:31
1
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. :)

Ulrich Schwarz
- 7,598
- 1
- 36
- 48