Skip to content

A professional desktop application for managing localization files in multiple formats (JSON, YAML, PO). Built with PyQt5, this tool provides a comprehensive solution for translation management with multi-language editing, missing key detection, statistics, and export capabilities.

License

Notifications You must be signed in to change notification settings

BaseMax/qt-localization-manager

Repository files navigation

Qt Localization Manager

A professional desktop application for managing localization files in multiple formats (JSON, YAML, PO). Built with PyQt5, this tool provides a comprehensive solution for translation management with multi-language editing, missing key detection, statistics, and export capabilities.

Application Screenshot

Features

  • Multi-Format Support: Work with JSON, YAML, and PO (gettext) localization files
  • Multi-Language Editing: Load and edit multiple language files simultaneously
  • Missing Key Detection: Automatically identify missing translations across languages
  • Real-Time Statistics: View completion rates, missing keys, and empty translations
  • Translation Preview: Preview translations as you edit
  • Search Functionality: Quickly find specific keys or translations
  • Export Capability: Export translations to different formats
  • Professional Qt UI: Clean, intuitive interface with Fusion style
  • Visual Indicators: Missing translations highlighted in red for easy identification

Installation

Requirements

  • Python 3.6+
  • PyQt5
  • PyYAML
  • polib

Install Dependencies

pip install -r requirements.txt

Or install individually:

pip install PyQt5 PyYAML polib

Usage

Running the Application

python main.py

Loading Localization Files

  1. Click "Load File" button or use File → Load File (Ctrl+O)
  2. Select a localization file (JSON, YAML, or PO format)
  3. Enter a language identifier (e.g., 'en', 'fr', 'de')
  4. The file will be loaded and displayed in the translation table

Editing Translations

  1. Select a language from the Language dropdown
  2. Click on any translation cell to edit
  3. Missing translations are highlighted in red
  4. Changes are reflected immediately in statistics

Viewing Statistics

The right panel shows:

  • Total Keys: Total number of unique translation keys
  • Translated: Number of keys with translations
  • Missing: Number of keys without translations
  • Empty: Number of empty translation values
  • Completion: Overall completion percentage with progress bar

Missing Keys

The "Missing Keys" section lists all keys that are missing translations in the current language, making it easy to identify what needs to be translated.

Adding/Deleting Keys

  • Add Key: Click "Add Key" button or use Edit → Add Key (Ctrl+N)
  • Delete Key: Select a row and click "Delete Key" or use Edit → Delete Key (Delete)

Saving Changes

  • Click "Save" button or use File → Save (Ctrl+S)
  • Saves the current language file to its original location

Exporting Translations

  1. Use File → Export (Ctrl+E)
  2. Select the language to export
  3. Choose the output format (JSON, YAML, or PO)
  4. Specify the output file path
  5. Click OK to export

File Format Support

JSON Format

Supports nested JSON structures with dot notation for keys:

{
  "app": {
    "title": "My Application",
    "subtitle": "Welcome"
  },
  "buttons": {
    "save": "Save",
    "cancel": "Cancel"
  }
}

Keys are flattened as: app.title, app.subtitle, buttons.save, buttons.cancel

YAML Format

Supports nested YAML structures:

app:
  title: My Application
  subtitle: Welcome
buttons:
  save: Save
  cancel: Cancel

PO Format

Standard gettext PO format:

msgid "app.title"
msgstr "My Application"

msgid "buttons.save"
msgstr "Save"

Examples

Sample localization files are provided in the examples/ directory:

  • examples/en.json - English translations (JSON)
  • examples/fr.json - French translations (JSON)
  • examples/de.yaml - German translations (YAML)
  • examples/es.po - Spanish translations (PO)

Load these files to see the application in action and understand the missing key detection feature (French file has 2 missing keys).

Keyboard Shortcuts

  • Ctrl+O: Load File
  • Ctrl+S: Save
  • Ctrl+E: Export
  • Ctrl+N: Add Key
  • Delete: Delete Key
  • Ctrl+Q: Exit

Architecture

The application consists of three main modules:

parsers.py

  • JSONParser: Parse and save JSON localization files
  • YAMLParser: Parse and save YAML localization files
  • POParser: Parse and save PO (gettext) files
  • Handles nested structures and flattening/unflattening

localization_manager.py

  • LocalizationManager: Core business logic
  • Multi-language file management
  • Missing key detection
  • Statistics calculation
  • Export functionality

main.py

  • MainWindow: Main application window
  • StatisticsWidget: Real-time statistics display
  • PreviewWidget: Translation preview panel
  • ExportDialog: Export configuration dialog

Testing

Run the provided test scripts:

# Test backend functionality
python test_backend.py

# Test UI components
python test_ui.py

License

MIT License - see LICENSE file for details.

Author

Max Base

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

About

A professional desktop application for managing localization files in multiple formats (JSON, YAML, PO). Built with PyQt5, this tool provides a comprehensive solution for translation management with multi-language editing, missing key detection, statistics, and export capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages