Skip to main content

Markdown Docs Translator

Python contributions welcome

Markdown Docs Translator is an automated translator for Markdown documents, built with Python. The tool supports multiple translation services and provides a variety of options to customize the translation process.

Features

  • Support for multiple translation services (Yandex, Google, Bing, Deepl).
  • Multithreading for faster translations.
  • Options to overwrite original files, drop original files, or create a new file with translated text.
  • Continuing translation in case of an error or interruption.
  • Caching for faster repeat translations.
  • Verbosity level control.

Installation

Note: Chrome browser is required to be installed on your system.

pipx install md-translate

Git:

git clone https://github.com/ilyachch/md_docs-trans-app.git
cd md_docs-trans-app
pip install .

Usage

Example:

md-translate path_to_file_or_folder -F source_lang -T target_lang -P service [OPTIONS]

Where:

  • path_to_file_or_folder is the path to the markdown file or folder containing markdown files to translate.
  • source_lang is the language code of the source document.
  • target_lang is the language code for the translation.
  • service is the translating service to use (yandex, google, bing, deepl).
  • OPTIONS are additional options that can be specified as listed below.

Options

Option Description
-F, --from-lang TEXT Source language code [required]
-T, --to-lang TEXT Target language code [required]
-P, --service Translating service [required]
-X, --processes INTEGER Number of processes to use. Each file is translated in separate process.
-N, --new-file Create a new file with translated text (original file will remain unchanged). The new file will be created in the same directory as the original file with a "_translated" suffix
-I, --ignore-cache Ignore cache files. If cache exists, it will be overwritten
-S, --save-temp-on-complete Save cache files upon completion. If not set, they will be deleted
-O, --overwrite Already translated files will be overwritten. Otherwise, these files will be skipped
-D, --drop-original Remove original lines from translated file. These lines will be replaced with translated ones. Otherwise translated lines will be appended after originals
--deepl-api-key Deepl API key. Required by deepl_api translation provider.
-v, --verbose Verbosity level
--help Show help message and exit

Currently supported services are:

  • Yandex
  • Google
  • Bing
  • Deepl
  • LibreTranslate
  • DeepL API

Configuring with a Configuration File

Options for the application can be defined through a configuration file as well. This file should be named settings.json and is typically located at ~/.config/md_translate.

If you choose to use a non-default location for the config file, you can specify its path using the --config or -C option.

This configuration file can encompass all CLI options except path, from_lang, to_lang, service and config_file_path. These particular options need to be stated directly in the CLI.

The configuration file should be a valid JSON file and adhere to the following structure:

{
    "processes": 4,
    "new_file": true,
    "ignore_cache": false,
    "save_temp_on_complete": false,
    "overwrite": false,
    "verbose": 1,
    "drop_original": false
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Metadata

Release files for md_translate 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md_translate 3.4.0
File Size Uploaded Provenance Actions
md_translate-3.4.0.tar.gz 17.7 kB Without provenance Details for md_translate-3.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for md_translate 3.4.0
File Interpreter ABI Platform Actions
md_translate-3.4.0-py3-none-any.whl Python 3 none any Details for md_translate-3.4.0-py3-none-any.whl

Total release size: 42.3 kB

Release files / md_translate-3.4.0.tar.gz

Download URL md_translate-3.4.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
469046e600fcfc856987cd0b6529d395873da05e43623cdd2026310e439c47ee
BLAKE2b-256 checksum
How to use checksums
e4f8d5111f3fa25fa882e034798e75f27db628bf563cd14724e896de2c0e678d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Release files / md_translate-3.4.0-py3-none-any.whl

Download URL md_translate-3.4.0-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48b9ed51b3d65e962b62b5ee68c0eab8d9aa960916c9350005a13c154c55573b
BLAKE2b-256 checksum
How to use checksums
e3c3383950645d95299b827925e2d4054c1f1708a28d1e52ea98d0fcfd6f4a9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Security for md_translate 3.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page