# patcher454/deepltranslatorpowertoys architecture

> Architecture diagram of the GitHub repository patcher454/deepltranslatorpowertoys, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patcher454/deepltranslatorpowertoys
- Repository: https://github.com/patcher454/deepltranslatorpowertoys

## Overview

##### Main Components

a. User Interface Layer:
- PowerToys Run Interface (external component)
- As the entry point with the "@@" command pattern

b. Core Plugin Components:
- Main Plugin Controller (Main.cs)
- Settings Manager (DeepLTranslatorSetting.cs)
- Input Processing (InputInterpreter.cs)
- Translation Processing (TranslationHandler.cs)

c. External Services:
- DeepL API Integration (via JobHttp.cs)

##### Component Relationships

**[PowerToys Run UI] → [Main Plugin Controller]**
- ↓
**[Input Interpreter] ← [Settings Manager]**
- ↓
**[Translation Handler]**
- ↓
**[Job HTTP Client] → [DeepL API]**

##### Specific Implementation Details

a. Data Models (Models folder):
- Translation.cs
- TranslationResult.cs
- As supporting structures

b. Configuration:
- plugin.json (plugin configuration)
- API key configuration flow

c. Language Support:
- LangCodeEnums.cs (supported languages)

##### Command Flow
- User Input (@@{lang} {text}) → Input Interpreter → Translation Handler → DeepL API

##### Settings Flow
- PowerToys Settings → Settings Manager → Translation Handler

##### Important Elements

- Input validation flow
- API authentication process
- Translation result handling
- Error handling paths
- Configuration management

Create distinct sections for:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        PTR["PowerToys Run Interface"]
    end

    subgraph Core["Plugin Core"]
        MPC["Main Plugin Controller"]:::core
        SM["Settings Manager"]:::config
        IP["Input Interpreter"]:::core
        TH["Translation Handler"]:::core
    end

    subgraph Data["Data Layer"]
        DM1["Translation Model"]:::data
        DM2["Translation Result Model"]:::data
        LC["Language Codes"]:::data
        PC["Plugin Config"]:::config
    end

    subgraph External["External Services"]
        JH["Job HTTP Client"]:::service
        API["DeepL API"]:::external
    end

    %% Relationships
    PTR -->|"@@ command"| MPC
    MPC --> IP
    MPC --> SM
    IP --> TH
    SM --> TH
    TH --> JH
    JH --> API
    
    %% Data relationships
    DM1 -.-> TH
    DM2 -.-> TH
    LC -.-> IP
    PC -.-> SM

    %% Click events
    click MPC "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/Main.cs"
    click SM "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/DeepLTranslatorSetting.cs"
    click IP "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/InputInterpreter.cs"
    click TH "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/TranslationHandler.cs"
    click JH "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/Job/JobHttp.cs"
    click DM1 "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/Models/Translation.cs"
    click DM2 "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/Models/TranslationResult.cs"
    click LC "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/Enums/LangCodeEnums.cs"
    click PC "https://github.com/patcher454/DeepLTranslatorPowerToys/blob/main/plugin.json"

    %% Styling
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef config fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef data fill:#B0C4DE,stroke:#333,stroke-width:2px
    classDef service fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef external fill:#FA8072,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Configuration"]:::config
        L3["Data Models"]:::data
        L4["Services"]:::service
        L5["External APIs"]:::external
    end
```
