Skip to main content

No project description provided

Project description

ZMP Markdown Translator

Platform Badge Component Badge CI Badge License Badge PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Wheel

A high-performance markdown translator that supports multiple languages and preserves markdown formatting. Uses OpenAI's GPT models for translation.

Features

  • Translates entire directories of markdown files
  • Preserves markdown formatting and structure
  • Supports multiple target languages simultaneously
  • Handles large files through automatic chunking
  • Maintains Docusaurus-compatible directory structures
  • Shows real-time progress with colorized output

Installation

# Using Poetry (recommended)
poetry install

# Or using pip
pip install .

Usage

Basic Command Structure

poetry run zmp-translate \
  --source-dir SOURCE_DIR \
  --target-dir TARGET_DIR \
  --languages LANG_CODES

Example Usage

poetry run zmp-translate \
  --source-dir "./repo/docs/ZCP" \
  --target-dir "./repo/i18n" \
  --languages "ko,ja,zh"

or

poetry run zmp-translate \
  --s "./repo/docs/ZCP" \
  --t "./repo/i18n" \
  --l "ko,ja,zh"

Command Line Options

  • -s, --source-dir: Source directory containing markdown files (required)
  • -t, --target-dir: Target directory for translations (default: "i18n")
  • -l, --languages: Comma-separated list of target language codes (required)
  • -m, --model: OpenAI model to use (overrides .env setting)
  • -c, --chunk-size: Maximum chunk size for translation (overrides .env setting)
  • -n, --concurrent: Maximum concurrent requests (overrides .env setting)

Supported Language Codes

The following language codes are supported:

Code Language
ko Korean
fr French
ja Japanese
es Spanish
de German
zh Chinese
ru Russian
it Italian
pt Portuguese
ar Arabic

Environment Configuration

Create a .env file in your project root:

# OpenAI Configuration
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=your-model-here

# Performance Settings
MAX_CHUNK_SIZE=4000
MAX_CONCURRENT_REQUESTS=5

Directory Structure

The translator maintains a Docusaurus-compatible directory structure based on the source directory name:

  • For *_zcp sources:
    [target_dir]/[lang]/docusaurus-plugin-content-docs-zcp/current/
    
  • For *_apim sources:
    [target_dir]/[lang]/docusaurus-plugin-content-docs-apim/current/
    
  • For *_amdp sources:
    [target_dir]/[lang]/docusaurus-plugin-content-docs-amdp/current/
    
  • For other sources:
    [target_dir]/[lang]/docusaurus-plugin-content-docs/current/
    

Development

# Install dependencies
poetry install

# Run tests
poetry run test

# Run tests with watch mode
poetry run watch

License

This project is distributed under the MIT License. See the LICENSE file for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zmp_md_translator-0.1.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zmp_md_translator-0.1.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file zmp_md_translator-0.1.1.tar.gz.

File metadata

  • Download URL: zmp_md_translator-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.2 Darwin/24.3.0

File hashes

Hashes for zmp_md_translator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 03398cf09e57031eb95dc52e052071a885050b021d14e18272e76332d2a48d43
MD5 310cc76cb8729ea18a44c0e09984f5b1
BLAKE2b-256 b4d16c483276cebff579f1867abf802f35d8426ba98a793374b4b6581b9c4259

See more details on using hashes here.

File details

Details for the file zmp_md_translator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zmp_md_translator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.2 Darwin/24.3.0

File hashes

Hashes for zmp_md_translator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4483b2cb11ba05a185a4bfea5dd9b236fe13d6cda3e2310db4dc63196ba273f
MD5 eec0b6104a762abab0a4879d667b2db2
BLAKE2b-256 70ac33511ab670c811fbb6534018d560251038fbaae1b7d79974bf4e5ae6174f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page