Skip to content

TheHypnoo/compareARB

Repository files navigation

Internationalization File Comparison Tool

A Python tool for comparing, managing, and translating internationalization (i18n) files in ARB format. This tool helps developers maintain consistency across multiple language files and automate translation workflows.

Features

  • Key Comparison: Compare keys between different language files
  • Order Synchronization: Ensure consistent key ordering across all language files
  • Key Management: Add missing keys or remove unnecessary ones
  • Automated Translation: Translate values using DeepL API
  • Multi-language Support: Supports 8 languages (ES, FR, EN, DE, IT, PT, CA, GL)

Supported Languages

  • Spanish (ES) - Primary language
  • French (FR)
  • English (EN)
  • German (DE)
  • Italian (IT)
  • Portuguese (PT)
  • Catalan (CA) - Non-translatable
  • Galician (GL) - Non-translatable

Installation

  1. Clone this repository:
git clone https://github.com/TheHypnoo/compareARB.git
cd CompareARB
  1. Install required dependencies:
pip install requests
  1. Set up your DeepL API key:
    • Copy config.example.py to config.py
    • Add your DeepL API key to config.py

Configuration

DeepL API Setup

  1. Get your API key from DeepL
  2. Copy config.example.py to config.py
  3. Replace your_deepl_api_key_here with your actual API key
# config.py
DEEPL_API_KEY = "your_actual_api_key_here"

Important: Never commit your actual API key to version control!

Usage

Basic Usage

Run the main script:

python main.py

Menu Options

  1. Compare keys - Check for missing or extra keys between files
  2. Compare and update key order - Synchronize key ordering across files
  3. Remove different keys - Remove keys that don't exist in the primary file
  4. Translate values - Automatically translate values using DeepL
  5. Change language - Switch to a different target language
  6. Exit - Close the application

Example Workflow

  1. Select a target language (e.g., "fr" for French)
  2. Choose "Compare keys" to identify missing translations
  3. Use "Add missing keys" to populate empty translations
  4. Use "Translate values" to automatically translate content
  5. Review and edit translations as needed

File Structure

compare_arb/
├── main.py                 # Main application
├── config.py              # Configuration (API keys, etc.)
├── config.example.py      # Example configuration
├── .gitignore            # Git ignore rules
├── README.md             # This file
├── intl_*.arb           # Original language files
└── intl_*_example.arb   # Example language files

Example Files

The repository includes example internationalization files with basic content:

  • intl_en_example.arb - English example
  • intl_es_example.arb - Spanish example
  • intl_fr_example.arb - French example
  • intl_de_example.arb - German example
  • intl_it_example.arb - Italian example
  • intl_pt_example.arb - Portuguese example
  • intl_ca_example.arb - Catalan example
  • intl_gl_example.arb - Galician example

Security Notes

  • Never commit config.py - It contains your API key
  • The .gitignore file is configured to exclude sensitive files
  • Use config.example.py as a template for other developers

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is open source and available under the MIT License.

Support

If you encounter any issues or have questions:

  1. Check the existing issues
  2. Create a new issue with detailed information
  3. Include your Python version and any error messages

Changelog

Version 1.0.0

  • Initial release
  • Support for 8 languages
  • DeepL API integration
  • Key comparison and management tools
  • Automated translation capabilities

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages