docs: Add Italian translation template with examples #13
Workflow file for this run
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: Update Translations | |
| on: | |
| workflow_dispatch: # Manual trigger | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly on Sunday at midnight | |
| pull_request: # Run on every PR commit for testing | |
| paths: | |
| - 'src/**/*.cpp' | |
| - 'src/**/*.h' | |
| - 'src/**/*.qml' | |
| - 'src/**/*.ui' | |
| - 'src/**/*.ts' | |
| push: # Run on push to PR branches | |
| branches: | |
| - 'claude/**' # All Claude Code branches | |
| - 'translations/**' # Translation-specific branches | |
| jobs: | |
| update-translations: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Qt Linguist Tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y qtbase5-dev qttools5-dev-tools | |
| - name: Detect workflow context | |
| id: context | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "push" ]; then | |
| echo "mode=testing" >> $GITHUB_OUTPUT | |
| echo "🧪 Running in TESTING mode (PR/push to branch)" | |
| else | |
| echo "mode=production" >> $GITHUB_OUTPUT | |
| echo "🚀 Running in PRODUCTION mode (scheduled/manual)" | |
| fi | |
| - name: Update translation files | |
| run: | | |
| echo "Extracting translatable strings from source code..." | |
| lupdate src/qdomyos-zwift.pri -ts src/qdomyos-zwift.ts | |
| echo "" | |
| echo "Checking for changes..." | |
| # Check if there are changes | |
| if git diff --quiet src/qdomyos-zwift.ts; then | |
| echo "✅ No translation updates needed - file is up to date" | |
| echo "HAS_CHANGES=false" >> $GITHUB_ENV | |
| else | |
| echo "📝 Translation file has been updated with new/modified strings" | |
| echo "HAS_CHANGES=true" >> $GITHUB_ENV | |
| # Show diff stats | |
| echo "" | |
| echo "Changes summary:" | |
| git diff --stat src/qdomyos-zwift.ts | |
| fi | |
| - name: Commit and push changes (Testing Mode) | |
| if: env.HAS_CHANGES == 'true' && steps.context.outputs.mode == 'testing' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| # Commit to current branch (PR branch) | |
| git add src/qdomyos-zwift.ts | |
| git commit -m "chore: update translation strings [automated] | |
| Automatic update of translatable strings extracted from source code. | |
| - Updated by GitHub Actions (Testing Mode) | |
| - Triggered by: ${{ github.event_name }} | |
| - Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" | |
| # Push to remote | |
| git push origin HEAD | |
| echo "✅ Changes committed and pushed to current branch" | |
| - name: Commit and push changes (Production Mode) | |
| if: env.HAS_CHANGES == 'true' && steps.context.outputs.mode == 'production' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| # Create a new branch for production updates | |
| BRANCH_NAME="translations/auto-update-$(date +%Y%m%d-%H%M%S)" | |
| git checkout -b "$BRANCH_NAME" | |
| # Add and commit changes | |
| git add src/qdomyos-zwift.ts | |
| git commit -m "chore: update translation strings | |
| Automatic update of translatable strings extracted from source code. | |
| - Updated by GitHub Actions (Scheduled) | |
| - Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" | |
| # Push the branch | |
| git push origin "$BRANCH_NAME" | |
| # Store branch name for PR creation | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| echo "✅ Changes pushed to new branch: $BRANCH_NAME" | |
| - name: Create Pull Request (Production Mode Only) | |
| if: env.HAS_CHANGES == 'true' && steps.context.outputs.mode == 'production' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ env.BRANCH_NAME }} | |
| title: "🌍 Update translation strings" | |
| body: | | |
| ## Translation Update | |
| This PR updates the translation file with new strings extracted from the source code. | |
| ### Changes | |
| - Extracted new translatable strings using `lupdate` | |
| - Updated `src/qdomyos-zwift.ts` | |
| ### What to do next | |
| 1. Review the new strings in `src/qdomyos-zwift.ts` | |
| 2. Add translations for Italian (`<translation>` tags) | |
| 3. Merge this PR when translations are complete | |
| ### Translation Status | |
| - File: `src/qdomyos-zwift.ts` | |
| - Language: Italian (it_IT) | |
| **Note:** Strings marked as `<translation type="unfinished">` need translation. | |
| --- | |
| *Generated automatically by GitHub Actions* | |
| labels: | | |
| translations | |
| automation | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "" | |
| echo "============================================" | |
| echo "Translation Workflow Summary" | |
| echo "============================================" | |
| echo "Mode: ${{ steps.context.outputs.mode }}" | |
| echo "Event: ${{ github.event_name }}" | |
| echo "Has changes: ${{ env.HAS_CHANGES }}" | |
| echo "============================================" | |
| if [ "${{ env.HAS_CHANGES }}" = "true" ]; then | |
| if [ "${{ steps.context.outputs.mode }}" = "testing" ]; then | |
| echo "✅ Translation file updated in current branch" | |
| echo " Review changes in: src/qdomyos-zwift.ts" | |
| else | |
| echo "✅ Translation file updated and PR created" | |
| echo " Branch: ${{ env.BRANCH_NAME }}" | |
| fi | |
| else | |
| echo "ℹ️ No updates needed - translation file is current" | |
| fi |