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

182 Views Asked by At

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

1

There are 1 best solutions below

1
On BEST ANSWER

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.