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 are sharing the same grouplang ID. You can find the grouplang ID at the end of the JSON files you get when exporting documents. It looks like this: "grouplang": "Xr6nORAAAChEyddY"

Import a new translation for an existing document

You can import translated content for an existing document. To do this, you need to import files with this naming convention translate_{grouplang}_{lang}

Example:  if you'd like to import a "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:

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, for our example, the JSON file you'll import must have the right locale code in it: "lang": "fr-fr".

Bulk duplicating documents from a language to another

In some cases, users are willing to bulk duplicate documents from a language to another, and then have translators work directly on the copies in the Prismic UI. In that case, you can use this script to automatically prepare many Import files with the right file naming convention.

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

Did this answer your question?