An open source design system that's fully customizable and agent ready
TypeScript
ci(i18n): fix Crowdin download — move skip flags per-file, chown before prettier (#4208)
nynexman44640f9376ab44d2
diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.ymlindex 2950beb641..fefef63f73 100644--- a/.github/workflows/crowdin-download.yml+++ b/.github/workflows/crowdin-download.yml@@ -52,8 +52,27 @@ jobs:CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}+ # crowdin/github-action runs inside a Docker container as root, so any+ # files it writes into the working tree are owned by root. Later steps+ # run as the `runner` user and can't overwrite those files (EACCES).+ # Reclaim ownership of anything in the locales dir before subsequent+ # steps touch it.+ - name: Reclaim ownership of downloaded files+ run: sudo chown -R "$(id -u):$(id -g)" packages/core/locales++ # If Crowdin's build produced any locale JSON, normalize it with prettier+ # so the diff matches the repo's formatting conventions. `--ignore-unknown`+ # + a shell guard makes the step a no-op when no locale files exist yet+ # (which is the expected state until translators start contributing).- name: Normalize locale JSON with prettier- run: pnpm exec prettier --write "packages/core/locales/*.json"+ run: |+ shopt -s nullglob+ files=(packages/core/locales/*.json)+ if [ "${#files[@]}" -gt 0 ]; then+ pnpm exec prettier --write "${files[@]}"+ else+ echo "No locale files present; nothing to normalize."+ fi# peter-evans/[email protected] — pinned by SHA per repo policy.- name: Open translations PRdiff --git a/crowdin.yml b/crowdin.ymlindex 0ef8ca254e..21bdb08548 100644--- a/crowdin.yml+++ b/crowdin.yml@@ -6,22 +6,30 @@# { "<key>": { "defaultMessage": "...", "description": "..." } })# Targets: packages/core/locales/<lang>.json, one file per translated language.#-# `skip_untranslated_files: true` keeps per-locale files out of git until a-# language has real translated content — no empty stub JSON files landing in-# the repo just because Crowdin added a target language.+# The skip flags are declared PER-FILE (inside the files: block, not at the+# root) so Crowdin's react_intl builder respects them:+# - skip_untranslated_files: don't emit a target file at all if 0% translated.+# - skip_untranslated_strings: strip untranslated keys from within a file+# rather than emitting them with empty string values (which then pollute+# the diff with meaningless "": "" pairs).+# Root-level `skip_untranslated_files` is a common misconfiguration and does+# NOT flow through to the react_intl file builder — verified empirically:+# without the per-file placement, `crowdin download` writes an empty JSON file+# for every configured target language even at 0% translation.## Env vars come from the GitHub workflows that run the Crowdin CLI:-# CROWDIN_PROJECT_ID — repo variable (public)+# CROWDIN_PROJECT_ID — repo variable (public)# CROWDIN_PERSONAL_TOKEN — repo secretproject_id_env: CROWDIN_PROJECT_IDapi_token_env: CROWDIN_PERSONAL_TOKENpreserve_hierarchy: true-skip_untranslated_files: truecommit_message: '[ci skip]'files:- source: /packages/core/locales/en.jsontranslation: /packages/core/locales/%locale%.jsontype: react_intl+ skip_untranslated_files: true+ skip_untranslated_strings: true