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.2.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.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zmp_md_translator-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 73ab9706b4e9830ab5dc250d74246a038592c6857a41e7ebea2d5cba6bd35d82
MD5 25b60c6e48e1d0d714c4280db779e428
BLAKE2b-256 40107a24ca03ed7518c40e7448426c410a6cbd74570ce0bfd710ff9f2f276cf1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zmp_md_translator-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c311d41cf1ee1ec7798cf8083bb44763c118f0bdbde9d13709451af56697c1
MD5 c136c76d9f9efc519d99e76fe5f57205
BLAKE2b-256 358a6acb609dc228307a3767806d434199dffb714cea925c93e14c07af37f8e5

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