# stratopedia/ai-translation-engine architecture

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

- Interactive diagram: https://gitdiagram.com/stratopedia/ai-translation-engine
- Repository: https://github.com/stratopedia/ai-translation-engine

## Overview

This desktop code editor lets a user write code in a language tab, translate it into the other supported languages with Gemini, or run the active tab in a temporary workspace. The GUI coordinates translation and execution on background threads and displays logs in its console. The graph separates the UI, translation service, and execution sandbox; compiler/runtime tools and Gemini are external dependencies. Relationships reflect the sampled source and README; no additional internal stages are inferred.

Main entry points: [`gui.py`](https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py) (Language workspaces), [`runner.py`](https://github.com/stratopedia/ai-translation-engine/blob/main/runner.py) (Sandbox runner), [`ai_engine.py`](https://github.com/stratopedia/ai-translation-engine/blob/main/ai_engine.py) (AI translation engine), [`main.py`](https://github.com/stratopedia/ai-translation-engine/blob/main/main.py) (App launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_launcher["App launcher<br/>[main.py]"]
  node_editor["Language workspaces<br/>[gui.py]"]
  node_translation_controls["Translation workflow<br/>[gui.py]"]
  node_execution_controls["Execution workflow<br/>[gui.py]"]
  node_console["Live output console<br/>[gui.py]"]
end

subgraph group_translation["AI translation"]
  node_ai_engine["AI translation engine<br/>[ai_engine.py]"]
  node_code_cleanup["Code fence cleanup<br/>[ai_engine.py]"]
end

subgraph group_execution["Code execution"]
  node_runner["Sandbox runner<br/>[runner.py]"]
  node_workspace["Temporary workspace<br/>[runner.py]"]
end

subgraph group_external["External services"]
  node_gemini["Gemini API"]
  node_toolchains["Language toolchains"]
end

node_user(("Engineer"))

node_user -->|"launches"| node_launcher
node_launcher -->|"creates"| node_editor
node_user -->|"edits code"| node_editor
node_editor -->|"starts translation"| node_translation_controls
node_translation_controls -->|"requests translations"| node_ai_engine
node_ai_engine -->|"requests code"| node_gemini
node_ai_engine -->|"cleans response"| node_code_cleanup
node_translation_controls -->|"updates tabs"| node_editor
node_translation_controls -->|"reports status"| node_console
node_editor -->|"selects active code"| node_execution_controls
node_execution_controls -->|"executes code"| node_runner
node_runner -->|"writes code"| node_workspace
node_runner -->|"compiles and runs"| node_toolchains
node_runner -->|"sends logs"| node_console

click node_launcher "https://github.com/stratopedia/ai-translation-engine/blob/main/main.py"
click node_editor "https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py"
click node_translation_controls "https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py"
click node_execution_controls "https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py"
click node_console "https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py"
click node_ai_engine "https://github.com/stratopedia/ai-translation-engine/blob/main/ai_engine.py"
click node_code_cleanup "https://github.com/stratopedia/ai-translation-engine/blob/main/ai_engine.py"
click node_runner "https://github.com/stratopedia/ai-translation-engine/blob/main/runner.py"
click node_workspace "https://github.com/stratopedia/ai-translation-engine/blob/main/runner.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_launcher,node_editor,node_translation_controls,node_execution_controls,node_console toneBlue
class node_ai_engine,node_code_cleanup toneAmber
class node_runner,node_workspace toneMint
class node_gemini,node_toolchains toneRose
class node_user toneIndigo
```

## Components

### Desktop interface

- [App launcher](https://github.com/stratopedia/ai-translation-engine/blob/main/main.py): `main.py`
- [Language workspaces](https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py): `gui.py`
- [Translation workflow](https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py): `gui.py`
- [Execution workflow](https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py): `gui.py`
- [Live output console](https://github.com/stratopedia/ai-translation-engine/blob/main/gui.py): `gui.py`

### AI translation

- [AI translation engine](https://github.com/stratopedia/ai-translation-engine/blob/main/ai_engine.py): `ai_engine.py`
- [Code fence cleanup](https://github.com/stratopedia/ai-translation-engine/blob/main/ai_engine.py): `ai_engine.py`

### Code execution

- [Sandbox runner](https://github.com/stratopedia/ai-translation-engine/blob/main/runner.py): `runner.py`
- [Temporary workspace](https://github.com/stratopedia/ai-translation-engine/blob/main/runner.py): `runner.py`

### External services

- **Gemini API**
- **Language toolchains**

### Other components

- **Engineer**

## Connections

- Engineer → App launcher: launches (evidence: `readme.md`)
- App launcher → Language workspaces: creates (evidence: `main.py`)
- Engineer → Language workspaces: edits code (evidence: `readme.md`)
- Language workspaces → Translation workflow: starts translation (evidence: `gui.py`)
- Translation workflow → AI translation engine: requests translations (evidence: `gui.py`)
- AI translation engine → Gemini API: requests code (evidence: `ai_engine.py`)
- AI translation engine → Code fence cleanup: cleans response (evidence: `ai_engine.py`)
- Translation workflow → Language workspaces: updates tabs (evidence: `gui.py`)
- Translation workflow → Live output console: reports status (evidence: `gui.py`)
- Language workspaces → Execution workflow: selects active code (evidence: `gui.py`)
- Execution workflow → Sandbox runner: executes code (evidence: `gui.py`)
- Sandbox runner → Temporary workspace: writes code (evidence: `runner.py`)
- Sandbox runner → Language toolchains: compiles and runs (evidence: `runner.py`)
- Sandbox runner → Live output console: sends logs (evidence: `gui.py`)
