Crowdin Translation Download messes front matter
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
I am currently integrating Crowdin translations into my project’s docs.
After running the following:
yarn run write-translations
yarn run crowdin upload
yarn run crowdin download
The translated sidebar_labels have a different formatting than the original docs.
For example, we expect the markdown format to be:
---
sidebar_label : Aperçu
---
in the translated docs but instead we get:
- - -
sidebar_label : Aperçu
- - -
Which messes up the rendering as can be seen here:
Reproducible demo
No response
Steps to reproduce
- Follow the guidelines here: https://docusaurus.io/docs/i18n/crowdin
- After generating translations, the sidebar_label surrounding dashes add an extra space between them, messing up the rendering.
Expected behavior
---
sidebar_label : Aperçu
---
Actual behavior
- - -
sidebar_label : Aperçu
- - -
Your environment
- Public source code: https://github.com/celestiaorg/docs
- Public site URL: docs.celestia.org
It is not live, we are testing it on a branch with no code modifications, just testing the crowdin integration.
Self-service
- I’d be willing to fix this bug myself.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Downloading Translations | Crowdin Documentation
You can download translations for the whole project at once or for separate files. Translations will be downloaded according to the export settings ......
Read more >Downloading Translations - Crowdin Documentation
You can download translations for the whole project at once or for separate files. Translations will be downloaded according to the settings configured...
Read more >Advanced Project Setup | Crowdin Documentation
Project owner and managers can always download sources and upload translations, not depending on the option status. Allow proofreaders to access hidden strings...
Read more >Project Settings | Crowdin Documentation
If the option Save context information in the files is enabled, the context and max.length added in Crowdin Enterprise will be visible in...
Read more >Offline Translation | Crowdin Documentation
You can download each file separately (in original or XLIFF format), download filtered strings (in XLIFF format), or download all files for a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From my experience, this is a very annoying Crowdin bug. Our website used to have the exact same issue. AFAICT, this is caused by Crowdin treating “Markdown with front matter” and “Markdown without front matter” as two separate file types, so if you uploaded a Markdown file and added front matter later, that front matter would be recognized as part of the content, so it becomes two separators (as
---
is the syntax for separators). Similarly, if you uploaded a Markdown file with front matter and later removed it, Crowdin would literally break. Last time I contacted them:…here was the response (for the latter issue, not the one you are reporting):
2. In case you’d like to update the using-plugins.md file with no front matter (as you showed us previously), it’d be required to have Project Manager’s access. The file could be updated in UI in the Content → Files tab, here’s a short guide (Proofreaders cannot access this tab): https://support.crowdin.com/files-management/?q=update#updating-source-files
If the file is indicated in the config file, it’s totally possible to update it via CLI as well with the “crowdin upload sources” or “crowdin push” commands, but still it’s required to do so via the Project Manager’s account.
Once the source file will be updated in the Content tab→ Files, the front matter for the file will be removed from the Crowdin project.
4. Also, in case you’d like to automatically update the files in the Crowdin project (once you change the fronts or anything else), we also have an option to connect the repository directly with the Crowdin project. Here’s a short guide: https://support.crowdin.com/github-integration/?q=github
The GitHub integration has a sync schedule based on which, the source files and translations will be automatically updated (sources in project, translations in the repo).
Great, currently re-upload is the only good way to switch the file type in the project (file type is set when the source file is uploaded).
There was a plan to deactivate automatic translations import from GitHub (especially if we talk about Markdown or HTML files), hope that will be introduced a bit later this year 🤞Hope we can remove that scary warning after that 😃
TL;DR: try re-uploading the file through the Crowdin UI instead of the CLI.
@Josh-Cena @slorber I was able to fix the issue with a script:
And then call this script after you run
yarn crowdin:sync
and before you call theyarn build
command. Resolved the issue.