5

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

JBlack
  • 53
  • 2

1 Answers1

5

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343