Skip to content

Commit 804aa4b

Browse files
committed
chore(translate): restore sync-translations script
1 parent eab3d52 commit 804aa4b

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

scripts/sync-translations.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Print candidate cndocs files that likely need translation sync
5+
# Strategy:
6+
# 1) Compare upstream/main vs local production for docs/*.md
7+
# 2) Map changed docs/<name>.md -> cndocs/<name>.md when target exists
8+
# 3) Output unique, sorted cndocs paths (one per line)
9+
10+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
11+
cd "$REPO_ROOT"
12+
13+
# Ensure upstream exists
14+
if ! git remote get-url upstream >/dev/null 2>&1; then
15+
echo "ERROR: missing upstream remote" >&2
16+
exit 2
17+
fi
18+
19+
git fetch upstream --quiet
20+
21+
# Changed docs files between production and upstream/main
22+
changed_docs=$(git diff --name-only production..upstream/main -- 'docs/*.md' || true)
23+
24+
if [ -z "${changed_docs}" ]; then
25+
exit 0
26+
fi
27+
28+
while IFS= read -r f; do
29+
[ -z "$f" ] && continue
30+
name="${f#docs/}"
31+
target="cndocs/${name}"
32+
if [ -f "$target" ]; then
33+
echo "$target"
34+
fi
35+
done <<< "$changed_docs" | sort -u

0 commit comments

Comments
 (0)