Is there a way to duplicate a document in all locales? Not just the currently selected language

If I hit duplicate on a document it only duplicates the currently selected language.

I have each document translated in many different languages and this is therefor not really saving me any time since the duplicated document is empty in all languages except the currently selected one. The rest of the duplication has to be done manually.

Can anyone confirm if this simply is the case? Or if I am missing something (which I hope!).

2 Likes

Hey Leopold, thanks for reaching out.

You are correct, right now copying a document (with all its content or just with the slice structure and assets) to another locale needs to be one document at a time.

We are working on introducing bulk actions this will allow you to bulk copy documents to another locale. I’m not sure that this will cover your use case entirely but what we can do is mark this as a feature request.

For the moment, and until the Bilk actions feature is released (You can follow the status of new features in our progress page!) you can still bulk duplicate docs, but you'll need to use the Import export feature:

Thanks very much for the reply. Just to make sure we are talking about exactly the same thing.

Example:

  • I have a single document already translated to multiple languages (English, Spanish, German).
  • I am viewing the document in English.
  • I press "Duplicate" (not Copy to another locale).
  • I get a duplicate/copy of the English document, but when I switch to Spanish or German those languages are empty in my newly created copy.

I could imagine the following change:

Either, the default duplicate behavior would be to include all locales - or it would be optional:

Currently it is like this:

Screen Shot 2020-12-17 at 12.41.50

It could be like this:

Screen Shot 2020-12-17 at 12.40.38

Oh ok I understand, so it was 'duplicating' rather than copying. It is still a similar process, for the moment you would still need to go one by one because this newly created copies are considered independent documents.

The example that you gave is a very good one, thanks a lot for putting this up, this kind of examples are great for sharing with the product team. I'll be sure to share this with them

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.

You can use the Import/Export module and some scripting to bulk duplicate documents to many locales at once.

  • Publish the original document from the Prismic UI
  • Export your documents using the Export module

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

  • Get the “grouplang ID” value from the original
  • generate one JSON file for each of the language you want to duplicate the document to
  • in each JSON file you generate, replace the lang value with the target locale code (i.e., “lang”: “es-es”)
  • In each JSON file you generate, 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

So 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

We decided to use Prismic to simplify the authoring process for non technical people. But it appears that some simple actions like this one, it requires running a script and the marketing or legal teams are definitely not going to do that.

Do you plan to release a Duplicate in all locales button at some point, as proposed in the screenshot above?

1 Like

This feature already exists but in a slightly different way. You can manually select each language that you wanna copy the content to @prismic24. For the Duplicate in all locales button, I'll add it to our product board. Maybe we can consider it for future updates.

Please keep in mind that if you use Content Relationship fields you need to copy all documents to the same release, otherwise this will resolve in broken links.

Hi Pau,

Is there any workaround?
For now, my Prismic users duplicate a document per locale, but the documents are not linked to each other, meaning that when you open a document and switch the locale, there is no content…

There's no workaround for the moment. This is something that needs to be modified manually. The links in the translations need to be readded after they're copied.

Can you tell me how to re-add the links between translations linked to the same document afterwards?

You can keep the links by copying all the documents to another locale at the same time. The docs will be added to a release, and the links will be saved correctly. The only disadvantage is that the links must already exist in the documents of the master locale, and that you have to select many documents simultaneously.