-
Notifications
You must be signed in to change notification settings - Fork 95
Translation infrastructure: style guides, glossary audit, and robustness improvements #12401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f5118e8
Add per-language style guide files for translation rules
atom-evens 86a9685
Increase max output tokens to 65536 and add truncation detection
atom-evens a2da33b
Add file-size safeguard to skip oversized files with clear reporting
atom-evens 9df3398
Switch to streaming API for Claude calls
atom-evens b10e239
Temporarily disable orphan cleanup during testing
atom-evens 4d7e584
Add glossary audit script, workflow, and sync glossaries with platfor…
atom-evens 1ccf681
Add ~1,030 missing high-value terms to glossaries from platform UI
atom-evens c23f892
Add deterministic QC validator to auto-translation workflow
atom-evens d4189af
Address Copilot review feedback: fix hidden whitespace in glossaries
atom-evens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # Weekly audit of translation glossaries against source-of-truth localization | ||
| # files in the platform and SDK repos. | ||
| # | ||
| # Compares scripts/glossaries/*.json against the actual UI translations in | ||
| # the Braze platform dashboard, Android SDK, Swift SDK, and GrapesJS editor | ||
| # to surface terminology drift. | ||
| # | ||
| # Creates a GitHub Issue when mismatches or missing terms are detected. | ||
| name: Audit glossaries | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 6 * * 0' # Every Sunday at 06:00 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| jobs: | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout braze-docs | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Clone reference repos | ||
| env: | ||
| GH_TOKEN: ${{ secrets.REFERENCE_REPO_TOKEN }} | ||
| run: | | ||
| # Clone repos needed for localization comparison. | ||
| # Public repos use HTTPS; private repos use the PAT. | ||
| clone_repo() { | ||
| local org=$1 repo=$2 | ||
| echo "Cloning $org/$repo..." | ||
| git clone --depth 1 --filter=blob:none --sparse \ | ||
| "https://x-access-token:${GH_TOKEN}@github.com/${org}/${repo}.git" \ | ||
| "../${repo}" 2>/dev/null || \ | ||
| git clone --depth 1 \ | ||
| "https://github.com/${org}/${repo}.git" \ | ||
| "../${repo}" 2>/dev/null || \ | ||
| echo " WARNING: Could not clone ${org}/${repo} — skipping" | ||
| } | ||
|
|
||
| clone_repo Appboy platform | ||
| clone_repo braze-inc braze-android-sdk | ||
| clone_repo braze-inc braze-swift-sdk | ||
| clone_repo braze-inc grapesjs | ||
|
|
||
| # Sparse-checkout only the locale directories we need | ||
| for repo in platform braze-android-sdk braze-swift-sdk grapesjs; do | ||
| if [ -d "../${repo}" ]; then | ||
| cd "../${repo}" | ||
| git sparse-checkout init --cone 2>/dev/null || true | ||
| case $repo in | ||
| platform) | ||
| git sparse-checkout set dashboard/config/locales 2>/dev/null || true ;; | ||
| braze-android-sdk) | ||
| git sparse-checkout set android-sdk-ui/src/main/res 2>/dev/null || true ;; | ||
| braze-swift-sdk) | ||
| git sparse-checkout set Sources/BrazeUI/Resources/Localization 2>/dev/null || true ;; | ||
| grapesjs) | ||
| git sparse-checkout set src/i18n/locale 2>/dev/null || true ;; | ||
| esac | ||
| cd "$GITHUB_WORKSPACE" | ||
| fi | ||
| done | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Run glossary audit | ||
| id: audit | ||
| run: | | ||
| python scripts/audit_glossaries.py \ | ||
| --platform-repo ../platform \ | ||
| --android-repo ../braze-android-sdk \ | ||
| --swift-repo ../braze-swift-sdk \ | ||
| --grapesjs-repo ../grapesjs \ | ||
| --output glossary_audit_report.json || true | ||
|
|
||
| # Read stats for the issue | ||
| if [ -f glossary_audit_report.json ]; then | ||
| mismatches=$(python3 -c "import json; r=json.load(open('glossary_audit_report.json')); print(r['stats']['total_mismatches'])") | ||
| missing=$(python3 -c "import json; r=json.load(open('glossary_audit_report.json')); print(r['stats']['total_missing'])") | ||
| echo "mismatches=${mismatches}" >> "$GITHUB_OUTPUT" | ||
| echo "missing=${missing}" >> "$GITHUB_OUTPUT" | ||
| echo "has_findings=$([ $mismatches -gt 0 ] || [ $missing -gt 0 ] && echo true || echo false)" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "has_findings=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Create or update issue | ||
| if: steps.audit.outputs.has_findings == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| DATE=$(date +%Y-%m-%d) | ||
| TITLE="Glossary audit: ${{ steps.audit.outputs.mismatches }} mismatches, ${{ steps.audit.outputs.missing }} missing terms ($DATE)" | ||
|
|
||
| BODY=$(cat glossary_audit_report.md) | ||
|
|
||
| # Close any previous open audit issues | ||
| gh issue list --label "glossary-audit" --state open --json number -q '.[].number' | while read num; do | ||
| gh issue close "$num" --comment "Superseded by new audit run on $DATE." | ||
| done | ||
|
|
||
| gh issue create \ | ||
| --title "$TITLE" \ | ||
| --body "$BODY" \ | ||
| --label "glossary-audit" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.