Europe: English, French, German, Spanish, Portuguese, Italian, Dutch, Danish, Swedish, Norwegian, Finnish, Polish, Czech, Slovak, Slovenian, Croatian, Serbian, Albanian, Bulgarian, Romanian, Hungarian, Estonian, Latvian, Lithuanian, Macedonian, Maltese, Greek, Irish, Scottish Gaelic, Galician, Catalan, Welsh.
Asia: Japanese, Chinese (Simplified), Chinese (Traditional), Korean, Hindi, Bengali, Gujarati, Kannada, Malayalam, Marathi, Tamil, Telugu, Urdu, Thai, Vietnamese, Indonesian, Malay, Persian.
Other: Arabic, Hebrew, Turkish, Ukrainian, Russian, Swahili, Afrikaans.
Language resolution is case-insensitive and accepts both codes (en, ja, zh-Hant) and full names (English, Japanese, Chinese (Traditional)). Underscores are normalized to hyphens.
Model Size Speed Quality translategemma:4b3.3 GB ~300ms Good translategemma:12b8.1 GB ~600ms Great (default) translategemma:27b17 GB ~1.5s Best
Metric Value First translation (cold model load) ~15s Subsequent translations ~600ms VRAM usage ~8.1 GB Long text (per chunk) ~600ms
MCP Client (Claude Code, etc.)
| index.ts | MCP server -- 5 tools: translate, translate_markdown,
| | translate_all, list_languages, check_status
| translate.ts | Prompt building, chunking, batch mode, streaming
| translateMarkdown | Markdown-aware segmentation, table parsing, reassembly
| translateAll.ts | Multi-language orchestrator with nav bar injection
| semaphore.ts | Counting semaphore for GPU-safe concurrency
| validate.ts | Output validation (empty, echo, truncation, garble)
| ollama.ts | HTTP client -- auto-start, auto-pull, retry, streaming
| cache.ts | Segment cache + fuzzy translation memory
| glossary.ts | Software term dictionary
| polish.ts | Post-translation artifact cleanup
| languages.ts | 57 language definitions
| errors.ts | PolyglotError structured error class
Ollama + TranslateGemma (GPU)
Variable Default Description POLYGLOT_MODELtranslategemma:12bDefault Ollama model for all translations POLYGLOT_CONCURRENCY1Maximum concurrent Ollama requests (prevents GPU OOM)
Flag Description --version, -VPrint version and exit
Aspect Detail Data touched Text sent to local Ollama API (localhost:11434), .polyglot-cache.json segment cache Data NOT touched No files outside working directory, no browser data, no OS credentials Network HTTP to localhost:11434 only — zero external/internet egress Telemetry None collected or sent Cache safety Cache path traversal is blocked — the cache file must stay within the same directory as the source file
npm install # install deps
npm run typecheck # type-check without emitting
npm test # run 256 unit tests (vitest)
npm run build # compile TypeScript to dist/
npm run verify # typecheck + test + build + pack (full gate)
The package exposes individual module exports for programmatic use:
Export Module @mcptoolshop/polyglot-mcpMain MCP server entry point @mcptoolshop/polyglot-mcp/translateCore translate + translateBatch @mcptoolshop/polyglot-mcp/translateMarkdownMarkdown-aware translation @mcptoolshop/polyglot-mcp/translateAllMulti-language orchestrator @mcptoolshop/polyglot-mcp/validateOutput validation @mcptoolshop/polyglot-mcp/ollamaOllama HTTP client @mcptoolshop/polyglot-mcp/languagesLanguage definitions + resolver @mcptoolshop/polyglot-mcp/glossarySoftware glossary @mcptoolshop/polyglot-mcp/polishPost-translation cleanup @mcptoolshop/polyglot-mcp/cacheSegment cache + fuzzy matching @mcptoolshop/polyglot-mcp/semaphoreCounting semaphore