Auto-translate Documentation #147
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
| name: 'Auto-translate Documentation' | |
| on: | |
| schedule: | |
| # Run every Sunday at midnight UTC | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: # Allow manual triggers | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| translate: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: github.actor != 'github-actions[bot]' # Prevent infinite loops | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: staging | |
| token: ${{ secrets.GH_PAT }} | |
| fetch-depth: 0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.3 | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.bun/install/cache | |
| node_modules | |
| **/node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Run Lingo.dev translations | |
| env: | |
| LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }} | |
| run: | | |
| cd apps/docs | |
| bunx lingo.dev@latest i18n | |
| - name: Check for translation changes | |
| id: changes | |
| run: | | |
| cd apps/docs | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| if [ -n "$(git status --porcelain content/docs)" ]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request with translations | |
| if: steps.changes.outputs.changes == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GH_PAT }} | |
| commit-message: "feat(i18n): update translations" | |
| title: "feat(i18n): update translations" | |
| body: | | |
| ## Summary | |
| Automated weekly translation updates for documentation. | |
| This PR was automatically created by the scheduled weekly i18n workflow, updating translations for all supported languages using Lingo.dev AI translation engine. | |
| **Triggered**: Weekly scheduled run | |
| **Workflow**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| ## Type of Change | |
| - [ ] Bug fix | |
| - [ ] New feature | |
| - [ ] Breaking change | |
| - [x] Documentation | |
| - [ ] Other: ___________ | |
| ## Testing | |
| This PR includes automated translations for modified English documentation content: | |
| - 🇪🇸 Spanish (es) translations | |
| - 🇫🇷 French (fr) translations | |
| - 🇨🇳 Chinese (zh) translations | |
| - 🇯🇵 Japanese (ja) translations | |
| - 🇩🇪 German (de) translations | |
| **What reviewers should focus on:** | |
| - Verify translated content accuracy and context | |
| - Check that all links and references work correctly in translated versions | |
| - Ensure formatting, code blocks, and structure are preserved | |
| - Validate that technical terms are appropriately translated | |
| ## Checklist | |
| - [x] Code follows project style guidelines (automated translation) | |
| - [x] Self-reviewed my changes (automated process) | |
| - [ ] Tests added/updated and passing | |
| - [x] No new warnings introduced | |
| - [x] I confirm that I have read and agree to the terms outlined in the [Contributor License Agreement (CLA)](./CONTRIBUTING.md#contributor-license-agreement-cla) | |
| ## Screenshots/Videos | |
| <!-- Translation changes are text-based - no visual changes expected --> | |
| <!-- Reviewers should check the documentation site renders correctly for all languages --> | |
| branch: auto-translate/weekly-${{ github.run_id }} | |
| base: staging | |
| labels: | | |
| i18n | |
| verify-translations: | |
| needs: translate | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: always() # Run even if translation fails | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: staging | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.3 | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.bun/install/cache | |
| node_modules | |
| **/node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Install dependencies | |
| run: | | |
| cd apps/docs | |
| bun install --frozen-lockfile | |
| - name: Build documentation to verify translations | |
| env: | |
| DATABASE_URL: postgresql://dummy:dummy@localhost:5432/dummy | |
| run: | | |
| cd apps/docs | |
| bun run build | |
| - name: Report translation status | |
| run: | | |
| cd apps/docs | |
| echo "## Translation Status Report" >> $GITHUB_STEP_SUMMARY | |
| echo "**Weekly scheduled translation run**" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| en_count=$(find content/docs/en -name "*.mdx" | wc -l) | |
| es_count=$(find content/docs/es -name "*.mdx" 2>/dev/null | wc -l || echo 0) | |
| fr_count=$(find content/docs/fr -name "*.mdx" 2>/dev/null | wc -l || echo 0) | |
| zh_count=$(find content/docs/zh -name "*.mdx" 2>/dev/null | wc -l || echo 0) | |
| ja_count=$(find content/docs/ja -name "*.mdx" 2>/dev/null | wc -l || echo 0) | |
| de_count=$(find content/docs/de -name "*.mdx" 2>/dev/null | wc -l || echo 0) | |
| es_percentage=$((es_count * 100 / en_count)) | |
| fr_percentage=$((fr_count * 100 / en_count)) | |
| zh_percentage=$((zh_count * 100 / en_count)) | |
| ja_percentage=$((ja_count * 100 / en_count)) | |
| de_percentage=$((de_count * 100 / en_count)) | |
| echo "### Coverage Statistics" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇬🇧 English**: $en_count files (source)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇪🇸 Spanish**: $es_count/$en_count files ($es_percentage%)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇫🇷 French**: $fr_count/$en_count files ($fr_percentage%)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇨🇳 Chinese**: $zh_count/$en_count files ($zh_percentage%)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇯🇵 Japanese**: $ja_count/$en_count files ($ja_percentage%)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **🇩🇪 German**: $de_count/$en_count files ($de_percentage%)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "🔄 **Auto-translation PR**: Check for new pull request with updated translations" >> $GITHUB_STEP_SUMMARY |