Translate & Adapt losing Translations & Backups?

Hey there!

our online store is setup to be translated using Translate & Adapt. This was working fine so far.

But then a template has been renamed, which lead to the fact, that suddenly all translations for this page were gone.

Is there any simple way to get the translations back? Simply rename the file back to its old name did not work.

Since the translations may not be version controlled, whats the technical logic there?

And since the translations are also gone in the export, is there any way to get a daily backup of the translations?

Thanks so far.

From my short experience with Shopify and the app (Translate & Adapt), it seems that a “translation” is static–a snapshot in time. So, timing seems important. if I have already translated my store pages, and then later, when I create a new page, I must then go to “Translate & Adapt” to click on “Auto-Translate”. Then, it nicely translates that new page (and verifies the translation on all of the other pages in my Shopify store). If I do not click to “Auto-Translate” after adding a new page (or editing/changing a current page), it does not create/update translations on the new/changed content.
I do not know if this is by design (translation on demand), or if there is a lag time of a few hours for “automatic” translation.

Just as some documentation.

In the meantime, i built a solution for daily backups by using make.com (a no-code platform), but it should also be doable by using some kind of alternative like n8n.

What it does is:

  1. Create a copy of a template spreadsheet which is basically empty and only contains tabs named by the shopify api categories
  2. Use the following categories to get all necessary translations:
ONLINE_STORE_THEME,PAGE,PRODUCT,ONLINE_STORE_THEME_LOCALE_CONTENT,METAOBJECT,MENU,LINK​
  1. Iterate through them and retrieve for each a list of 250 translations:
query {
  translatableResources(first: 250, resourceType: {{23.value}}) {
    edges {
      node {
        resourceId
        translatableContent {
          key
          value
          digest
          locale
        }
        translations(locale: "en") {
          key
          locale
          outdated
          updatedAt
          value
        }
      }
    }
  }
}
  1. Parse the data and use the following JS to sort the output:
class TranslationEntry {
  constructor() {
    this.resourceId = "";
    this.digest = "";
    this.key = "";
    this.outdated = false;
    this.de = "";
    this.en = "";
    this.updatedAt = "";
  }

  static fromNode(node, key) {
    const entry = new TranslationEntry();
    entry.resourceId = node.resourceId;
    entry.key = key;

    // Find German content
    const deContent = node.translatableContent.find((c) => c.key === key);
    if (deContent) {
      entry.de = deContent.value;
      entry.digest = deContent.digest;
    }

    // Find English translation
    const enTrans = node.translations.find((t) => t.key === key);
    if (enTrans) {
      entry.en = enTrans.value;
      entry.outdated = enTrans.outdated || false;
      entry.updatedAt = enTrans.updatedAt;
    }

    return entry;
  }
}

let out = [
  {
    resourceId: "resourceId",
    digest: "digest",
    key: "key",
    outdated: "outdated",
    de: "de",
    en: "en",
    updatedAt: "updatedAt",
  },
];

const data = input;

await Promise.all(data.edges.map((edge) => {
  const { translatableContent } = edge.node;

  // Slice translatableContent into chunks of 50
  for (let i = 0; i < translatableContent.length; i += 50) {
    const chunk = translatableContent.slice(i, i + 50);

    chunk.forEach((content) => {
      out.push(TranslationEntry.fromNode(edge.node, content.key));
    });
  }
}));

return out;
​
  1. Bulk insert the output data into the spreadsheet

This could would run nightly for our site, creating a backup of all “hot” translations, which could disappear as soon as a new section would be edited.

Notes:

  1. this is a workaround and not a solution to restore translations! But it gives you the ability to at least look up some translations and restore them manually, which was more than enough for my case.
  2. we used this blueprint for german and english translations. Feel free to extend the code as soon as you need more languages
  3. The more categories or languages are needed, the more steps can be needed. Take care of possible costs due to plan limitations.