An open source design system that's fully customizable and agent ready
TypeScript
ci(i18n): add Crowdin upload/download workflows (#4148)
nynexman4464cecb7739ac1c
diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.ymlnew file mode 100644index 0000000000..2950beb641--- /dev/null+++ b/.github/workflows/crowdin-download.yml@@ -0,0 +1,76 @@+# Copyright (c) Meta Platforms, Inc. and affiliates.++# Crowdin download — pull translated locale files from Crowdin and open a PR+# against main.+#+# TRIGGER: workflow_dispatch ONLY for now, so a maintainer can smoke-test the+# full flow (download → prettier → PR) before we automate it. A follow-up PR+# will add a cron schedule once we're confident the PR that comes out looks+# right end-to-end.+#+# Why not use Crowdin's built-in PR creation? Its PR flow is limited (title/+# body/labels), so we let the Crowdin action land translations on a staging+# branch (`l10n/crowdin`) and use peter-evans/create-pull-request to open the+# actual PR with the metadata we want. Downloaded JSON is run through prettier+# so the diff matches the repo's formatting.+name: Crowdin Download++on:+ workflow_dispatch:++permissions: {}++concurrency:+ group: crowdin-download+ cancel-in-progress: false++jobs:+ download:+ runs-on: ubuntu-latest+ permissions:+ contents: write+ pull-requests: write+ steps:+ - uses: actions/checkout@v7++ - uses: ./.github/actions/setup++ # crowdin/[email protected] — pinned by SHA per repo policy.+ # download_translations writes files into the working tree; we do NOT let+ # the action push or open its own PR — peter-evans handles that below so+ # we control title/body/labels.+ - name: Download translations from Crowdin+ uses: crowdin/github-action@e0c8f73cdc0fafde9396e056c5038217000a32d1+ with:+ upload_sources: false+ upload_translations: false+ download_translations: true+ push_translations: false+ create_pull_request: false+ localization_branch_name: l10n/crowdin+ env:+ CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}+ CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}++ - name: Normalize locale JSON with prettier+ run: pnpm exec prettier --write "packages/core/locales/*.json"++ # peter-evans/[email protected] — pinned by SHA per repo policy.+ - name: Open translations PR+ uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676+ with:+ branch: l10n/crowdin+ base: main+ title: 'chore(i18n): translations update from Crowdin'+ commit-message: 'chore(i18n): translations update from Crowdin'+ author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'+ committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'+ labels: i18n+ body: |+ Automated translations pulled from Crowdin.++ Source: https://crowdin.com/project/astryx++ Locale JSON has been normalized with `prettier`. Review the diff+ for any strings that shifted meaning or formatting, then merge+ when ready.diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.ymlnew file mode 100644index 0000000000..44915564d1--- /dev/null+++ b/.github/workflows/crowdin-upload.yml@@ -0,0 +1,43 @@+# Copyright (c) Meta Platforms, Inc. and affiliates.++# Crowdin upload — push the canonical English source strings to Crowdin whenever+# packages/core/locales/en.json changes on main. Translators pick up new strings+# from Crowdin; translations flow back via crowdin-download.yml.+#+# Uses the Crowdin CLI action (mastodon-style) rather than the Crowdin GitHub+# App, so the whole integration lives in this repo as reviewable YAML.+name: Crowdin Upload++on:+ push:+ branches: [main]+ paths:+ - 'packages/core/locales/en.json'+ workflow_dispatch:++permissions: {}++concurrency:+ group: crowdin-upload+ cancel-in-progress: false++jobs:+ upload:+ runs-on: ubuntu-latest+ permissions:+ contents: read+ steps:+ - uses: actions/checkout@v7++ # crowdin/[email protected] — pinned by SHA per repo policy.+ - name: Upload sources to Crowdin+ uses: crowdin/github-action@e0c8f73cdc0fafde9396e056c5038217000a32d1+ with:+ upload_sources: true+ upload_translations: false+ download_translations: false+ push_translations: false+ create_pull_request: false+ env:+ CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}+ CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 76a9ce18ad..b0fc9d6244 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -512,6 +512,13 @@ and doesn't need network to use.- Hard refresh browser: Cmd+Shift+R (Mac) or Ctrl+Shift+R (Windows)- Clear Storybook cache: Remove `apps/storybook/node_modules/.cache`+## Translations++Astryx accepts community translations via Crowdin. To help translate astryx+into your language, visit <https://crowdin.com/project/astryx>. New locales are+picked up automatically after a maintainer reviews the auto-generated+translations PR.+## Contributor License Agreement ("CLA")In order to accept your pull request, we need you to submit a CLA. You only needdiff --git a/crowdin.yml b/crowdin.ymlnew file mode 100644index 0000000000..0ef8ca254e--- /dev/null+++ b/crowdin.yml@@ -0,0 +1,27 @@+# Copyright (c) Meta Platforms, Inc. and affiliates.++# Crowdin CLI config for the astryx design system.+#+# Sources: packages/core/locales/en.json (react-intl / FormatJS shape:+# { "<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.+#+# Env vars come from the GitHub workflows that run the Crowdin CLI:+# CROWDIN_PROJECT_ID — repo variable (public)+# CROWDIN_PERSONAL_TOKEN — repo secret++project_id_env: CROWDIN_PROJECT_ID+api_token_env: CROWDIN_PERSONAL_TOKEN++preserve_hierarchy: true+skip_untranslated_files: true+commit_message: '[ci skip]'++files:+ - source: /packages/core/locales/en.json+ translation: /packages/core/locales/%locale%.json+ type: react_intl