开发者

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

开发者 https://www.devze.com 2023-02-04 23:00 出处:网络
I would like to 开发者_开发知识库link one item as the translation of another item, programmatically, in LinguaPlone. What\'s the API?You need to make sure you have the canonical object first:

I would like to 开发者_开发知识库link one item as the translation of another item, programmatically, in LinguaPlone. What's the API?


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.


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. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消