Translation Test Suite

Comprehensive testing framework for Mail Server Factory website translations.

Overview

This test suite ensures that:

  1. Brand names remain untranslated across all languages
  2. Technical content (file paths, version numbers, code samples) is preserved
  3. All languages have complete translations
  4. Translation system integrates correctly with the website

Test Structure

tests/
├── README.md                                  # This file
├── translation-validator.js                   # Brand name & completeness validator
├── unit/
│   └── translation-unit-tests.js              # Unit tests for translation system
├── integration/
│   └── language-selector-integration-tests.js # Integration tests for language selector
├── e2e/
│   └── translation-e2e-tests.js               # End-to-end workflow tests
└── run-all-translation-tests.sh               # Test runner script

Running Tests

Run All Tests

./tests/run-all-translation-tests.sh

Run Individual Test Suites

# Validation tests
node tests/translation-validator.js

# Unit tests
node tests/unit/translation-unit-tests.js

# Integration tests (requires jsdom)
node tests/integration/language-selector-integration-tests.js

# E2E tests
node tests/e2e/translation-e2e-tests.js

Test Categories

1. Translation Validation (translation-validator.js)

Validates:

Exit Codes:

2. Unit Tests (unit/translation-unit-tests.js)

Tests individual components:

Current Status: 14/18 tests passing

Known Issues:

3. Integration Tests (integration/language-selector-integration-tests.js)

Tests language selector integration:

Requirements:

4. End-to-End Tests (e2e/translation-e2e-tests.js)

Tests complete workflow:

Fixing Translation Issues

Fix Brand Names

python3 fix-brand-names.py --dry-run  # Preview changes
python3 fix-brand-names.py            # Apply changes

Ensures:

Fix Technical Content

python3 fix-technical-content.py --dry-run  # Preview changes
python3 fix-technical-content.py            # Apply changes

Ensures:

CI/CD Integration

Add to your CI pipeline:

test:
  script:
    - npm install
    - npm install jsdom  # For integration tests
    - ./tests/run-all-translation-tests.sh

Or in GitHub Actions:

- name: Install dependencies
  run: |
    npm install
    npm install jsdom

- name: Run translation tests
  run: ./tests/run-all-translation-tests.sh

Test Results Summary

Latest Test Run Results

Translation Validation:

Unit Tests:

Integration Tests:

E2E Tests:

Supported Languages (28)

Code Language Status
en English ✅ Complete (reference)
ru Русский ✅ Complete
be Беларуская ✅ Complete
zh 中文 ✅ Complete
hi हिन्दी ✅ Complete
fa فارسی ✅ Complete (RTL)
ar العربية ✅ Complete (RTL)
ko 한국어 ✅ Complete
ja 日本語 ✅ Complete
sr Српски ✅ Complete
fr Français ✅ Complete
de Deutsch ✅ Complete
es Español ✅ Complete
pt Português ✅ Complete
no Norsk ❌ Missing (in config but not in translations)
da Dansk ✅ Complete
sv Svenska ✅ Complete
is Íslenska ✅ Complete
bg Български ✅ Complete
ro Română ✅ Complete
hu Magyar ✅ Complete
it Italiano ✅ Complete
el Ελληνικά ✅ Complete
he עברית ✅ Complete (RTL)
ka ქართული ✅ Complete
kk Қазақ ✅ Complete
uz Oʻzbek ✅ Complete
tg Тоҷикӣ ✅ Complete
tr Türkçe ✅ Complete

Total: 28 configured, 27 complete (1 missing: Norwegian)

Brand Name Policy

NEVER translate these brand names:

These should remain in English across ALL languages.

Technical Content Policy

NEVER translate:

  1. File paths: Examples/Ubuntu_22.json must stay exactly as is
  2. Code samples: Command-line code must be identical
  3. Version numbers: 2.0.21, 8.14.3, 17 must stay as is
  4. Architecture badges: Technical terms in badges stay in English
  5. Statistics numbers: 12 Distributions, 100%, 47 Tests - numbers must be consistent

Maintenance

Adding a New Language

  1. Add language to _config.yml: ```yaml languages:
    • xx # Your language code ```
  2. Add language to _data/languages.yml:
    xx:
      name: "YourLanguageName"
      flag: "🏳"
    
  3. Add translations to _data/translations.yml:
    xx:
      hero_title: "..."
      hero_subtitle: "..."
      # ... all 259 keys
    
  4. Run tests:
    ./tests/run-all-translation-tests.sh
    

Updating Translations

After updating _data/translations.yml:

# Fix any brand name issues
python3 fix-brand-names.py

# Fix technical content issues
python3 fix-technical-content.py

# Validate everything
./tests/run-all-translation-tests.sh

Troubleshooting

Test Failures

“Language XX should exist”

“Brand name incorrectly translated”

“File path should be identical to English”

“Missing translation key”

Dependencies

# Required
npm install js-yaml

# Optional (for integration tests)
npm install jsdom

Contributing

When adding or modifying translations:

  1. ✅ Run tests before committing
  2. ✅ Ensure brand names remain in English
  3. ✅ Keep file paths and code samples unchanged
  4. ✅ Maintain version number consistency
  5. ✅ Test on actual website with jekyll serve

License

Part of Mail Server Factory project - see parent LICENSE file.