Skip to content

🌐 A powerful CLI tool for analyzing translation files - featuring real-time comparison, interactive HTML reports, and support for nested JSON structures. Perfect for i18n projects.

License

Notifications You must be signed in to change notification settings

hasanbeder/translation-diff-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 Translation Diff Checker

Overview

Translation Diff Checker is a powerful, easy-to-use Python tool designed to analyze and compare translation files across multiple languages. It helps developers and translators identify translation gaps, track changes, and maintain high-quality multilingual applications.

Python Version License Maintenance

πŸš€ Features

  • πŸ“Š Comprehensive translation file comparison
  • πŸ” Detect untranslated, new, and changed keys
  • πŸ“ˆ Generate detailed HTML reports
  • 🌈 Support for nested JSON translation files
  • πŸ’» Command-line interface
  • πŸ“¦ Multi-file and multi-language support

πŸ“‹ Requirements

  • Python 3.7+
  • JSON translation files
  • Supported File Format: .json

πŸ” File Format Limitations

  • Currently supports only JSON translation files
  • Nested JSON structures are supported
  • Future roadmap includes support for YAML, TOML, and other translation formats

JSON File Structure Example

{
    "welcome_message": "Hello, World!",
    "user_profile": {
        "name": "Name",
        "age": "Age"
    }
}

πŸ“š Documentation

Detailed documentation is available in the docs directory:

For the most up-to-date and comprehensive information, please refer to our documentation.

πŸ›  Installation

# Clone the repository
git clone https://github.com/hasanbeder/translation-diff-checker.git

# Change directory
cd translation-diff-checker

# Install dependencies
pip install -r requirements.txt

πŸ”§ Usage

Quick Start with Example Files

# Try with example files
python3 src/translation_diff_checker.py examples/en.json examples/tr.json

Single File Comparison

python3 src/translation_diff_checker.py en.json tr.json

Multi-File Comparison

python3 src/translation_diff_checker.py --source-dir source_translations/ --target-dir target_translations/

Output Formats

# HTML Report (default)
python3 src/translation_diff_checker.py en.json tr.json

# Text Report
python3 src/translation_diff_checker.py en.json tr.json --format text

# JSON Report
python3 src/translation_diff_checker.py en.json tr.json --format json

Output Format Options

  • HTML: Interactive, detailed report with charts and styling
  • Text: Concise console output with key translation statistics
  • JSON: Machine-readable format for further processing

Text Report Example

Multi-File Translation Analysis Report
=====================================

File: en.json
-------------
Total Keys: 150
Translated Keys: 120
Completion Percentage: 80%

Untranslated Keys:
- user.profile.advanced_settings
- notifications.email_preferences

JSON Report Structure

{
    "total_keys": 150,
    "translated_keys": 120,
    "untranslated_keys": ["key1", "key2"],
    "completion_percentage": 80.0
}

πŸ“Š Report Types

  1. Console Output: Quick summary of translation differences
  2. HTML Report: Detailed, interactive report with:
    • Translation coverage percentage
    • Untranslated keys
    • New and removed keys
    • Changed translations

🌍 Real-World Use Case: Multilingual Software Localization

Scenario: E-commerce Platform Internationalization

Background

You're developing a global e-commerce platform targeting multiple international markets. Your application needs to support translations for:

  • Product descriptions
  • User interface elements
  • Error messages
  • Email templates
  • Customer support sections

Translation Management Challenges

  • 1000+ translation keys across different application domains
  • Translations managed by multiple teams
  • Need to track translation progress
  • Ensure consistency across languages
  • Validate translation quality

How Translation Diff Checker Helps

  1. Initial Translation Coverage
# Compare English base translations with target languages
python3 src/translation_diff_checker.py \
    translations/base/en.json \
    translations/target/es-ES.json \
    --output spanish_translation_report.html
  1. Detailed Insights The generated report reveals:
  • πŸ” Total translation keys: 1000
  • βœ… Translated keys: 750
  • ❌ Missing keys: 250
  • πŸ“Š Completion: 75%
  1. Identifying Translation Gaps Report highlights untranslated critical sections:
Untranslated Keys:
- checkout.payment_methods
- product.technical_specifications
- user_account.subscription_management
- customer_support.faq_section
  1. Continuous Integration Integrate into localization workflow:
# CI Pipeline Translation Check
localization_check:
  script:
    - python translation-diff-checker.py 
      translations/base/en.json 
      translations/target/fr-FR.json 
      --format text
  only:
    - merge_requests
  1. Translator Collaboration
  • Generate comprehensive HTML reports
  • Clearly communicate translation requirements
  • Track progress across multiple languages
  • Prioritize translation efforts

Business Impact

  • 🌐 Faster global market expansion
  • πŸ’‘ Systematic translation management
  • πŸ“ˆ Improved user experience
  • πŸ’° Reduced localization costs
  • πŸš€ Consistent brand messaging

When to Use

  • Before international product launch
  • During continuous localization
  • After major feature updates
  • When adding new language support

Pro Tips

  • Run checks weekly
  • Set minimum translation completeness (90%)
  • Involve native speakers in review
  • Use reports for translator performance tracking

πŸ§ͺ Testing

# Run tests
python3 -m pytest tests/

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ› Issues

Report issues at: https://github.com/hasanbeder/translation-diff-checker/issues

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.

πŸ“§ Contact

Hasan Beder - @hasanbeder

Project Link: https://github.com/hasanbeder/translation-diff-checker


Made with ❀️ for Developers and Translators

About

🌐 A powerful CLI tool for analyzing translation files - featuring real-time comparison, interactive HTML reports, and support for nested JSON structures. Perfect for i18n projects.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages