Jump to content

Any tips on expoting/importing site content translations?

Recommended Posts

Hi all,

We have this huge website (over 7000 pages and a few dozen templates). We've used TextLanguage and TextAreaLanguage fields for all textual fields, and all image and file fields have their own description input boxes for different languages too.

Now we'd need to export all pages and send them to our translator so they can translate all site contents with their specialized programs, and a way to import the translations back to our site alongside the content in original language.

Has anyone done anything similar to this? How did you solve it? Maybe there already is a solid way to do this, or an idea we've not thought of yet. Thanks for any thoughts!

Share this post

Link to post
Share on other sites

Does the translation system import which file type? json, xml, csv?

You can export all the pages' contents to one of these formats and import them again after that. The only thing that will make it more or less hard is the 3rd party system.

Share this post

Link to post
Share on other sites

Hi! The translator sent us a huge list of file formats their software's exports and imports supports, including json, xml, csv and even html. So it won't be a problem.

Do you have an example on how to go about exporting from and importing to ProcessWire again? Some module perhaps? I've tried adrian's awesome Batch Child Editor, but it doesn't seem to support multi-language fields.

Share this post

Link to post
Share on other sites


Oh yeah, there's a lot of examples here. Have in mind that importing different languages if just a matter of setting the language before importing the content, nothing more. :)

Let's see, to begin, there's Ryan great case study on importing content from Wordpress

And an example of mine, where I show how to import book contents in two languages (en and pt):

<!DOCTYPE html>
<html lang="en">
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Import Books</title>
  <table border='1' width='100%'>
// get access to WordPress wpautop() function
$wpdb = new PDO("mysql:dbname=ricardo-wp4_db;host=localhost", "root", "root", 
$books = wire('pages')->get('/books/');
$sql = "
  SELECT * FROM wp_pods_books
$query = $wpdb->prepare($sql);

while($row = $query->fetch(PDO::FETCH_ASSOC)) {
  $book = $books->child("wpid=$row[id]"); // do we already have this book?
  if(!$book->id) {
    // create a new post
    $book = new Page();
    $book->template = 'book';
    $book->parent = $books;
    echo "Creating new book...\n";
  $book->wpid = $row['id'];
  $book->name = wire('sanitizer')->pageName($row['name'], true);

  $en = $languages->get("default");
  $book->title->setLanguageValue($en, $row['name']);
  $book->body->setLanguageValue($en, $row['body']); 
  $book->introduction->setLanguageValue($en, $row['intro']); 
  //add more fields if needed

  $pt = $languages->get("pt");
  $book->title->setLanguageValue($pt, $row['name_pt']);
  $book->body->setLanguageValue($pt, $markdown->convert($row['body_pt']));
  $book->introduction->setLanguageValue($pt, $markdown->convert($row['intro']));
  //We need to activate portuguese page so it will appear on the front-end
  $book->set("status$pt", 1);

  // give detailed report about this post
  echo "<tr>" .       
       "<td>$row[id]</td>" .
       "<td>$book->title</td>" .       


You can get the gist here.

And last but no least, there's Adrian's Migrator module -> https://processwire.com/talk/topic/8660-migrator/?hl=migrator

Edited by Sérgio
  • Like 1

Share this post

Link to post
Share on other sites

I've done something similar a few years ago. Unfortunately I don't have the code anymore. From my vague recollection I've done the export this way:

I built an array with all templates which contain translateable fields and the translateable fields. With this informations I built a foreach loop which loops over the the templates and writes the contents of the fields in csv-files.

The import was done the same way but only the other directions ;-)

The translators could do so the translations of 6 languages and got no access to the backend.

I hope I could give you a helpful tip.

Edit: I can remind me that we had done this with 6 independent branches without textLanguage fields. If you want to get the values you have to switch the user language for the languages to get the right values. This must also be done in the case you want to import the values. In an other project I had also to import a huge collection of values from 2 languages. If you have further questions don't hesitate ;-)

Edited by hheyne
  • Like 1

Share this post

Link to post
Share on other sites

Just curious: Why can't these translators simply do their work directly in PW?

so they can translate all site contents with their specialized programs

What "spezialized programs"? imho, a professional translator should be capable to deal with various standard industry solutions such as Microsoft / OpenOffice products, or Adobe / CMS backend / WYSIWYG interfaces.

Share this post

Link to post
Share on other sites

If I remember that correctly some of the clients I'm working for are using specialized translation software, as lot's of the marketing speech is already translated somewhere, especially company specific terms and phrases. And I doubt that someone is supposed to translate those 7000 pages of tkaranka fully by hand.

  • Like 1

Share this post

Link to post
Share on other sites

Wow, what a nice surprice to come back to office after the weekend and find so detailed answers!


This code sample and the notion of just changing the language are invaluable. I should have guessed the simplicity, this being ProcessWire after all... Next I shall read Ryan's case study (which I believe will be enlightening!) and check adrian's Migration module in light of this. Thank you for pointing these!


Thanks for this recolletion! It sure helps me to grasp the way of thought, and proves it's not a big deal after all.


As LostKobrakai already answered, they use a program that has a kind of memory of commonly used phrases and translations for certain words for a brand, so that everything stays in line and reduces the actual translating work tremendously. For starters. It's quite fascinating really, here's a link to an overview of the technologies if you're interested: http://maris.fi/en/faq/translation-memory/

It would also be irrational way to use time customer is paying by clicking through the admin interface and try to cover every single page, tab and field individually and with no way to see the whole context at a glance. This is not a small site we're talking about here after all.

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By snobjorn
      Here's my Norwegian language pack for ProcessWire. I've been adding translations over some time, to suit my own projects users needs.
      Last updated:
      2019/06/19 (June 19, 2019)
      Not yet complete. Translations that non-superusers will see is prioritized.
      Translated using:
      ProcessWire 3.0.133 dev
      Number of files:
      189 wire files and 95 site files – ranging from just started to completely translated. The site files includes translation some free and some pro modules, see the complete list in the README.md at GitHub.
      Available at GitHub:
    • By happywire
      Using devilbox to develop locally.
      Installing the Beginner, Intermediate and Blank sites from the setup menu works perfect.
      The sites load, all pages load, can access the admin panel, all fine.

      However when installing the Multi-language site, the one I can pick during the setup procedure, things do not work.
      The English Home page works.
      The English About page,
      https://wiremultilang.loc/en/about/ tells me
      Same for the English Sitemap,
      https://wiremultilang.loc/en/site-map/ .
      I have allowed all cookies and can see them when checking in the browser cookies and site data, using Firefox 65.0.1 64-bit on Ubuntu 18.04.2 LTS.
      Clicking "German" on the Home page,
      https://wiremultilang.loc/de/ , shows me the German version of the 404 page.
      Clicking "Finish" on the Home page,
      https://wiremultilang.loc/fi/ , shows me the Finish version of the 404 page.
      What could be the issue here?
      Thank you for your guidance or any help you could supply.
    • By louisstephens
      Hopefully this is the right place, if not, please move it to the proper sub. I installed the multi language module on my development (sandbox) set up not too long ago to test out a few things. From the start, I ran into some issues with dependencies not being met/installed, so I thought that I would simply just uninstall what had been. Unfortunately, that took me down a road of using some code in my home template to remove the modules (cant find it at the moment). After some struggling, I finally got it uninstalled, but it left behind 3 fields,
      language language_files language_files_site I thought that I could simply remove them from the languages template and then delete them, but I get the following error:

      I was wondering, is there a way to remove these using the api? I couldn't add any new users to the setup until I made "language" not required, but I was hoping to just remove all of the fields.
    • By bartelsmedia
      "Deepl" is an unbelievably good (paid) text translation service, that mops the floor with Google Translate.
      They have an API and it would be awesome, if there would be a module, that would integrate it for easy content translation.
      It could be a right-click context menu on the language tab:

      It should ask from which of available other language it shall take translate from.
      What do you think?
  • Create New...