0

I've got a CCK content type called 'projects' with about 10 fields, including an ImageField that allows for multiple images.

There are two languages defined for the site: English (the default), and Chinese.

The projects have been created in English by the client.

Now, they want to add translations for all the projects into Chinese. So, I've:

  • enabled content translation
  • created a new 'project' node (e.g., node/234) and populated just the title and body fields (all the other values are the same between both nodes)
  • gone back to the original English node and added node/234 as the translation

The problem of course is that when I go into the Chinese translation for the page, the field values for the original node aren't there, so at the moment, the site editors would have to re-add the values all over again.

Is there a module or Drupal setting for addressing this issue, or would it be better to, say, create a module to run a query that populates the fields in Chinese translations with the values from its sister English node? I'm not adverse to writing such a module, but if there's a solution already, of course that would be better.

1

I've found a solution that works for my needs. There's probably a better way:

Modules used: Views Bulk Operations, Node Clone, Views Bonus Pack, Language Assign, Feeds

Assumptions: you have a CSV file or MySQL database with translations of your pages in another language. It's not necessarily to have this - it just makes things faster.

  • Install the Node Clone module and Views Bulk Operations (VBO) module. Add this patch to expose the Clone feature to VBO.
  • Clone the nodes you need in VBO. This will append 'Clone of' to the title of each cloned node.
  • Set the language of the new nodes, again using VBO and Language Assign.
  • Install the Views Bonus Pack to get CSV export functionality. Create a View that uses the CSV Feed style, and add the title field and any other fields you need translated. Add a filter that displays only fields where the title starts with 'Clone'.
  • Export the nodes using the View created in the previous step.
  • Now, you can either manually add your translations to the CSV file by replacing them with the relevant translations, or you can use your new CSV as a reference file to add the right node ids to your original CSV with the translations. Basically, at the end of it, you have a file like this:

-->

| Node ID | Original Title | Chinese Title  | Body         | Some other field |
| 234     | Hey You        | ????           | Blah, blah   | Blah ...         |
  • Now, you can install the Feeds module, override the default CSV import, changing only the mapping and content type to use. Map the field 'Node ID' to the node ID (or the original title to the node title), and change the Update options to 'Update node.'
  • Go to http://yoursite.com/import. Do your import. I did, and now I'm happier.

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.