Import a new translation for an existing document

Hi,

We have a select set of master French documents in Prismic which we want to translate into a new language (we're not going to translate all documents). There appears to be a process where we can import a new translation for an existing document which is outlined in Prismic's own documentation here:

Can you please confirm if the following process will work:

  1. Create new target locale in Prismic
  2. Export ALL JSON files from Prismic (including the source master language JSON)
  3. Copy the relevant source master JSON files which we need to translate and rename those as follows:

translate_{grouplang}_{lang}.json

  1. Change the target language ID in each translated JSON, e.g.

"lang": "pt-pt",

  1. Import the specific translated JSON files (not all the exported JSONs) by going to Settings->Import/Export->Import your documents

Will the above process work? If so, do we have the option to set each translated document as "draft"?

Thanks,
Warren

Hello @warren_jarm

Welcome to the Prismic community, and thanks for reaching out to us.

The process you are explaining and mentioned in the documentation will surely work. Each translated document after import will come in a release/planned tab. You can not set it as a draft.

Let me know if you have any further questions.

Thanks,
Priyanka

Hi Priyanka,

Thanks for confirming that process will work. In terms of what happens after we import the relevant translated JSON files - we need to QA/test the translated web pages before they are published. Can you please advise what the process would be for us to enable a translated web page to be tested by one of our external linguists before the web page is published to live?

Thanks,,
Warren

Hello @warren_jarm,

If Prismic previews are configured, you can preview Release documents live on your website before publishing them.
Learn more about Previews here: https://prismic.io/docs/guides/previews#preview-a-release
What framework are you using? We have different documents for using Previes according to the framework.

Thanks,
Priyanka

Hi Priyanka,

Thanks for getting back. I will look into which framework is being used. How do I find out which framework?

I tried importing a JSON following the process as you confirmed but I received a "fatal error":

Unable to locate or analyze image: ‘https://prismic-io.s3.amazonaws.com/zenchef-fav/24a35a42-e3fd-48c2-ab5f-aa7a9d2d030e_Partner_Association.svg’

Invalid url: ‘mailto: help@zenchef.com

Unable to locate or analyze image: ‘https://prismic-io.s3.amazonaws.com/zenchef-fav/ba4b2b01-72f4-47ec-a9ed-897a74caec03_Partner_Supplier.svg’

Can you please let me know how to fix? I can get to the image urls via a browser so I'm not sure why Prismic is giving me those errors.

Also - we have existing PT-PT pages setup in Prismic which the exported JSON files are based on. When I tried importing another PT-PT JSON file it gave me an error saying A document already exists for this lang (pt-pt) within the group YmK4sRIAAC8AJwBk:

Do I need to delete the existing pt-pt page from Prismic before importing the PT-PT JSON?

Thanks,
Warren

Hello @warren_jarm

  1. For the error saying: A document already exists for this lang (pt-pt) within the group YmK4sRIAAC8AJwBk: Does the same document already available in your Archive or Release tab? If it is available, you need to delete the documents and try importing them again?

  2. Unable to locate or analyze imageerror: This is a known issue with SVG file format. You can do the following things:
    There are some workarounds that might work for you until a fix a produced. I have no ETA for the fix.
    a. Changing the meta of SVG manually and retrying the import
    b. First import from the media library and then reference it in the imported JSON files.
    c. Or change the format of SVG.

  3. Invalid url: ‘mailto: help@zenchef.com: This doesn't work with Import. You have to do it manually after importing.

Thanks,
Priyanka

Hi Priyanka,

Thanks again for your advice.

    1. For the error saying: A document already exists for this lang (pt-pt) within the group YmK4sRIAAC8AJwBk: Does the same document already available in your Archive or Release tab? If it is available, you need to delete the documents and try importing them again?
  • Yes, the document does exist in the Archive. If the same document document doesn't exist in "release" or "archived" but is a LIVE document and I still see the error - should I delete the LIVE document first and then import?
  1. Unable to locate or analyze image error:
  • I tried uploading the SVG to the Media library and copying the link of those 2 SVGs into my JSON file. When I import my updated JSON I still get an error:

  • In terms of editing the metadata in the SVG, can you please give me an example of what do to there? There is no tag in the SVG that I can see.

Thanks,
Warren

Yes, You need to delete the document. What is the type of document? It's Single type or repeatable. Try to change it to repeatable if it works. If it doesn't work, you need to delete the document.

Can you try to change the format of the file. It's uncertain that SVG works with Import. Or you can send me the JSON file and the repo name in a private message, I can try on my end.

Thanks,
Priyanka

Hi Priyanka,

I sent you a private message letting you know that I deleted the live document before I imported my JSON and saw the import error warning "minor error" to do with the SVG. I then went ahead and imported the JSON by clicking "import now" and it imported successfully. When I previewed the page the 2 SVGs appeared but can you please double check it all worked? The details of the page are in the email message I sent you.

Thanks,
Warren

Hey @warren_jarm, you can see if the images are properly imported by checking the documents added to the Import release. Are you able to see the SVG?

Hi Pau,

When I click on my published document in the I can see the SVGs appear.

So, can I assume everything is fine and the minor import error I saw about the SVGs can be ignored?

Thanks,
Warren

Yes. If you can see the image in the UI and in the API response, then there shouldn't be any problem