CLI tool for translating Markdown documents using the ChatGPT API
Top 87.4% on sourcepulse
This CLI tool translates Markdown documentation using the OpenAI ChatGPT API, targeting developers and technical writers who need to localize open-source project documentation. It offers fine-grained control over translation quality and cost by leveraging ChatGPT's understanding of technical content and Markdown structure.
How It Works
The tool processes Markdown files by splitting them into manageable fragments, sending each fragment to the ChatGPT API with a user-defined prompt. This approach allows for parallel processing of fragments, potentially speeding up translation for large documents. It includes features like code block preservation and configurable fragment sizes to optimize API usage and maintain translation consistency.
Quick Start & Requirements
npm install --global chatgpt-md-translator
.env
file or command-line overrides.prompt.md
) for custom instructions.chatgpt-md-translator [file-to-translate.md]
Highlighted Details
gpt-4o
, gpt-3.5-turbo
), with gpt-4o
recommended.FRAGMENT_TOKEN_SIZE
for optimizing API calls and handling large documents.TEMPERATURE
parameter adjustable for controlling output randomness (default 0.1).CODE_BLOCK_PRESERVATION_LINES
option to prevent translation of code blocks.Maintenance & Community
smikitky
).Licensing & Compatibility
Limitations & Caveats
The tool does not perform robust Markdown parsing, which may lead to issues with highly atypical Markdown structures. While it aims to preserve Markdown, users must review translations for accuracy and potential markup errors, as the API may sometimes ignore instructions or produce invalid Markdown.
4 months ago
1 week