Crowdin CLI translation upload does not handle project hierarchy correctly

Hallo,

I try to setup Crowdin for a Docusaurus localization project (Crowdin project). I am using the following folder mappings in crowdin.yml:

files:
  - source: "/i18n/en/**/*"
    translation: "/i18n/%two_letters_code%/**/%original_file_name%"
  - source: "/docs/**/*"
    translation: "/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%"

For example, file:
docs\00_intro\10_fair.mdx
should have its translation in
i18n\de\docusaurus-plugin-content-docs\current\00_intro\10_fair.mdx

For some reason, the CLI translation upload fails to correctly map this but looks for the file in:
i18n\de\docusaurus-plugin-content-docs\current\10_fair.mdx

Equally, the translation download would place these files there where they do not belong.

I do not understand what the problem is - does anybody have a solution for this?

Kind regards,
Johannes

Hello Johannes,

Have you followed those guides?

Perhaps Docusarus CLI is different to general

But there should be separators beetween source and translation

Like here



"files": [
  {
    "source": "/locale/en/folder1/[0-2].txt",                                       #source files filter
    "translation": "/locale/%two_letters_code%/folder1/%original_file_name%"        #where translations are stored
  },
  {
    "source": "/locale/en/folder2/[0-2].txt",
    "translation": "/locale/%two_letters_code%/folder2/%original_file_name%"
  }
]

Dear Anna,

Thanks for the kind reply! I created the config file according to the link to docusaurus.io you posted. I tried to write the configuration in both YAML and JSON style, but both lead to the same result.

YAML:

files:
  - source: "/i18n/en/**/*"
    translation: "/i18n/%two_letters_code%/**/%original_file_name%"
  - source: "/docs/**/*"
    translation: "/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%"

JSON:

"files": [
  {
    "source": "/i18n/en/**/*",
    "translation": "/i18n/%two_letters_code%/**/%original_file_name%"
  },
  {
    "source": "/docs/**/*",
    "translation": "/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%"
  }
]

Both lead to the message:
[SKIPPED] 'i18n\de\docusaurus-plugin-content-docs\current\10_fair.mdx' translation file doesn't exist in the specified place

So this skip message, it says that for German transaltions file are skipped, what about other languages?

If the source files uploaded fine? Maybe you need just to add “preserve hierarchy = true”?

In case the 1st paths - translation: “/i18n/%two_letters_code%/**/%original_file_name%”
worked fine, it’s just a config issue, not the importer or system-level one.

Thanks a lot for your reply!
German is the only translated locale. I also used the preserve_hierarchy property.

I am confused, I checked my configuration against other Docusaurus projects which supposedly work but for some reason, it does not work for my setup.

Can you try specifying the whole paths without asterisks in the configuration for this file? Also, just an assumption, but maybe the folder starting with numbers doesn’t work - you have a chance to test letter-only naming of folders?

It’s said here that sources should be re uploaded after any configuration change, do you do that?

Last but not least, you have a native build V2 Docusaurus, or migrated from V1?

[SKIPPED] 'i18n\de\docusaurus-plugin-content-docs\current\10_fair.mdx' translation file doesn't exist in the specified place

Translations should be at the same place + with the same path both in config, in your repository (laptop), in Crowdin, and in the file settings. Can you check all of them, whether the files are there?

1 Like

Thanks for your reply!

That is an excellent suggestion for a possible workaround, I will try that - I also suspected that Crowdin CLI cannot handle folders starting with numbers.
Anyway, I will test these suggestions and report back. Thanks again!

@GregoryLanncved Thanks again for the suggestion! I added all file locations explicitly to the config without using **and it works! As the folder structure rarely changes I can live with that.

Complete config: knowledge_base/crowdin.yml at 266-bilingual-knowledge-base-english-german · NFDI4Chem/knowledge_base · GitHub

1 Like

Great to hear you have found a solution!