@reformlabs/qlit
v3.0.0
Published
High-performance CLI translator and i18n automation tool with DeepL integration, parallel processing, and auto-generated localization.
Maintainers
Readme
Qlit by Reform Labs (@reformlabs/qlit)
High-performance CLI translator and i18n automation tool with DeepL integration, parallel processing, and auto-generated localization.
[!IMPORTANT] This project is developed by Reform Labs. Users are free to use the system and contribute, but they may not redistribute it by claiming ownership as if it were their own project.
- DeepL Integration: Automatically switches to the high-quality DeepL engine when an API key is provided.
- Aggressive Parallelization: Translates multiple strings concurrently using mirror rotation and high-performance worker pools (v2.8.0+).
- Batch & Deduplication: Sends batch requests (DeepL) and deduplicates identical strings to reduce network overhead and increase speed.
- Auto-i18n Generator: Scans your source code (
.js,.ts,.py,.html, etc.) for hardcoded strings and generates a translated JSON file instantly. - i18n Support: Bulk translates JSON/YAML localization files while preserving their keys.
- Auto-Mirror (Uninterrupted Service): Automatically switches between 8+ different servers to provide an “always-working” experience.
- Smart Cache: Avoids sending API requests for identical translations for 5 minutes, improving speed.
- Markdown Support: Preserves
code, bold, italic, and links during translation. - File Translator: Translates text files line-by-line using batch processing.
- Professional CLI: Features Ora spinners, Chalk colors, clipboard support, and clean outputs (silenced third-party logs).
Installation
npm install -g qlitCLI Usage
Start by configuring the CLI language and the default target language:
qlit config tr(Sets the CLI language to Turkish and the default target language to TR.)
Basic Commands
Quick Translation:
qlit <text>Instantly translates to the default language. Example:qlit "Hello"Targeted & Multi Translation:
qlit to <language(s)> <text>Translates into a specific language or multiple languages separated by commas. Example:qlit to tr,de "Hello"i18n Automation:
qlit i18n <file> --to <language>Translates JSON localization files without breaking their keys. Example:qlit i18n tr.json --to enScan & Translate (Auto-Generator):
qlit scan <dir> --to <language>Scans your project (js, ts, py, etc.) for hardcoded strings and creates a ready-to-use translation file. Example:qlit scan ./src --to trList Languages:
qlit listDisplays 130+ supported languages and their codes.Configuration:
qlit config <language>Permanently sets the default translation language and CLI language. (You can override the config path by setting theQLIT_CONFIG_PATHenvironment variable)Folder Translation:
qlit --folder <path> to <language>Translates all files within a folder recursively while maintaining the file structure. Example:qlit --folder ./locales to en
Advanced Usage & Options
Pipe Support:
cat logs.txt | qlit to trTranslates outputs coming from other commands directly.File Translation:
qlit to en -f readme.txtReads a file and saves the result asreadme_en.txt.Interactive Mode:
qlit -iOpens a fast shell for continuous translations.JSON Mode:
qlit "Hello" --jsonReturns full API data (pronunciation, definitions, etc.) as JSON.Clipboard Support:
--copyAutomatically copies the translation result to the clipboard.
Options List
-c, --copy: Copies the result to the clipboard.-j, --json: Returns full JSON output.-f, --file <path>: Performs file translation.-i, --interactive: Starts an interactive shell.
Using as a Library
JavaScript / Node.js
const qlit = require('qlit');
async function test() {
// Batch Translation
const list = ['Hello', 'World'];
const results = await qlit.translateBatch(list, 'en', 'tr');
console.log(results[0].translation); // "Merhaba"
}TypeScript
import qlit, { Language } from 'qlit';
const res = await qlit.translate('Hello', 'en', 'tr');
const langs: Language[] = await qlit.getLanguages();.env Configuration (Optional)
If you want to use DeepL Pro/Free, add a .env file to the root directory of your project:
DEEPL_API_KEY=your_key_hereLicense and Rights
This project is open source, but the ownership rights belong to Reform Labs. Users may use the system, but they may not redistribute it by presenting it as their own work.
Made with ❤️ by Reform Labs
