App-Greple-xlate
view release on metacpan or search on metacpan
prove -lv t/02_run.t
# Install locally
./Build install
# Clean build artifacts
./Build clean
```
## Project Architecture
### Core Module Structure
- `lib/App/Greple/xlate.pm` - Main module with translation logic
- `lib/App/Greple/xlate/` - Translation engine implementations:
- `deepl.pm` - DeepL API integration
- `gpt3.pm` - GPT-3.5 integration
- `gpt4.pm` - GPT-4 integration
- `gpt4o.pm` - GPT-4o integration
- Supporting modules: `Cache.pm`, `Filter.pm`, `Lang.pm`, `Mask.pm`, `Text.pm`
### Command Line Interface
- `script/xlate` - Main CLI command
- `share/xlate.el` - Emacs integration
- `share/XLATE.mk` - Makefile for translation workflows
### Translation Workflow
The module works by:
1. Finding text patterns using greple's pattern matching
2. Extracting text blocks for translation
3. Caching translations to avoid redundant API calls
4. Supporting multiple output formats (conflict markers, ifdef, etc.)
5. Providing various masking and filtering options
### Key Features
- Multiple translation engines (DeepL, OpenAI GPT variants)
- Caching system for translations
- Pattern-based text extraction
- Multiple output formats
- Docker integration
- Emacs editor integration
## Translation Cache Files
The system generates `.json` cache files alongside source files to store translations and avoid redundant API calls. These follow the pattern `filename.xlate-{engine}-{language}.json`.
## Environment Variables
- `DEEPL_AUTH_KEY` - DeepL API authentication
- `OPENAI_API_KEY` - OpenAI API authentication
- `XLATE_DEBUG` - Enable debug output
- `XLATE_MAXLEN` - Set maximum API call length
- `XLATE_USEAPI` - Use API mode
- `XLATE_UPDATE` - Force cache updates
## Examples and Documentation
- `examples/` - Contains sample translation workflows with various file formats
- `docs/` - Multi-language documentation generated from the main POD
- Multiple README files in different languages generated by the translation system itself
## Critical File Handling Requirements
- **ALWAYS ensure ALL files end with a newline character** when using Write, Edit, or MultiEdit tools
- This is mandatory for proper file handling and to avoid issues with text processing tools, git, and other utilities
- Before finalizing any file operation, verify the content ends with '\n'
## Important Behavior Guidelines
- **è¦åãã¨ã©ã¼ãç¡è¦ããªã**: git statusã®è¦åããã¹ãã®å¤±æãDockerã®ã¨ã©ã¼ãªã©ãåé¡ãçºçããããå¤é¨ã®åé¡ããé¢ä¿ãªããã¨æ¨æ¸¬ã§çä»ããã«ãå¿
ãåå ã調æ»ãã
- **æ¨æ¸¬ã§å¤æããªã**: ããã ãããããã®ã¯ããã§æ¸ã¾ãããå®éã«ç¢ºèªãã¦ãã夿ãã
- **åé¡ããéããªã**: é¢åããã«è¦ãã¦ããæ ¹æ¬åå ãç¹å®ãã¦é©åã«ä¿®æ£ãã
( run in 0.555 second using v1.01-cache-2.11-cpan-e1769b4cff6 )