# dfint/df-translation-toolkit architecture

> Architecture diagram of the GitHub repository dfint/df-translation-toolkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dfint/df-translation-toolkit
- Repository: https://github.com/dfint/df-translation-toolkit

## Overview

##### Main Components Organization
- Convert Module
- Create Mod Module
- Create POT Module
- Parse Module
- Translate Module

##### Core Components

a. Command Line Interface Layer:
- Main CLI entry point (cli.py)
- It to the five main functional modules
- Use a hexagonal architecture representation to show the CLI as the primary interface

b. Module Breakdown:
- Convert Module: Show flow from PO files to CSV files
- Create Mod Module: Template processing and mod generation flow
- Create POT Module: Multiple source inputs (raw objects, speech, steam text, string dump)
- Parse Module: Text parsing capabilities
- Translate Module: Translation processing flow

c. Utilities Layer:
- Shared utilities as a supporting layer
- Backup, CSV utils, PO utils, and string fixing utilities

##### Data Flow Representation

- Input files → Parse Module
- Parse Module → Convert Module
- Convert Module → Output files
- Template files → Create Mod Module
- Create Mod Module → Generated mods
- Source files → Create POT Module
- Create POT Module → POT files

##### Key Elements to Highlight

a. File Processing Chain:
- Transformation pipeline from input to output
- Validation checkpoints
- Backup operations

b. Utility Integration:
- How shared utilities support multiple modules
- Cross-module dependencies

##### Implementation Details

Use these specific elements:
- Double lines for main data transformation paths

## Diagram (Mermaid)

```mermaid
graph TB
    %% CLI Layer
    CLI["Command Line Interface"]:::cli
    click CLI "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/cli.py"

    %% Main Modules
    subgraph Modules
        Convert["Convert Module"]:::module
        click Convert "https://github.com/dfint/df-translation-toolkit/tree/master/df_translation_toolkit/convert/"
        CreateMod["Create Mod Module"]:::module
        click CreateMod "https://github.com/dfint/df-translation-toolkit/tree/master/df_translation_toolkit/create_mod/"
        CreatePOT["Create POT Module"]:::module
        click CreatePOT "https://github.com/dfint/df-translation-toolkit/tree/master/df_translation_toolkit/create_pot/"
        Parse["Parse Module"]:::module
        click Parse "https://github.com/dfint/df-translation-toolkit/tree/master/df_translation_toolkit/parse/"
        Translate["Translate Module"]:::module
        click Translate "https://github.com/dfint/df-translation-toolkit/tree/master/df_translation_toolkit/translate/"
    end

    %% Convert Module Components
    subgraph ConvertComponents
        PO2CSV["PO to CSV Conversion"]:::component
        click PO2CSV "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/convert/objects_po_to_csv.py"
        HardcodedConv["Hardcoded Text Conversion"]:::component
        click HardcodedConv "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/convert/hardcoded_po_to_csv.py"
    end

    %% Create Mod Components
    subgraph ModComponents
        TemplateProc["Template Processing"]:::component
        click TemplateProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_mod/from_template.py"
        TemplateGen["Template Generation"]:::component
        click TemplateGen "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_mod/template_from_vanilla.py"
        BatchProc["Batch Processing"]:::component
        click BatchProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_mod/batch.py"
    end

    %% Create POT Components
    subgraph POTComponents
        RawObjProc["Raw Objects Processing"]:::component
        click RawObjProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_pot/from_raw_objects.py"
        SpeechProc["Speech Processing"]:::component
        click SpeechProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_pot/from_speech.py"
        SteamProc["Steam Text Processing"]:::component
        click SteamProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_pot/from_steam_text.py"
        StringDumpProc["String Dump Processing"]:::component
        click StringDumpProc "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/create_pot/from_string_dump.py"
    end

    %% Parse Components
    subgraph ParseComponents
        RawParser["Raw File Parser"]:::component
        click RawParser "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/parse/parse_raws.py"
        PlainTextParser["Plain Text Parser"]:::component
        click PlainTextParser "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/parse/parse_plain_text.py"
        TextSetParser["Text Set Parser"]:::component
        click TextSetParser "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/parse/parse_text_set.py"
    end

    %% Translate Components
    subgraph TranslateComponents
        RawTrans["Raw Translation"]:::component
        click RawTrans "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/translate/translate_raws.py"
        PlainTextTrans["Plain Text Translation"]:::component
        click PlainTextTrans "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/translate/translate_plain_text.py"
    end

    %% Utilities Layer
    subgraph Utils
        Backup["Backup Utility"]:::utility
        click Backup "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/utils/backup.py"
        CSVUtils["CSV Utilities"]:::utility
        click CSVUtils "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/utils/csv_utils.py"
        POUtils["PO Utilities"]:::utility
        click POUtils "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/utils/po_utils.py"
        StringFix["String Fixing"]:::utility
        click StringFix "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/utils/fix_translated_strings.py"
    end

    %% Validation Layer
    subgraph Validation
        ValModels["Validation Models"]:::validation
        click ValModels "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/validation/validation_models.py"
        ObjValidation["Object Validation"]:::validation
        click ObjValidation "https://github.com/dfint/df-translation-toolkit/blob/master/df_translation_toolkit/validation/validate_objects.py"
    end

    %% Connections
    CLI --> Convert
    CLI --> CreateMod
    CLI --> CreatePOT
    CLI --> Parse
    CLI --> Translate

    Convert --> ConvertComponents
    CreateMod --> ModComponents
    CreatePOT --> POTComponents
    Parse --> ParseComponents
    Translate --> TranslateComponents

    Utils --> Convert
    Utils --> CreateMod
    Utils --> CreatePOT
    Utils --> Parse
    Utils --> Translate

    Validation --> Convert
    Validation --> CreateMod
    Validation --> CreatePOT

    %% Styles
    classDef cli fill:#98FB98,stroke:#333,stroke-width:2px
    classDef module fill:#B0C4DE,stroke:#333,stroke-width:2px
    classDef component fill:#FFF8DC,stroke:#333,stroke-width:1px
    classDef utility fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef validation fill:#E6E6FA,stroke:#333,stroke-width:1px

    %% Legend
    subgraph Legend
        L1["CLI Component"]:::cli
        L2["Module"]:::module
        L3["Component"]:::component
        L4["Utility"]:::utility
        L5["Validation"]:::validation
    end
```
