用于链接现有内容项目作为另一个内容项目的翻译的 LinguaPlone API 是什么?
我想在 LinguaPlone 中以编程方式将一个项目链接为另一项目的翻译。 API 是什么?
I would like to link one item as the translation of another item, programmatically, in LinguaPlone. What's the API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要首先确保您拥有规范对象:
然后您可以通过在翻译上调用
addTranslationReference
来链接您的翻译:仅此而已。 LinguaPlone API 的记录相当不足,您最好的选择是查看 I18NBaseObject 源代码。要记住的最重要的事情是,总是有一个规范对象,任何翻译都通过引用链接到它,其中参考点从翻译到规范对象。
You need to make sure you have the canonical object first:
You can then link your translation by calling
addTranslationReference
on the translation: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.
我认为是obj.addTranslationReference(tr_obj),目标语言取自tr_obj。但这只是基于对 I18NBaseObject.py 的简要了解:Plone 是我的日常工作,而且是周末。 :)
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. :)