No project description provided
Project description
ZMP Markdown Translator
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
*_zcpsources:[target_dir]/[lang]/docusaurus-plugin-content-docs-zcp/current/ - For
*_apimsources:[target_dir]/[lang]/docusaurus-plugin-content-docs-apim/current/ - For
*_amdpsources:[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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zmp_md_translator-0.1.3.tar.gz.
File metadata
- Download URL: zmp_md_translator-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
827fa67f37f766197fe71c78832b814758c6bca141dcb2c9d2436dc445e26614
|
|
| MD5 |
9140b7d44fe5629e57dc480654a04b31
|
|
| BLAKE2b-256 |
3ac631b9dcdac385734aabffc653f0b92193b61f288d4f3d485d5f9f72844d56
|
File details
Details for the file zmp_md_translator-0.1.3-py3-none-any.whl.
File metadata
- Download URL: zmp_md_translator-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cce4d75f6b81f6f0454754bde062ca6c19a6984df60f4a09953ddef05df6bbe
|
|
| MD5 |
d5beb7569a45c9e7b50b9b9ba8624235
|
|
| BLAKE2b-256 |
5a14f57161c1bad53baf87f8568846b2d7f108ac8def79da1628dceae4efdae2
|