2026-11-06-crowdin-translation-step-3-crowdin-ci
Crowdin translation, step 3 (Crowdin connection): implementation plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Keep the translated interface text (menus, labels, footer) in Crowdin, so that Vianova local teams can correct it in the Crowdin web page, and bring each correction back to the repo through one merge request. The translated pages are corrected in git (ruling 6).
Architecture (changed 2026-11-09, user's option 1): Crowdin's own GitLab connection does the sync, the same as in vianova-frontend-v2. Crowdin reads crowdin.yml from v1.0(knowledge-base), takes the English sources after each change, and opens or updates one merge request from its service branch l10n_v1.0 with the translations. The repo keeps 2 guards: a one-writer check that fails every other merge request that changes a translated interface file (JSON), and a download guard that fails the Crowdin merge request when a translated file becomes empty or goes back to English. The first import is the connection's one-time "import existing translations", as not approved.
Tech Stack: Crowdin GitLab integration (crowdin.com, project "Vianova Knowledge Base", id 945497), Docusaurus 3.9.2, Node 20 with node:test, js-yaml, GitLab CI.
Spec: docs/superpowers/specs/2026-11-04-crowdin-translation-design.md, section 8, step 3. Sections 6.2, 6.3 and 6.6.5 apply, with the rulings below.
Global Constraints
- Crowdin target languages: German, Arabic, Norwegian, French, Italian. Repo folders:
i18n/de,i18n/ar,i18n/no,i18n/fr,i18n/it. crowdin.yml(repo root) sends only an explicit list of the 7 JSON files ofdocusaurus-site/i18n/en/. No Markdown page (ruling 6).- Export: all translations, approved or not. "Export only approved" is off (spec 6.2.6).
- First import: translations are not approved (spec 6.2.3). The native reader approves them in step 4.
- No Crowdin token and no GitLab token in this repo or in CI variables. The connection uses the GitLab login of the Crowdin admin (OAuth).
- Crowdin project settings and GitLab project settings are shared state. A change that the user did not ask for in chat goes through an
agent-gatedscript, or a numbered choice in the chat for browser steps. - Never force-push
v1.0(knowledge-base)(the ReadMe Git sync pushes the old commits back). - Conventional commits, each with the trailer
Co-Authored-By: Claude Opus 5.5 <[email protected]>. - Never search the whole disk. Search only the repo.
Rulings (decisions that differ from the spec)
- Crowdin's own GitLab connection, not the Crowdin CLI in CI (user's option 1, 2026-11-09). Spec 6.2 runs the CLI in CI with a token. The frontend team already uses the GitLab connection, and it needs no token and no CI job. Cost if wrong: the sync depends on the GitLab account of the Crowdin admin; option 3 (a project token in the connection) can replace it later with no repo change.
crowdin.ymlat the repo root, with full paths. The GitLab connection reads paths from the repo root, the same ascrowdin-vip.ymlin the frontend. The olddocusaurus-site/crowdin.yml(step 1) is removed.- The recipe and changelog menu labels go to Crowdin. The plan said "every JSON file of
i18n/en/" and also "no source containsrecipesorblog". The two JSON files are interface text, step 2 translated them, and the check script checks them. The "no recipes, no blog" rule applies to Markdown only. - The one-writer check knows Crowdin by its branch, not by a bot login. The connection commits with the admin's GitLab account, so a login check cannot tell a Crowdin commit from a person. The check accepts translated files only from the source branch
l10n_v1.0. Cost if wrong: a person can push tol10n_v1.0by hand; the review of that merge request is the guard. - No
with-secret, nocrowdin-local.sh. The first import uses the connection's "import existing translations", so no local CLI run is necessary. - Only the interface text goes to Crowdin; the pages stay in git (user's option 1, 2026-11-09). The Crowdin plan has a limit of 100,000 source words, counted as source words × target languages (Cityscope 8,265 × 7 + VIP 4,506 × 4 = 75,879 in use). The 109 pages are about 49,000 words, so about 245,000 counted words: they do not fit. The 7 JSON files are 1,246 words, about 6,200 counted. A native reader corrects a page through a merge request (Claude Code or the GitLab editor). The one-writer check guards only the JSON files. Cost if wrong: local teams need git for page corrections; a bigger Crowdin plan can add the pages later with a change of
crowdin.ymlonly. - A person starts the checks on each Crowdin merge request (user's option 1, 2026-11-09). Each Crowdin commit has the title "New translations
( )" and a CI-skip keyword. A commit_messagekey incrowdin.ymldoes not replace them: Crowdin only adds it under them (tested on !37). Socommitlintdoes not run onl10n_v1.0merge requests, and before each Crowdin merge a person pushes the empty commitci(i18n): run the checks on the Crowdin texttol10n_v1.0. The pipeline then runs every check, and the merge card needs it green. Cost if wrong: one extra commit for each Crowdin merge; if Crowdin later drops the keyword, the empty commit is no longer needed. - The removal test uses a temporary key (user's option 1, 2026-11-09). Task 7 Step 3 removed and added back an existing key; that loses its 5 translations. A new English key
crowdin.test.temporaryTextwas added (!43), Crowdin added it to the 5 files (!44), the English key was removed (!45), and Crowdin removed it from the 5 files (!46). Each file is then byte for byte the same as before the test. Cost if wrong: none for the removal path; the add-back of a translated key is not tested.
Open fields
| Field | Value | Needed by |
|---|---|---|
| Crowdin admin | The user (Frederic Robinet), 2026-11-09 | Task 5 |
| Crowdin project id | 945497, "Vianova Knowledge Base", private, created 2026-11-09 | Task 5 |
| Space in the Crowdin plan | 24,121 free of 100,000 (2026-11-09). The interface text needs about 6,200. | Task 5 |
| Sync interval of the connection | open, default: the connection's default | Task 5 |
| The 5 native readers | open | Step 4 (not this plan) |
Order with step 2
Step 2 is complete: all 5 languages are merged and live on staging. Task 5 connects Crowdin only after the merge request of Tasks 1 to 4 is merged, because the connection reads crowdin.yml from v1.0.
Review Focus
- Crowdin exports an empty file, or a file with English text, for a page that the repo has in German. Expected: the download guard fails the Crowdin merge request. Test in Task 3 (
guardDownload). - The Norwegian folder: Crowdin can export as
nborno. Expected: the files land ini18n/no/. Test in Task 1 (the language mapping) and proof in Task 6 (the first Crowdin merge request). - An English interface key is removed. Expected: Crowdin removes it from the source, and the next Crowdin merge request removes it from each language. Checked in Task 7.
- An editor fixes a German typo directly in git after the import. Expected: the one-writer check fails the merge request, with a message that names Crowdin as the place to fix it. Test in Task 2.
- The JSON export of Crowdin changes the key order or the
descriptionfields. Expected: the first Crowdin merge request after the import has no content change. Checked in Task 6, Step 3.
File map
| File | Responsibility |
|---|---|
crowdin.yml | Which files go to Crowdin, and where the translations come back |
docusaurus-site/scripts/i18n/one-writer.mjs | Fails a merge request that changes translated interface JSON, unless it comes from l10n_v1.0 |
docusaurus-site/scripts/i18n/guard-download.mjs | Fails the Crowdin merge request when a translated file becomes empty or goes back to English |
docusaurus-site/scripts/i18n/*.test.mjs | Tests of the above |
.gitlab-ci.yml | Jobs one-writer, guard-download |
docusaurus-site/scripts/i18n/TRANSLATING.md, CONTRIBUTING.md, docusaurus-site/CLAUDE.md | Update flow for editors and the agent |
Task 1: crowdin.yml
crowdin.ymlFiles: Create crowdin.yml (repo root) and docusaurus-site/scripts/i18n/crowdin-config.test.mjs. Delete docusaurus-site/crowdin.yml.
- Step 1: Write the failing tests:
only one crowdin.yml, at the repo root;sends only docs and English JSON(the test lists the JSON files withreaddir);mdx uses the mdx_v2 parser;docs land in the folder that the build reads;norwegian folder is no on every entry;no recipe, changelog or page markdown;no token or project id in the file. - Step 2: Run
npm run i18n:test. Expected: the new tests fail (no root file). - Step 3: Write
crowdin.yml. Quote"no": a YAML 1.1 reader reads a barenoas false. - Step 4: Run
npm run i18n:test. Expected: all pass (59 of 59 on 2026-11-09; 71 of 71 after Task 3). - Step 5: Commit
feat(i18n): send only the docs and the interface text to Crowdin.
Task 2: One-writer check
Files: Create docusaurus-site/scripts/i18n/one-writer.mjs, docusaurus-site/scripts/i18n/one-writer.test.mjs. Modify .gitlab-ci.yml, docusaurus-site/scripts/i18n/ci-config.test.mjs.
Interfaces:
-
oneWriter(changedFiles: string[], sourceBranch: string): {ok: boolean, files: string[]}. A file is a translated interface file when it matchesdocusaurus-site/i18n/(de|ar|no|fr|it)/.+\.json(ruling 6: the pages are corrected in git).okis true when no translated file changed, or whensourceBranch === 'l10n_v1.0'. -
CLI: reads
git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA...HEADandCI_MERGE_REQUEST_SOURCE_BRANCH_NAME. On failure it prints:Translated interface text changes only through Crowdin. Fix the text in Crowdin. Files: <list>, exit 1. -
CI job
one-writer(stagelint, merge requests only,variables: GIT_DEPTH: 0). It runs only when the CI variableCROWDIN_ONE_WRITER == "on". Task 6 sets this variable after the first import. -
Step 1: Write the failing tests: English file only → ok. German page from branch
fix/typo→ not ok,fileshas the page. German page froml10n_v1.0→ ok.i18n/en/code.jsonfrom any branch → ok. Inci-config.test.mjs:one-writer runs only when CROWDIN_ONE_WRITER is on. -
Step 2: Run
npm run i18n:test. Expected: the new tests fail. -
Step 3: Implement the function, the CLI and the CI job.
-
Step 4: Run
npm run i18n:testandglab ci lint .gitlab-ci.yml. Expected: all pass, and the lint is valid. -
Step 5: Commit
feat(i18n): translated files change only through Crowdin.
Task 3: Download guard
Files: Create docusaurus-site/scripts/i18n/guard-download.mjs, docusaurus-site/scripts/i18n/guard-download.test.mjs. Modify .gitlab-ci.yml, docusaurus-site/scripts/i18n/ci-config.test.mjs.
Interfaces:
-
guardDownload(siteDir: string, changed: Array<{locale: string, file: string, before: string | null, after: string}>): Problem[]. Rules:empty(the body ofafterhas no text),english(afterequals the English page andbeforedid not). A new file (before === null) that equals English is a problem too. -
CLI:
node scripts/i18n/guard-download.mjs, run fromdocusaurus-site/. It readsgit diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD -- i18n/(noti18n/en/). For each file,beforeisgit show $CI_MERGE_REQUEST_DIFF_BASE_SHA:<path>(nullwhen the file is new) andafteris the file on disk. It prints one line per problem and exits 1 when any problem exists. -
CI job
guard-download(stagelint, only for merge requests whose source branch isl10n_v1.0,variables: GIT_DEPTH: 0). -
Step 1: Write the failing tests: a German page that becomes empty →
empty. A German page that becomes the English text →english. A German page with a new German sentence →[]. Inci-config.test.mjs:guard-download runs only on the Crowdin branch. -
Step 2: Run
npm run i18n:test. Expected: the new tests fail. -
Step 3: Implement the script and the CI job.
-
Step 4: Run
npm run i18n:testandglab ci lint .gitlab-ci.yml. Expected: all pass. -
Step 5: Commit
feat(i18n): check each Crowdin merge request for empty or English pages.
Task 4: Merge request of Tasks 1 to 3
- Step 1: Push the branch,
glab mr createintov1.0,/mr-describe,/review-board, normal merge path. The new jobs do nothing until Task 5 and Task 6. - Step 2: After the merge, check that the v1.0 pipeline is green and that
crowdin.ymlis onv1.0.
Task 5: Connect Crowdin to GitLab (browser, user's consent)
Each step is a browser step in the Crowdin project 945497. The agent fills the forms. The user consents in the chat before each step that grants access or changes a shared setting.
- Step 1: Check the plan space (about 49,000 more source words) on the Crowdin billing page.
- Step 2: In the project settings, set "Export only approved" to off and "Skip untranslated strings" to off. Turn on the proofread step (spec 6.7.2).
- Step 3: Enable the GitLab app for the project, and connect
vianova/knowledge-basewith the admin's GitLab login (OAuth: user's consent first). - Step 4: Select branch
v1.0, configuration filecrowdin.yml, service branchl10n_v1.0, and turn on "import existing translations" for the first sync only.
Task 6: First import
- Step 1: Start the first sync. In Crowdin, check: 7 JSON files, and for each language 100% translated and 0% approved.
- Step 2: In the Crowdin project settings, turn off "import existing translations".
- Step 3: Run "Sync Now". Expected: no merge request, or a merge request from
l10n_v1.0with no content change (only whitespace). A content change is a stop: find the cause before Step 4. Check that Norwegian files are ini18n/no/. - Step 4: Gated: set the CI variable
CROWDIN_ONE_WRITER=on(agent-gated script, user's1).
Task 7: Round trip and runbook
- Step 1: The Crowdin admin changes one German menu label in the Crowdin editor.
- Step 2: Run "Sync Now". Expected: one merge request from
l10n_v1.0with only that label changed, and green jobscheck-translations,guard-downloadandone-writer. - Step 3: Remove one English interface key on a branch, merge it, and check that the next Crowdin merge request removes it from each language. Then add it back.
- Step 4: Write the update flow with
/doc-page:TRANSLATING.md(agent), a short editor section inCONTRIBUTING.md(labels in Crowdin, pages through a merge request), and the locale section ofdocusaurus-site/CLAUDE.md(it still says 4 locales).
Done condition (spec section 8, step 3)
The first import puts the 7 JSON files in Crowdin with the right target paths, i18n/no/ for Norwegian. An edit in Crowdin comes back in a merge request from l10n_v1.0. No translated file goes back to English or becomes empty.
Not in this plan
- The native review and the approval in Crowdin (step 4). It needs the 5 reader names.
- The go-live rules of step 5. All 5 languages are already live on staging since !21(knowledge-base).
- The "Sync Issues" state of the frontend VIP connection (last sync 2026-08-26). It is outside this focus.
Updated 18 days ago
