|
| 1 | +name: Translation Validation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, main ] |
| 6 | + paths: |
| 7 | + - 'index*.html' |
| 8 | + - 'scripts/validate-translations.js' |
| 9 | + - '.github/workflows/translation-validation.yml' |
| 10 | + - 'TRANSLATION_GUIDE.md' |
| 11 | + pull_request: |
| 12 | + branches: [ master, main ] |
| 13 | + paths: |
| 14 | + - 'index*.html' |
| 15 | + - 'scripts/validate-translations.js' |
| 16 | + - '.github/workflows/translation-validation.yml' |
| 17 | + - 'TRANSLATION_GUIDE.md' |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + validate-translations: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Harden Runner |
| 28 | + uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 |
| 29 | + with: |
| 30 | + egress-policy: audit |
| 31 | + |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 34 | + |
| 35 | + - name: Setup Node.js |
| 36 | + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 |
| 37 | + with: |
| 38 | + node-version: '24' |
| 39 | + |
| 40 | + - name: Validate all translation files |
| 41 | + id: validate |
| 42 | + run: | |
| 43 | + echo "🌐 Validating translations for all 14 languages..." |
| 44 | + echo "" |
| 45 | + npm run validate-translations |
| 46 | + |
| 47 | + - name: Count language files |
| 48 | + id: count |
| 49 | + run: | |
| 50 | + echo "" |
| 51 | + echo "📊 Language file statistics:" |
| 52 | + echo "" |
| 53 | + echo "Total language files: $(ls -1 index*.html | wc -l)" |
| 54 | + echo "" |
| 55 | + for file in index*.html; do |
| 56 | + size=$(wc -c < "$file" | numfmt --to=iec) |
| 57 | + lines=$(wc -l < "$file") |
| 58 | + echo " $file: $size ($lines lines)" |
| 59 | + done |
| 60 | +
|
| 61 | + - name: Verify RTL languages |
| 62 | + id: rtl |
| 63 | + run: | |
| 64 | + echo "" |
| 65 | + echo "🔄 Verifying RTL (Right-to-Left) language support:" |
| 66 | + echo "" |
| 67 | + |
| 68 | + # Check Arabic |
| 69 | + if grep -q 'lang="ar" dir="rtl"' index_ar.html; then |
| 70 | + echo "✅ Arabic (ar): RTL support confirmed" |
| 71 | + else |
| 72 | + echo "❌ Arabic (ar): RTL support MISSING" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + |
| 76 | + # Check Hebrew |
| 77 | + if grep -q 'lang="he" dir="rtl"' index_he.html; then |
| 78 | + echo "✅ Hebrew (he): RTL support confirmed" |
| 79 | + else |
| 80 | + echo "❌ Hebrew (he): RTL support MISSING" |
| 81 | + exit 1 |
| 82 | + fi |
| 83 | +
|
| 84 | + - name: Verify hreflang tags |
| 85 | + id: hreflang |
| 86 | + run: | |
| 87 | + echo "" |
| 88 | + echo "🔗 Verifying hreflang tags for SEO:" |
| 89 | + echo "" |
| 90 | + |
| 91 | + for file in index*.html; do |
| 92 | + count=$(grep -c 'hreflang=' "$file" || echo 0) |
| 93 | + if [ "$count" -ge 14 ]; then |
| 94 | + echo "✅ $file: $count hreflang tags (sufficient)" |
| 95 | + else |
| 96 | + echo "⚠️ $file: $count hreflang tags (should be 14+)" |
| 97 | + fi |
| 98 | + done |
| 99 | +
|
| 100 | + - name: Translation validation summary |
| 101 | + if: always() |
| 102 | + run: | |
| 103 | + echo "" |
| 104 | + echo "==========================================" |
| 105 | + echo " Translation Validation Summary" |
| 106 | + echo "==========================================" |
| 107 | + echo "" |
| 108 | + |
| 109 | + # Check outcomes of previous steps |
| 110 | + if [ "${{ steps.validate.outcome }}" = "success" ]; then |
| 111 | + echo "✅ Translation validation: PASSED" |
| 112 | + else |
| 113 | + echo "❌ Translation validation: FAILED" |
| 114 | + fi |
| 115 | + |
| 116 | + if [ "${{ steps.count.outcome }}" = "success" ]; then |
| 117 | + echo "✅ Language file count: PASSED" |
| 118 | + else |
| 119 | + echo "❌ Language file count: FAILED" |
| 120 | + fi |
| 121 | + |
| 122 | + if [ "${{ steps.rtl.outcome }}" = "success" ]; then |
| 123 | + echo "✅ RTL support: PASSED" |
| 124 | + else |
| 125 | + echo "❌ RTL support: FAILED" |
| 126 | + fi |
| 127 | + |
| 128 | + if [ "${{ steps.hreflang.outcome }}" = "success" ]; then |
| 129 | + echo "✅ Hreflang tags: PASSED" |
| 130 | + else |
| 131 | + echo "❌ Hreflang tags: FAILED" |
| 132 | + fi |
| 133 | + |
| 134 | + echo "" |
| 135 | + echo "Languages: EN, SV, DA, NO, FI, DE, FR, ES, NL, AR, HE, JA, KO, ZH" |
| 136 | + echo "" |
| 137 | + echo "==========================================" |
0 commit comments