{"id":23392688,"url":"https://github.com/tombreit/mkdocs-translate-plugin","last_synced_at":"2025-04-08T15:41:30.789Z","repository":{"id":269201998,"uuid":"906705654","full_name":"tombreit/mkdocs-translate-plugin","owner":"tombreit","description":"MkDocs plugin that does the translation of your markdown pages for you","archived":false,"fork":false,"pushed_at":"2025-03-10T10:07:59.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T11:24:24.665Z","etag":null,"topics":["mkdocs","mkdocs-plugin","translation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tombreit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tombreit"}},"created_at":"2024-12-21T17:00:56.000Z","updated_at":"2025-03-10T10:08:03.000Z","dependencies_parsed_at":"2024-12-21T18:28:32.946Z","dependency_job_id":"da1dfa2a-f8ba-4817-a150-c93d81c49fee","html_url":"https://github.com/tombreit/mkdocs-translate-plugin","commit_stats":null,"previous_names":["tombreit/mkdocs-translate-plugin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombreit%2Fmkdocs-translate-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombreit%2Fmkdocs-translate-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombreit%2Fmkdocs-translate-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombreit%2Fmkdocs-translate-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tombreit","download_url":"https://codeload.github.com/tombreit/mkdocs-translate-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247873390,"owners_count":21010447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mkdocs","mkdocs-plugin","translation"],"created_at":"2024-12-22T05:14:50.666Z","updated_at":"2025-04-08T15:41:30.768Z","avatar_url":"https://github.com/tombreit.png","language":"Python","funding_links":["https://github.com/sponsors/tombreit"],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2024 Thomas Breitner\n\nSPDX-License-Identifier: MIT\n--\u003e\n\n# mkdocs-translate-plugin\n\nWrote something in MkDocs and realised that nobody understands it?  \n*Maybe a translation would help.*\n\nDon't feel like translating?  \n*Let this plugin do it for you.*\n\nI don't get it: What does this plugin do?  \n*This plugin does the same as if you had hired someone to translate your markdown files: find the original markdown file, translate the content - possibly into several languages - create translation file(s) with the correct file name and save the translated markdown content to that file.*  \n*The actual translation is done by one of the configured (external) translation services.*  \n*This plugin does its work before MkDocs starts converting the markdown files to HTML files. You can therefore easily view and edit the results of this plugin locally via `mkdocs serve`.*  \n*To be fair: If you hire a translater with some markdown knowledge, you could get better results.*\n\n**🔥 This is work in progress - no liability for nothing.**\n\n## Features\n\n- Translates the markdown files in your MkDocs project from your primary language into your desired target languages\n- Processes `.md` files, eg:  `\u003cfilename\u003e.en.md` → `\u003cfilename\u003e.\u003clanguage\u003e.md`\n- Supports **DeepL**, **Academiccloud.de / LLama** and **Simpleen**\n- Creates a translation only if it does not yet exist\n- Tries - and often fails - to preserve the original markdown formatting. If you have any idea how I can improve this, please let me know.\n- Runs only on the MkDocs `build` command so as not to waste your translation provider/service API contingent\n- Get some verbose info by running `mkdocs --verbose build`\n- tbc\n\n## Install\n\n*Currently only available via it's git repository.*\n\n```bash\n# Initial install:\npython -m pip install \\\n  'mkdocs-translate-plugin @ git+https://github.com/tombreit/mkdocs-translate-plugin'\n\n# Upgrade plugin:\npython -m pip install \\\n  --upgrade --no-deps --force-reinstall \\\n  'mkdocs-translate-plugin @ git+https://github.com/tombreit/mkdocs-translate-plugin'\n```\n\nThis should install some requirements. See [`pyproject.toml`](https://github.com/tombreit/mkdocs-translate-plugin/blob/main/pyproject.toml) for details.\n\n## Configuration\n\n- Activate the `i18n` plugin\n- Set the languages for your project in [`mkdocs.yml`](https://github.com/tombreit/mkdocs-translate-plugin/blob/main/mkdocs.yml)\n- Your primary/source language markdown files must be named like `\u003cfilename\u003e.\u003clanguagecode\u003e.md`, eg: `setup.en.md`\n- Set your primary/source language in your `mkdocs.yml` via `default: True` attribute:\n\n    ```yml\n    plugins:\n      - i18n:\n          docs_structure: suffix\n          languages:\n            - locale: en\n              default: true\n              name: English\n              build: true\n            - locale: de\n              name: Deutsch\n              build: true\n    ```\n\n- Set the translation service in `mkdocs.yml`:\n\n    ```yml\n      plugins:\n        - translate:\n          # Currently supported translation services: chatai, deepl, simpleen\n          translation_service: chatai\n          translation_service_api_key: !ENV TRANSLATION_SERVICE_API_KEY\n    ```\n\n- Provide the API key as an environment variable, eg: `export TRANSLATION_SERVICE_API_KEY=secret`\n\n## Behind the scenes\n\n- Uses - obviously - [MkDocs](https://www.mkdocs.org/)\n- Uses [mkdocs-static-i18n](https://ultrabug.github.io/mkdocs-static-i18n/) to \"compile\" different languages\n- Uses [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) to provide a theme with a language switcher\n\n## Try it\n\n1. Setup plugin and demo project locally\n\n    ```bash\n    git clone git@github.com:tombreit/mkdocs-translate-plugin.git\n    cd mkdocs-translate-plugin\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip install  --editable .\n    ```\n\n1. Get an API key for a supported translation provider:\n    - [Simpleen (Free Plan) API key](https://simpleen.io/signup)\n    - [DeepL API](https://www.deepl.com/en/pro#developer)\n    - [Academic Cloud AI chatbot](https://academiccloud.de/services/chatai/)\n\n1. Export the API key as an environment variable and set corresponding translation provider (see Configuration section above):\n\n    ```sh\n    export TRANSLATION_SERVICE_API_KEY=secret\n    ```\n\n1. Validate current EN-only docs\n\n    ```bash\n    $ tree docs/\n    docs/\n    ├── index.en.md\n    └── uptimekuma.en.md\n    \n    1 directory, 2 files\n    ```\n\n1. Let this plugin do it's work\n\n    ```bash\n    mkdocs build\n    ```\n\n1. Validate created translations exists\n\n    ```bash\n    $ tree docs/\n    docs/\n    ├── index.de.md\n    ├── index.en.md\n    ├── uptimekuma.de.md\n    └── uptimekuma.en.md\n    \n    1 directory, 4 files\n    ```\n\n1. Enjoy your translated MkDocs project\n\n    ```bash\n    mkdocs serve\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombreit%2Fmkdocs-translate-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftombreit%2Fmkdocs-translate-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombreit%2Fmkdocs-translate-plugin/lists"}