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 https://user-guides.prismic.io/en/articles/4197761-bulk-duplicating-documents-into-another-language, 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.

Hello, I am reopening this topic as it is a re-occurring issue. I have to mention that I have tried the workarounds mentioned in the previous replies and none worked.
I also have an additional question to this topic: Is there a possibility to regenerate the value of the field GroupLang in order not to contain the character _ (underscore)? This way the import issue would be solved.

Hello @Prismic-Support-Team, can you please advise on the above?

Hi,

I confirm that some GroupLang IDs include a "_" character conflicts with the file naming convention for importing translations of existing documents. We don't currently have any solution for handling this case.

I've reached out to the engineering team and added this to the issue tracker.
We'll update this same thread when we have news about this being solved.

Thanks

This thread is being monitored as an open ticket in the internal Prismic issue tracker. The Prismic support team will update this post as we get more information from our dev team. If you have a similar use-case, you can ‘Flag’ this topic to reopen and add it here.

A fix has been deployed to support the naming convention when GroupLang ids contain an underscore character. If you face the issue, just ping us here so we activate the fix on your repository.