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

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.4.tar.gz (13.4 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.4-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zmp_md_translator-0.1.4.tar.gz
  • Upload date:
  • Size: 13.4 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.4.tar.gz
Algorithm Hash digest
SHA256 83046b13e12ec6f977e889b329ac5c0f0e246f74de3768240eb9543a215b48d7
MD5 5347bd3e76ad7ee3bca2a35173694078
BLAKE2b-256 cf323e42f947ea2359340f1b764a1225fe612852b65e47d037f629b49cc9662c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zmp_md_translator-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a375872e6cc484b4420fa712cf99155abb1f98effe975345d420f9b52f60a60b
MD5 ee586aba86a4e979e2266d1274368f00
BLAKE2b-256 0faf9f0c83709cadaa2f5d288dfe852f21e93510864fcd9cf9393ff1361c4e05

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