mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
refactor: move translator-credits script to scripts/, document in RELEASE_OPS
Moves the Crowdin translator-credits generator from tools/translators/ to scripts/translators.sh to sit with the other flat shell scripts. Drops the standalone README (the script is self-documenting via --help) and folds the release-time usage into RELEASE_OPS.md next to the changelog step. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQWVdWLAwBUBX2gJ55y6b
This commit is contained in:
@@ -44,6 +44,19 @@ workflow.
|
||||
e.g. `v1.12.01.md`) and add it to `docs/changelog/README.md`. Follow the
|
||||
house style: plain text, short verb-first sentences.
|
||||
|
||||
For the `## Translations` section, generate the credits from Crowdin instead
|
||||
of writing them by hand:
|
||||
```bash
|
||||
export CROWDIN_PROJECT_ID=... CROWDIN_PERSONAL_TOKEN=...
|
||||
scripts/translators.sh --from <prev-tag> --to <this-tag>
|
||||
```
|
||||
It pulls a Crowdin *Top Members* report for the window between the two tags,
|
||||
joins each contributor against `docs/changelog/translators.json` (a
|
||||
Crowdin-username/id → npub map kept next to the changelogs), and prints the
|
||||
`## Translations` block grouped by language. Contributors with no npub yet are
|
||||
listed under `UNMAPPED` — credit them by hand, then add their npub to
|
||||
`translators.json` so the next release picks them up automatically.
|
||||
|
||||
3. **Publish the release-notes note on Nostr** with Amethyst's account and paste
|
||||
its event id into `amethyst/build.gradle.kts`:
|
||||
```kotlin
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# can credit them by hand and backfill translators.json.
|
||||
#
|
||||
# Usage:
|
||||
# tools/translators/translators.sh --from <date|tag> --to <date|tag>
|
||||
# scripts/translators.sh --from <date|tag> [--to <date|tag>]
|
||||
#
|
||||
# --from / --to A date (YYYY-MM-DD) or a git tag/ref. Tags are resolved to
|
||||
# their commit date. --to defaults to now if omitted.
|
||||
@@ -21,6 +21,13 @@
|
||||
# CROWDIN_PROJECT_ID Crowdin numeric project id.
|
||||
# CROWDIN_PERSONAL_TOKEN Crowdin personal access token (needs report scope).
|
||||
#
|
||||
# Crowdin contributors are joined against docs/changelog/translators.json, a
|
||||
# Crowdin-username/id -> npub mapping kept alongside the changelogs. Anyone
|
||||
# Crowdin reports who isn't in the mapping is printed under UNMAPPED so you can
|
||||
# credit them by hand and backfill the JSON. The contribution window for "between
|
||||
# two versions" is the commit date of the previous tag -> the commit date of the
|
||||
# new tag.
|
||||
#
|
||||
# Requires: bash, curl, jq, git.
|
||||
#
|
||||
# NOTE: This talks to the live Crowdin REST API (api.crowdin.com). The JSON field
|
||||
@@ -30,7 +37,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
API="https://api.crowdin.com/api/v2"
|
||||
MAPPING="$REPO_ROOT/docs/changelog/translators.json"
|
||||
FROM=""
|
||||
@@ -45,7 +52,7 @@ while [ $# -gt 0 ]; do
|
||||
--to) TO="${2:?--to needs a value}"; shift 2 ;;
|
||||
--mapping) MAPPING="${2:?--mapping needs a value}"; shift 2 ;;
|
||||
--raw) RAW=1; shift ;;
|
||||
-h|--help) sed -n '2,30p' "$0"; exit 0 ;;
|
||||
-h|--help) sed -n '2,36p' "$0"; exit 0 ;;
|
||||
*) die "unknown argument: $1" ;;
|
||||
esac
|
||||
done
|
||||
@@ -1,47 +0,0 @@
|
||||
# Translator credits for the changelog
|
||||
|
||||
Generates the `## Translations` block for a release by asking Crowdin **who
|
||||
translated between two releases** and joining them against the npub mapping kept
|
||||
in the changelog folder.
|
||||
|
||||
## Pieces
|
||||
|
||||
- **`docs/changelog/translators.json`** — the Crowdin-user → npub mapping (lives
|
||||
next to the changelogs). Keyed by Crowdin username (case-insensitive) or numeric
|
||||
user id. Add a row whenever a translator gives you their npub.
|
||||
- **`tools/translators/translators.sh`** — pulls a Crowdin *Top Members* report
|
||||
for a date window, joins it against the mapping, and prints the credit block
|
||||
grouped by language. Anyone Crowdin reports who isn't in the mapping is listed
|
||||
under `UNMAPPED` so you can credit them by hand and backfill the JSON.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
export CROWDIN_PROJECT_ID=... # same env vars crowdin.yml already uses
|
||||
export CROWDIN_PERSONAL_TOKEN=... # token needs the "reports" scope
|
||||
|
||||
# Between the previous tag and now:
|
||||
tools/translators/translators.sh --from v1.12.00
|
||||
|
||||
# Between two tags:
|
||||
tools/translators/translators.sh --from v1.11.00 --to v1.12.00
|
||||
|
||||
# Discover Crowdin usernames to add to translators.json:
|
||||
tools/translators/translators.sh --from v1.12.00 --raw
|
||||
```
|
||||
|
||||
`--from` / `--to` accept either a `YYYY-MM-DD` date or a git tag/ref (resolved to
|
||||
its commit date). `--to` defaults to now.
|
||||
|
||||
Requires `bash`, `curl`, `jq`, `git`.
|
||||
|
||||
## How the window maps to "between two versions"
|
||||
|
||||
A release is a git tag, so the contribution window is the commit date of the
|
||||
previous tag → the commit date of the new tag. The Crowdin Top Members report
|
||||
takes that `dateFrom`/`dateTo` and returns every member who translated/approved
|
||||
in it, per language.
|
||||
|
||||
> The script talks to the live `api.crowdin.com` REST API. The JSON field paths
|
||||
> for the downloaded report follow Crowdin's `top-members` schema; if Crowdin
|
||||
> changes it, adjust the `jq` block at the bottom of `translators.sh`.
|
||||
Reference in New Issue
Block a user