Skip to content

A simple Python program to compare all the keys in a JSON file. Useful for custom i18n libraries to check if all languages are alligned.

License

Notifications You must be signed in to change notification settings

MarcoBasileDev/i18n_sync_tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Localization Sync Tool

Synchronize your translation files and bridge the gap between languages.

This Python utility is designed to manage of multi-language applications. It compares a Source translation file (your most up-to-date version, e.g., English) against multiple Target files (e.g., Italian, Spanish, French) to identify missing keys.

Instead of manually hunting for what's missing, this tool generates a "ready-to-translate" snippet that you can simply copy-paste into an LLM (like ChatGPT or Claude) to complete your localization in seconds.


Key Features

  • Hybrid Parsing: Reads standard .json files and .js / .ts files using export const structures.
  • Deep Extraction: Uses advanced Regex to capture multi-line strings and various quoting styles (' or ").
  • LLM-Ready Output: Generates helper files in the output/ directory formatted specifically for easy AI translation.
  • Organized Workflow: Keeps your workspace clean by separating input data from generated results.
  • Modern GUI: A clean, minimal, and intuitive interface built with Eel (HTML/JS/Python).

🛠 Prerequisites

  • Python 3.x installed on your system.
  • No external libraries required (uses built-in os, re, and json modules).

📂 Project Structure

If you are running the script manually or building from source, organize your folder like this:

/your-project-folder
├── web/                 <-- UI assets (HTML, CSS, JS)
├── input/               <-- Place your translation files here (.json, .js, .ts)
├── output/              <-- The script will create this and put results here
├── sync_tool.py         <-- Python script
└── files.ico            <-- App icon

How to Use

  1. Run the Application If you are using the source code, install the requirements (pip install eel) and run:
python sync_tool.py

Alternatively, just launch the standalone .exe from the official Releases.

  1. Upload Files Drag and drop your translation files directly into the dashed area of the interface. They will be automatically saved into the input/ folder.

  2. Select Master Source Select your "Master" file (the most updated one) from the dropdown menu and click "Generate Missing Keys".

  3. Copy-Paste Output Check the output/ folder. Open the missing_in_[target].txt files and paste the content into your favorite LLM.

Building from Source

If you want to compile your own standalone executable instead of using the pre-built release, ensure you have pyinstaller installed and run the following command:

python -m PyInstaller --noconsole --onefile --add-data "web;web" --icon=files.ico sync_tool.py

🔍 Example Output

If your es.js is missing keys compared to en.js, the generated file in output/ will look like this:

// MISSING KEYS IN es.js
// Source file: en.js
// Generated by localization sync tool

WELCOME: 'Welcome',
LOGOUT_CONFIRM: 'Are you sure you want to leave?',

⚠️ Notes on Compatibility

The script is optimized to recognize keys written in SCREAMING_SNAKE_CASE (e.g., ACTION_DELETE). It handles values wrapped in either single (') or double (") quotes, including those that span across multiple lines.

About

A simple Python program to compare all the keys in a JSON file. Useful for custom i18n libraries to check if all languages are alligned.

Resources

License

Stars

Watchers

Forks

Packages

No packages published