Convert LinguaPlone sub-language back to language for all content?

北慕城南 提交于 2019-12-07 07:51:27

问题


I would like to convert all my content from the sub-language en-ca back to en. What is the API for this?


回答1:


Simply call setLanguage on your content item. A quick-n-dirty script to accomplish this would be something along the lines of:

cat = context.portal_catalog
for brain in cat.unrestrictedSearchResults(Language='en-ca'):
    content = brain.getObject()
    content.setLanguage('en')
    content.reindexObject(idxs=['Language'])

You'll need to reindex your content after changing the language setting, but the idxs parameter to the reindexObject call ensures that only the Language index get's updated, making the process faster.



来源:https://stackoverflow.com/questions/5514958/convert-linguaplone-sub-language-back-to-language-for-all-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!