6

I'm making an existing site with a few thousand nodes multiligual. Source is English. How can I set all of the existing content to langauge:English instead of neutral all in one bulk command?

12

Here's one way to do this that doesn't involve writing any code.

  1. Install the VBO module.
  2. Create a new view showing Content of whatever content types you need to convert. Use the Fields display method.
  3. Add a field Bulk operations: content.
  4. Check Modify entity values and select Language.
  5. Choose Apply.
  6. Save the view (add any other filters if necessary to limit the selection) and go to the created view page.
  7. From the view page, choose the option to select all items on all pages and execute the Modify entity values action.
  8. Choose the language and click next.

If you have an extremely large number of nodes, you may need to play around with the queuing settings so that not everything is executed at once, but I would try doing it in one pass first because hey, if it works, you're done (note: always test on a backup first!)

  • 1
    nice! worked like a charm. – blue928 Jan 9 '13 at 14:00
4

Here's how I bulk set the language on my site:

  1. Using Views Bulk Optimization, select all nodes you want to change, use the 'Change value' option and then change the value to language you want.

  2. After you've done this, the field values will not appear when editing the nodes, so you need to run a script, e.g. UPDATE database.field_data_body SET language='en' WHERE bundle='page' (use your db name, field name, and bundle as appropriate).

IMPORTANT: If you have any custom url aliases, they will be overwritten with this approach, due to a problem with pathauto, but there's a work-around: first go to /admin/config/search/path/settings, and change the 'Update action' option to 'Do nothing. Leave the old alias intact.', then change this value back once you've run your Views Bulk Operations action.

(I've now answered three Stack questions with this answer, hopefully it won't be considered spam).

1

In reference to the accepted answer here is a views export that does just that. https://gist.github.com/dasginganinja/7bfa862f379ade6e0f0f

  • 1
    Do keep in mind that this just changes the node's language. You will also need to update the affected database fields' language (i.e. body, tablefield, etc). – dasginganinja Aug 7 '14 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.