Translate Content in Bulk

This article explains how to import translated content for an existing document in your Prismic repository.


To import translated content for an existing document, you need to import JSON files with a naming convention based on the grouplang ID.

grouplang ID

The grouplang ID is a common identifier for a document and its translations. A document in the master language and all its translations share the same grouplang ID. You can find the grouplang ID at the end of each JSON file when export documents. It looks like this:

Copy
"grouplang": "Xr6nORAAAChEyddY"

Import a new translation for an existing document

To import translated content for an existing document, you need to import files with this naming convention:

Copy
translate_{grouplang}_{lang}

For example: If you want to import an "fr-fr" French translation of an existing "en-us" document (for which the grouplang ID is WKq0ph4AACEA4M9B), the JSON file you'll import for the French content needs to be named like this:

Copy
translate_WKq0ph4AACEA4M9B_fr-fr.json

The filename has to contain the grouplang ID that you can find in the master language document when exporting it.

Also, make sure you have the right locale code set up in the JSON file itself.

Copy one document to multiple locales at once

You can use the Import and Export feature and some scripting to copy one document to multiple other locales at once. 

  • Publish the original document from the Prismic UI
  • Export your documents using the Export module (you'll get a ZIP archive containing one JSON file for each published document)

Play the following script on the list of documents you want to duplicate to all locales at once:

  • Get the grouplang value from the original document.
  • Generate one JSON file for each of the languages you want to duplicate the document to.
  • In each JSON file, replace the lang value with the target locale code (i.e., "lang": "es-es")
  • In each JSON file, insert the grouplang value (the one you grabbed from the original file, i.e.,  "grouplang": "X3dY8hAAACQASEKF")
  • Name each generated files following this convention translate_{grouplang}_{lang}.json

For example, if you need to generate duplicate JSON files for 3 locales, you’ll end up with these files (assuming the group land ID of the original is X3dY8hAAACQASEKF)

translate_X3dY8hAAACQASEKF_fr-fr.json
translate_X3dY8hAAACQASEKF_es-es.json
translate_X3dY8hAAACQASEKF_it-it.json

  • ZIP the generated files
  • Import them using the Import module

Troubleshooting Singletons

You might see an error when trying to import a translation for a document that is of a Singleton type. In that case, switch the type from Singleton to Repeatable. Once you're done with the import, you can change it back to Singleton. 


Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Get in touch with us on our Community Forum.