Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 385
JBlack Avatar asked Apr 01 '11 14:04

JBlack


1 Answers

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.

like image 156
Martijn Pieters Avatar answered Sep 30 '22 09:09

Martijn Pieters