Releases: DatanoiseTV/translator-ai
v1.1.0 - OpenAI Support & Configurable Models
What's New
Major Features
- OpenAI Support: Added support for OpenAI GPT models as a translation provider
- Configurable Models: Choose specific models for both Gemini and OpenAI providers
New CLI Options
--gemini-model <model>: Select Gemini model (default: gemini-2.0-flash-lite)- Supports: gemini-2.5-flash, gemini-2.0-flash-lite, gemini-pro, and more
--openai-model <model>: Select OpenAI model (default: gpt-4o-mini)- Supports: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, and more
--provider openai: Use OpenAI as the translation provider
Configuration
- Set
OPENAI_API_KEYenvironment variable to use OpenAI - Automatic provider detection based on available API keys
- List available providers with
--list-providers
Improvements
- Enhanced provider flexibility with three options: Gemini (cloud), OpenAI (cloud), or Ollama (local)
- Better model selection for different use cases and performance requirements
- Updated documentation with comprehensive examples
Technical Details
- Added OpenAI translator implementation with proper error handling
- Extended TranslatorFactory to support multiple cloud providers
- Comprehensive test coverage for all new features
- Maintained backward compatibility with existing configurations
Installation
```bash
npm install -g translator-ai@1.1.0
```
Example Usage
```bash
Use OpenAI with GPT-4o
translator-ai en.json -l es -o es.json --provider openai --openai-model gpt-4o
Use Gemini with 2.5-flash model
translator-ai en.json -l fr -o fr.json --gemini-model gemini-2.5-flash
```
v1.0.10 - Key Verification and Sorting
New Features
Key Verification with --check-keys
- Verify all source keys exist in translated output
- Exit with error if any keys are missing
- Detailed reporting of missing keys with full paths
- Helps catch translation API failures or formatting issues
Alphabetical Key Sorting with --sort-keys
- Sort all JSON keys alphabetically in output files
- Case-insensitive sorting for consistent ordering
- Recursive sorting through nested objects
- Makes diffs cleaner and more readable
Opt-in Metadata
- Metadata is now disabled by default for better compatibility
- Use
--metadataflag to include translation metadata - Prevents issues with strict i18n parsers
Improvements
- Preserve all source JSON keys including non-translatable values (version numbers, etc.)
- Better error reporting with detailed key paths
- Consistent output structure across all translation providers
Bug Fixes
- Fixed issue where non-translatable strings were being dropped from output
- Ensured version numbers, URLs, and other filtered content is preserved
- Improved type safety in TypeScript code
Usage Examples
# Verify all keys are present after translation
translator-ai en.json -l es -o es.json --check-keys
# Sort keys alphabetically for consistent output
translator-ai en.json -l fr -o fr.json --sort-keys
# Include metadata about the translation
translator-ai en.json -l de -o de.json --metadata
# Combine all features
translator-ai src/**/*.json -l es,fr,de -o "{dir}/{name}.{lang}.json" \
--check-keys --sort-keys --preserve-formats --statsInstallation
npm install -g translator-ai@1.0.10v1.0.9 - Advanced Translation Features
New Features
Language Detection
- Automatically detect source language with
--detect-sourceflag - No longer assumes English as the source language
Multiple Target Languages
- Translate to multiple languages in a single command
- Support for comma-separated language codes (e.g.,
-l es,fr,de,ja) - Output patterns support
{lang}variable for multi-language workflows
Dry Run Mode
- Preview translations without making API calls with
--dry-run - Shows detailed statistics about what would be translated
- Displays cache hit rates and estimated API calls
Format Preservation
- Maintain special formats unchanged with
--preserve-formats - Preserves URLs, email addresses, and file paths
- Keeps template variables intact ({{var}}, {0}, %s, ${var}, :param)
- Maintains numbers with units, currency, dates, and version numbers
Improvements
Ollama Reliability
- Increased retry attempts from 3 to 5 with exponential backoff
- Progressive prompt simplification on retries
- Enhanced JSON extraction with 5 different strategies
- Support for various response formats from different models
Documentation
- Updated README with examples of all new features
- Comprehensive .env.example with all configuration options
Testing & CI
- Added 21 new unit tests for new features
- All 79 unit tests passing
- All Ollama integration tests passing
- Fixed CI workflows to only run unit tests (no Ollama required)
- Fixed npm-publish workflow for reliable releases
Installation
npm install -g translator-ai@1.0.9Example Usage
# Detect source language and translate to multiple languages
translator-ai content.json -l es,fr,de --detect-source -o translations/{lang}.json
# Dry run to preview what would be translated
translator-ai app.json -l es --dry-run -o app-es.json
# Preserve technical formats during translation
translator-ai config.json -l ja --preserve-formats -o config-ja.json
# Combine all features
translator-ai src/**/*.json -l es,fr,de -o "{dir}/{name}.{lang}.json" \
--detect-source --preserve-formats --statsv1.0.8 - License field update
What's Changed
Changed
- Updated license field in package.json to properly reflect CC-BY-NC-SA-4.0 with commercial attribution terms
This is a minor metadata update to ensure proper license identification in npm registry.
Full Changelog: v1.0.7...v1.0.8
v1.0.7 - Improved Ollama robustness and validation
What's Changed
Fixed
- Ollama no longer falls back to source language when translation fails
- Empty or missing translations now properly throw errors
- Better handling of malformed JSON responses from LLMs
Added
- Retry logic with exponential backoff (3 attempts) for Ollama translations
- Enhanced JSON extraction supporting multiple response formats
- Strict validation to ensure all fields are properly translated
Improved
- More descriptive error messages for debugging
- Robust parsing for responses with extra text before/after JSON
- Test suite updated to handle retry behavior
Installation
npm install -g translator-ai@1.0.7Example Usage
# Basic translation
translator-ai --provider ollama -l es input.json -o output.json
# With verbose debugging
translator-ai --provider ollama --verbose -l pl input.json -o output.json
# Test with chatwoot example
translator-ai --provider ollama -l pl examples/test-more/chatwoot-en.json -o chatwoot-pl.jsonFull Changelog: v1.0.6...v1.0.7
v1.0.6 - Ollama translation fixes and verbose logging
What's Changed
Fixed
- Ollama translation response parsing for DeepSeek-R1 model
- Handle JSON responses with 'translations' property wrapper
- Improved error handling for various LLM response formats
Added
- --verbose flag for debugging Ollama API requests and responses
- Detailed logging of Ollama request/response for troubleshooting
Improved
- CI workflows with better Ollama service health checks
- Unit test separation for faster CI feedback
Installation
npm install -g translator-ai@1.0.6Testing Ollama with Verbose Output
translator-ai --provider ollama -l es --verbose input.json -o output.jsonFull Changelog: v1.0.5...v1.0.6
v1.0.5 - Renamed to translator-ai with Ollama support
What's Changed
Major Updates
- Renamed from translator-gemini to translator-ai to reflect multi-provider support
- Added Ollama Support for local translation without API costs
- Model Context Protocol (MCP) integration for AI assistants
Features
- Support for local translation using Ollama with DeepSeek-R1
- New
--providerflag to choose between 'gemini' or 'ollama' --ollama-urlto specify custom Ollama API endpoint--ollama-modelto use different Ollama models--list-providerscommand to check available providers- Optimized prompts and parameters for DeepSeek-R1 format
- MCP server implementation for direct integration with AI assistants
Improvements
- Abstracted translation logic into provider-based architecture
- Better handling of different LLM response formats
- Enhanced error handling and timeout management
- Comprehensive test suite with 67 tests covering all functionality
Installation
npm install -g translator-aiBinary Names
translator-ai- Main CLI tooltranslator-ai-mcp- MCP server for AI assistant integration
Full Changelog: v1.0.4...v1.0.5
v1.0.3 - Fix Keys with Dots
translator-gemini v1.0.3
🐛 Critical Bug Fix
Fixed a critical issue where JSON files with keys containing dots (like auth.login or legal.terms-of-service) would fail with "Cannot create property on string" error.
🔧 Technical Details
- Implemented proper key escaping using null byte separators
- Keys with dots are now preserved literally instead of being interpreted as nested paths
- This fix is essential for i18n files that use dot notation in their key names
📋 Example
The tool now correctly handles JSON structures like:
{
"menu": {
"legal": "Legal",
"legal.terms-of-service": "Terms of Service"
}
}🧪 Testing
- Added comprehensive tests for keys with dots
- All 35 tests passing
- Tested with real-world i18n files from society-flow project
For installation and usage, see the README.
If you find this tool useful, consider supporting the development:
v1.0.2 - NPM Publishing Fix
translator-gemini v1.0.2
🔧 NPM Publishing Fixes
- Added
--access publicflag for npm publishing - Fixed repository URL format
- Updated workflow for automation token support
📝 Important Note for npm Publishing
This release requires an npm automation token (not a regular publish token) to be set as npm_token in GitHub secrets for automated publishing to work.
For installation and usage, see the README.
If you find this tool useful, consider supporting the development:
v1.0.1 - Build Fix
translator-gemini v1.0.1
🐛 Bug Fixes
- Fixed build configuration for npm publishing
- Added proper file inclusion in package.json
- Updated postbuild script to handle missing files gracefully
- Added explicit include/exclude in tsconfig.json
📦 Package Improvements
- Ensures dist directory is properly included in npm package
- Fixed GitHub Actions workflow build process
🧪 Testing
- Updated version numbers in tests to match release
For installation and usage, see the README.
If you find this tool useful, consider supporting the development: