# jotapardo/sharedjsfilestranslatortool architecture

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

- Interactive diagram: https://gitdiagram.com/jotapardo/sharedjsfilestranslatortool
- Repository: https://github.com/jotapardo/sharedjsfilestranslatortool

## Overview

##### Project type and purpose
- This is a Windows desktop utility (not a web app) that automates the creation, translation, and sorting of resource entries in shared.js/.resx files for a VueJS project. It is a standalone “open-source tool” with a GUI front end and an integration to the Azure Translator service.

##### File structure
- A Windows UI project (likely C#/WPF or WinForms) called `Resources.Shared.Files`
- A `Configuration` module that manages the i18n/lang folder path
- A `Translation` module that batches calls to Azure Services
- A `Sorting` module that alphabetizes the resource files
- A version-checker that polls the official site for updates
- Generated output: JS or RESX resource files in `i18n/lang/<lang>`

##### README for additional insights
- Key flows described:
- On startup, the app checks for updates
- The user sets the target directory (`i18n/lang`) in Configuration
- The user switches to Translation view, enters English texts, picks target languages, optionally edits the PascalCase keys, and clicks TRANSLATE
- The tool calls Azure Translator (external REST API), receives translations for ES, PT, DE, FR, and writes/merges them into the resource files
- The user can then go to Sorting to alphabetize the entries

a. UI Layer (“Resources.Shared.Files” application)
- Sub-components / views:
- Configuration View
- Translation View
- Sorting View
- Version-Checker module (background)
b. Application Logic Layer
- Configuration Manager (reads/writes the selected folder path)
- File I/O Manager (loads, parses, and writes `.js`/.resx files)
- Translation Manager (prepares batch requests, coordinates Azure calls)
- Sorting Manager (sorts resource keys)
c. External Services
- Azure Translator Cognitive Service (REST API)
- Official update server (HTTP endpoint for version info)
d. File System
- `i18n/lang` folder
- Sub-folders per language (es/, pt/, de/, fr/)
- Resource files: `.js` or `.resx`

##### Architectural patterns & design principles
- Single Process, Modular GUI: The Windows app is the single host, with distinct modules for configuration, translation, and sorting.
- Layered approach: UI → Business Logic → File I/O → External Services
- Separation of Concerns:
- Each feature has its own manager/class
- External calls abstracted behind a Translation Manager interface
- Dependency Injection (likely used for swappable translation services)

##### Summary of what
- Components: Configuration, Translation, Sorting, Version Checker
- File System: `i18n/lang` folder structure
- External Services: Azure Translator and Update Server

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Windows Desktop Application"
        direction TB
        ConfigView["Configuration View"] 
        TransView["Translation View"]
        SortView["Sorting View"]
        VersionChecker["Version Checker"]
        ConfigManager["Configuration Manager"]
        FileIO["File I/O Manager"]
        TransManager["Translation Manager"]
        SortManager["Sorting Manager"]
    end

    subgraph "File System" 
        direction TB
        FS["i18n/lang\n(es/, pt/, de/, fr/ folders)\n.js/.resx files"] 
    end

    subgraph "External Services"
        direction TB
        Azure["Azure Translator Service"] 
        UpdateServer["Official Update Server"]
    end

    %% Connections
    ConfigView -->|"set folder path"| ConfigManager
    ConfigManager -->|"read/write config"| FS
    TransView -->|"enter texts & languages"| TransManager
    TransManager -->|"POST BatchTranslate"| Azure
    Azure -->|"translations JSON"| TransManager
    TransManager -->|"prepare writes"| FileIO
    FileIO -->|"write .js/.resx files"| FS
    SortView -->|"request sort"| SortManager
    SortManager -->|"read/write files"| FS
    VersionChecker -->|"HTTP GET version"| UpdateServer

    %% Legend
    subgraph "Legend"
        direction TB
        A["Internal Module"]:::internal
        B["File System"]:::fs
        C["External Service"]:::external
    end

    %% Classes
    class ConfigView,TransView,SortView,VersionChecker,ConfigManager,FileIO,TransManager,SortManager internal
    class FS fs
    class Azure,UpdateServer external

    classDef internal fill:#BBDEFB,stroke:#1E88E5;
    classDef fs fill:#C8E6C9,stroke:#388E3C;
    classDef external fill:#ECEFF1,stroke:#90A4AE;
```
