# meangrinch/mangatranslator architecture

> Architecture diagram of the GitHub repository meangrinch/mangatranslator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meangrinch/mangatranslator
- Repository: https://github.com/meangrinch/mangatranslator

## Overview

MangaTranslator is a manga/comic image translation application with Web UI and CLI entry points. Users provide pages or batches, configure languages and translation/model options, and receive cleaned, translated, typeset images. The documented processing covers speech-bubble and outside-text detection, OCR, inpainting, LLM translation, rendering, and optional upscaling. The pipeline is the central orchestrator. Relationships below are limited to README statements and SOURCE INDEX references; unsampled implementation details are not assumed.

Main entry points: [`core/pipeline.py`](https://github.com/meangrinch/mangatranslator/blob/main/core/pipeline.py) (Translation pipeline), [`main.py`](https://github.com/meangrinch/mangatranslator/blob/main/main.py) (CLI), [`ui/logic.py`](https://github.com/meangrinch/mangatranslator/blob/main/ui/logic.py) (UI actions), [`core/batch_coordinator.py`](https://github.com/meangrinch/mangatranslator/blob/main/core/batch_coordinator.py) (Batch coordination)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_webui["Web UI<br/>[layout.py]"]
  node_cli["CLI<br/>[main.py]"]
  node_ui_logic["UI actions<br/>[logic.py]"]
end

subgraph group_workflow["Image workflow"]
  node_batch["Batch coordination"]
  node_pipeline["Translation pipeline<br/>[pipeline.py]"]
  node_detection["Text detection<br/>[detection.py]"]
  node_ocr["OCR<br/>[ocr_detection.py]"]
  node_outside["Outside text"]
  node_cleaning["Image cleaning<br/>[cleaning.py]"]
  node_inpainting["Inpainting<br/>[inpainting.py]"]
  node_translation["Text translation<br/>[translation.py]"]
  node_rendering["Text rendering<br/>[text_renderer.py]"]
  node_upscaling["Image upscaling<br/>[scaling.py]"]
  node_result["Translated images"]
end

subgraph group_services["Models and services"]
  node_models["Model manager<br/>[model_manager.py]"]
  node_providers["LLM providers"]
end

subgraph group_support["Configuration and support"]
  node_config["Processing config<br/>[config.py]"]
  node_settings["Saved settings"]
  node_cache["Processing cache<br/>[caching.py]"]
end

node_user(("User"))

node_user -->|"uploads pages"| node_webui
node_user -->|"supplies input"| node_cli
node_webui -->|"starts translation"| node_ui_logic
node_ui_logic -->|"runs pipeline"| node_pipeline
node_cli -->|"runs pipeline"| node_pipeline
node_ui_logic -.->|"coordinates batches"| node_batch
node_pipeline -->|"coordinates batches"| node_batch
node_pipeline -->|"detects text"| node_detection
node_pipeline -.->|"uses OCR"| node_ocr
node_pipeline -->|"processes outside text"| node_outside
node_pipeline -->|"cleans regions"| node_cleaning
node_cleaning -->|"uses inpainting"| node_inpainting
node_pipeline -->|"translates text"| node_translation
node_translation -->|"dispatches requests"| node_providers
node_pipeline -->|"renders translations"| node_rendering
node_pipeline -->|"upscales images"| node_upscaling
node_detection -->|"loads models"| node_models
node_inpainting -->|"loads models"| node_models
node_outside -->|"uses OCR"| node_ocr
node_pipeline -->|"uses cache"| node_cache
node_pipeline -->|"uses settings"| node_config
node_settings -->|"validates settings"| node_config
node_pipeline -->|"produces images"| node_result
node_cli -->|"processes archives"| node_batch

click node_webui "https://github.com/meangrinch/mangatranslator/blob/main/ui/layout.py"
click node_cli "https://github.com/meangrinch/mangatranslator/blob/main/main.py"
click node_ui_logic "https://github.com/meangrinch/mangatranslator/blob/main/ui/logic.py"
click node_batch "https://github.com/meangrinch/mangatranslator/blob/main/core/batch_coordinator.py"
click node_pipeline "https://github.com/meangrinch/mangatranslator/blob/main/core/pipeline.py"
click node_detection "https://github.com/meangrinch/mangatranslator/blob/main/core/image/detection.py"
click node_ocr "https://github.com/meangrinch/mangatranslator/blob/main/core/image/ocr_detection.py"
click node_outside "https://github.com/meangrinch/mangatranslator/blob/main/core/outside_text_processor.py"
click node_cleaning "https://github.com/meangrinch/mangatranslator/blob/main/core/image/cleaning.py"
click node_inpainting "https://github.com/meangrinch/mangatranslator/blob/main/core/image/inpainting.py"
click node_translation "https://github.com/meangrinch/mangatranslator/blob/main/core/services/translation.py"
click node_rendering "https://github.com/meangrinch/mangatranslator/blob/main/core/text/text_renderer.py"
click node_upscaling "https://github.com/meangrinch/mangatranslator/blob/main/core/scaling.py"
click node_models "https://github.com/meangrinch/mangatranslator/blob/main/core/ml/model_manager.py"
click node_providers "https://github.com/meangrinch/mangatranslator/tree/main/utils/endpoints"
click node_config "https://github.com/meangrinch/mangatranslator/blob/main/core/config.py"
click node_settings "https://github.com/meangrinch/mangatranslator/blob/main/ui/settings_manager.py"
click node_cache "https://github.com/meangrinch/mangatranslator/blob/main/core/caching.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_cli,node_ui_logic,node_user toneBlue
class node_batch,node_pipeline,node_detection,node_ocr,node_outside,node_cleaning,node_inpainting,node_translation,node_rendering,node_upscaling,node_result toneAmber
class node_models,node_providers toneMint
class node_config,node_settings,node_cache toneRose
```

## Components

### User interfaces

- [Web UI](https://github.com/meangrinch/mangatranslator/blob/main/ui/layout.py): `ui/layout.py`
- [CLI](https://github.com/meangrinch/mangatranslator/blob/main/main.py): `main.py`
- [UI actions](https://github.com/meangrinch/mangatranslator/blob/main/ui/logic.py): `ui/logic.py`

### Image workflow

- [Batch coordination](https://github.com/meangrinch/mangatranslator/blob/main/core/batch_coordinator.py): `core/batch_coordinator.py`
- [Translation pipeline](https://github.com/meangrinch/mangatranslator/blob/main/core/pipeline.py): `core/pipeline.py`
- [Text detection](https://github.com/meangrinch/mangatranslator/blob/main/core/image/detection.py): `core/image/detection.py`
- [OCR](https://github.com/meangrinch/mangatranslator/blob/main/core/image/ocr_detection.py): `core/image/ocr_detection.py`
- [Outside text](https://github.com/meangrinch/mangatranslator/blob/main/core/outside_text_processor.py): `core/outside_text_processor.py`
- [Image cleaning](https://github.com/meangrinch/mangatranslator/blob/main/core/image/cleaning.py): `core/image/cleaning.py`
- [Inpainting](https://github.com/meangrinch/mangatranslator/blob/main/core/image/inpainting.py): `core/image/inpainting.py`
- [Text translation](https://github.com/meangrinch/mangatranslator/blob/main/core/services/translation.py): `core/services/translation.py`
- [Text rendering](https://github.com/meangrinch/mangatranslator/blob/main/core/text/text_renderer.py): `core/text/text_renderer.py`
- [Image upscaling](https://github.com/meangrinch/mangatranslator/blob/main/core/scaling.py): `core/scaling.py`
- **Translated images**

### Models and services

- [Model manager](https://github.com/meangrinch/mangatranslator/blob/main/core/ml/model_manager.py): `core/ml/model_manager.py`
- [LLM providers](https://github.com/meangrinch/mangatranslator/tree/main/utils/endpoints): `utils/endpoints`

### Configuration and support

- [Processing config](https://github.com/meangrinch/mangatranslator/blob/main/core/config.py): `core/config.py`
- [Saved settings](https://github.com/meangrinch/mangatranslator/blob/main/ui/settings_manager.py): `ui/settings_manager.py`
- [Processing cache](https://github.com/meangrinch/mangatranslator/blob/main/core/caching.py): `core/caching.py`

### Other components

- **User**

## Connections

- User → Web UI: uploads pages (evidence: `README.md`)
- User → CLI: supplies input (evidence: `README.md`)
- Web UI → UI actions: starts translation (evidence: `ui/layout.py`)
- UI actions → Translation pipeline: runs pipeline (evidence: `ui/logic.py`)
- CLI → Translation pipeline: runs pipeline (evidence: `main.py`)
- UI actions → Batch coordination: coordinates batches
- Translation pipeline → Batch coordination: coordinates batches (evidence: `core/pipeline.py`)
- Translation pipeline → Text detection: detects text (evidence: `core/pipeline.py`)
- Translation pipeline → OCR: uses OCR
- Translation pipeline → Outside text: processes outside text (evidence: `core/pipeline.py`)
- Translation pipeline → Image cleaning: cleans regions (evidence: `core/pipeline.py`)
- Image cleaning → Inpainting: uses inpainting (evidence: `core/image/cleaning.py`)
- Translation pipeline → Text translation: translates text (evidence: `core/pipeline.py`)
- Text translation → LLM providers: dispatches requests (evidence: `core/services/translation.py`)
- Translation pipeline → Text rendering: renders translations (evidence: `core/pipeline.py`)
- Translation pipeline → Image upscaling: upscales images (evidence: `core/pipeline.py`)
- Text detection → Model manager: loads models (evidence: `core/image/detection.py`)
- Inpainting → Model manager: loads models (evidence: `core/image/inpainting.py`)
- Outside text → OCR: uses OCR (evidence: `core/outside_text_processor.py`)
- Translation pipeline → Processing cache: uses cache (evidence: `core/pipeline.py`)
- Translation pipeline → Processing config: uses settings (evidence: `core/pipeline.py`)
- Saved settings → Processing config: validates settings (evidence: `ui/settings_manager.py`)
- Translation pipeline → Translated images: produces images (evidence: `README.md`)
- CLI → Batch coordination: processes archives (evidence: `main.py`)
