Translations: grouplang contains the underscore (_) char

Hello,

I am trying to translate some docs in Prismic by using the import/export feature. Trying to translate from en-gb (english) to fi-fi (finnish).

According to this page Bulk duplicating documents into another language | Prismic Help Center, in order to create translations of a doc, the name of the doc should follow this pattern: translate_{grouplang}_{target_locale}.json.

So, I followed the instructions, translated 1 doc, performed an import and cannot import because of an error. Please see image below.

After taking another look, I realized that the doc has a grouplang containing the underscore char (_); for example: "grouplang": "X_7dJxEAACEAdKkB". The name of the doc is translate_X_7dJxEAACEAdKkB_fi-fi.json.

How can I perform an import for the translated doc?
Is there a solution to this?

Thanks in advance,
Cipri

@Fares could you please help me with this?

Hi there,

I'm currently investigating this issue, and I will get back to you as soon as possible.

Fares,

Well in fact the simplest solution for this issue to use another separator than the "_" by editing the script

Here is an example of what you can do:

#!/bin/bash
sed -i '' -e 's/"lang":"en-us"/"lang":"fr-fr"/g' *.json
prefix="translate*"
targetlocale="*fr-fr"
filetype=".json"
for filename in ./*.json; do
   grouplang=$(json -f $filename grouplang)
   mv "$filename" "$prefix$grouplang$targetlocale$filetype"
done

Hello @Fares and thanks for the reply.

I have just tried the proposed solution and created a translation (from en-gb) named translate*YCzGjxUAACYA2GE-*da-dk.json,but unfortunately when importing I get the following error message: "We found some errors in your documents. You have to fix it before importing." (Windows does not allow the char * within a file name, but gave it a shot).

Anyway, I replaced * with = and in this case the import was successful. However, the documents were not linked, i.e.: the en-gb document and the da-dk document (tried translating from british english to danish).

Could you please help me?

Regards,
Cipri

Ok, I will try to investigate this,can you share with me the zip file of the translation generated?

Also I have noticed that you have an extra "-" in "translate=YCzGjxUAACYA2GE-=da-dk" instead of "translate=YCzGjxUAACYA2GE=da-dk" is that is is just a typo?

This issue has been closed due to inactivity. Flag to reopen.