Lingora
A command-line utility for translating UI string JSON files for i18next using AI services through a plugin architecture, with a web-based reviewer interface.
Features
- Translate JSON UI string files to any supported language
- Plugin-based architecture for different AI translation services
- Currently supports OpenAI's GPT models and includes a simulator plugin for testing
- Preserves JSON structure and folder hierarchy
- Progress tracking during translation
- Web-based reviewer interface for comparing and editing translations
- Supports recursive directory scanning for JSON files
Installation
- Clone this repository
- Install with pipx:
pipx install .
Or install directly from PyPI (once published):
pipx install lingora
Configuration
For the OpenAI plugin, create a .env file in the project root with:
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL=gpt-3.5-turbo # Optional, defaults to gpt-3.5-turbo
Usage
Translation
python lingora translate en de --input-dir ./locales/en --plugin-name openai
This will:
- Read all JSON files from the input directory
- Generate an intermediate XML representation
- Translate the content to German
- Save the translated files in
output/de/maintaining the original directory structure
Launch Translation Reviewer
python lingora reviewer ./locales/en ./output/de
This launches a web-based interface for:
- Comparing source and translated strings
- Editing translations
- Saving changes directly to the target files
List Available Plugins
python lingora list-plugins
Plugin System
The tool uses a plugin architecture to support different AI translation services. Each plugin must implement the TranslationPlugin interface defined in plugins/base.py.
Creating a New Plugin
- Create a new file in the
pluginsdirectory - Implement the
TranslationPlugininterface - Register your plugin in
plugins/__init__.py
Example plugin structure:
from .base import TranslationPlugin
class MyTranslationPlugin(TranslationPlugin):
def translate(self, text: str, target_lang: str) -> str:
# Implement translation logic
pass
def get_name(self) -> str:
return "my_plugin"
def get_description(self) -> str:
return "Description of my plugin"
def is_configured(self) -> bool:
return True # Check if plugin is properly configured
Declarations
Credits
Artificial Intelligence
- Python code for translation motor regarding i811 JavaScript library was almost entirely done by Cursor via extremely descriptive prompts [as an experiment].
- The name was chosen among recommendations in a brainstorming session by DeepSeek [as an experiment].
License
Lingora, an open source utility automating performing language
transformations on documents though artificial intellegience
Copyright (C) 2025 Isaak Engineer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lingora-0.1.4.tar.gz.
File metadata
- Download URL: lingora-0.1.4.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c9d735eaf27fbb5b379e1b6018eb15592d091240678d8c7ea102a0db5d082ea
|
|
| MD5 |
a53298a52828d27ba7f084e47a3a13f8
|
|
| BLAKE2b-256 |
4402d55a8701875e0eaab631871edb585a7bba27f35652be463003384d978b91
|
File details
Details for the file lingora-0.1.4-py3-none-any.whl.
File metadata
- Download URL: lingora-0.1.4-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f241e2e6de3327b642ff6eafef78a12035654c721e6928400cfcf20c0eb45a02
|
|
| MD5 |
28b71dd4849571e501e26ac8f95b4c92
|
|
| BLAKE2b-256 |
fee752d2ee129d2386ba7dcd611ab25b37740a5cc86cf54ad898dab9195db2b7
|