I would like to convert all my content from the sub-language en-ca back to en. What is the API for this?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With