# knoema/localization architecture

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

- Interactive diagram: https://gitdiagram.com/knoema/localization
- Repository: https://github.com/knoema/localization

## Overview

##### Main Components Identification
The system should be represented as three main layers/components, as evidenced by the project structure:

a. Core Layer (Core/)
- Represents the foundation of the localization system
- Contains interfaces and base classes
- Houses resource files and core functionality

b. EF Provider Layer (EFProvider/)
- Handles data persistence
- Implements Entity Framework integration
- Manages localization caching

c. MVC Integration Layer (Mvc/)
- Provides MVC-specific functionality
- Handles HTTP requests and routing
- Manages view localization

##### Component Relationships

**[Client Browser] ←→ [MVC Application]**
- ↑               ↑

**[Localization JavaScript] [MVC Integration Layer]**
- ↑
- [Core Layer]
- ↑
- [EF Provider Layer]
- ↑
- [Database]

##### Detailed Component Breakdown

Client Side (Blue):
- Browser UI
- jQuery Localization Plugin
- Admin Interface for translations

MVC Integration (Green):
- LocalizedWebViewPage
- ValidationLocalizer
- MetadataLocalizer
- LocalizationHandler
- LocalizationHttpModule

Core Components (Yellow):
- ILocalizationProvider
- LocalizationManagerBase
- LocalizedAttribute
- Resource Management

Data Layer (Red):
- LocalizationContext
- LocalizationCache
- Entity Framework Provider
- Database Storage

##### Important Flows to Highlight

a. Runtime Translation Flow:
- Client Request → LocalizationHttpModule → LocalizationManager → Provider → Cache/Database
- Response with translated content

b. Admin Management Flow:
- Admin UI → LocalizationHandler → Provider → Database
- Import/Export functionality

##### Additional Elements

- Component types (Core, MVC, Client, Data)
- Special symbols for caching and extension points
- Admin vs. Regular user paths

##### Notes for Implementation Details

Callouts showing:
- Configuration requirements (web.config, Global.asax)
- Extension points for custom providers
- Integration with Entity Framework
- JavaScript localization mechanism

Remember to include version compatibility information and third-party dependencies (Entity Framework, jQuery) as supporting documentation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        Browser["Browser UI"]:::client
        JQuery["jQuery Plugin"]:::client
        AdminUI["Admin Interface"]:::client
    end

    subgraph MVCLayer["MVC Integration Layer"]
        LocalWebView["LocalizedWebViewPage"]:::mvc
        ValidLocal["ValidationLocalizer"]:::mvc
        MetaLocal["MetadataLocalizer"]:::mvc
        LocalHandler["LocalizationHandler"]:::mvc
        LocalModule["LocalizationHttpModule"]:::mvc
        LocalManager["LocalizationManager"]:::mvc
    end

    subgraph CoreLayer["Core Layer"]
        ILocProvider["ILocalizationProvider"]:::core
        LocalManagerBase["LocalizationManagerBase"]:::core
        LocalAttr["LocalizedAttribute"]:::core
        Resources["Resource Management"]:::core
        ILocalObj["ILocalizedObject"]:::core
    end

    subgraph DataLayer["Data Layer"]
        EFProvider["Entity Framework Provider"]:::data
        LocalContext["LocalizationContext"]:::data
        LocalCache["LocalizationCache"]:::data
        Database[(Database)]:::data
        LocalObj["LocalizedObject"]:::data
    end

    %% Relationships
    Browser --> JQuery
    Browser --> AdminUI
    
    JQuery --> LocalHandler
    AdminUI --> LocalHandler
    
    LocalModule --> LocalManager
    LocalWebView --> LocalManager
    ValidLocal --> LocalManager
    MetaLocal --> LocalManager
    
    LocalManager --> LocalManagerBase
    LocalManagerBase --> ILocProvider
    LocalManagerBase --> Resources
    
    EFProvider --> LocalContext
    EFProvider --> LocalCache
    LocalContext --> Database
    
    ILocalObj --> LocalObj
    
    %% Click Events
    click JQuery "https://github.com/Knoema/Localization/blob/master/Core/Resources/Js/jquery-localize.js"
    click AdminUI "https://github.com/Knoema/Localization/blob/master/Core/Resources/Html/translations.html"
    click LocalWebView "https://github.com/Knoema/Localization/blob/master/Mvc/Mvc/LocalizedWebViewPage.cs"
    click ValidLocal "https://github.com/Knoema/Localization/blob/master/Mvc/Mvc/ValidationLocalizer.cs"
    click MetaLocal "https://github.com/Knoema/Localization/blob/master/Mvc/Mvc/MetadataLocalizer.cs"
    click LocalHandler "https://github.com/Knoema/Localization/blob/master/Mvc/Web/LocalizationHandler.cs"
    click LocalModule "https://github.com/Knoema/Localization/blob/master/Mvc/Web/LocalizationHttpModule.cs"
    click LocalManager "https://github.com/Knoema/Localization/blob/master/Mvc/LocalizationManager.cs"
    click ILocProvider "https://github.com/Knoema/Localization/blob/master/Core/ILocalizationProvider.cs"
    click LocalManagerBase "https://github.com/Knoema/Localization/blob/master/Core/LocalizationManagerBase.cs"
    click LocalAttr "https://github.com/Knoema/Localization/blob/master/Core/LocalizedAttribute.cs"
    click Resources "https://github.com/Knoema/Localization/tree/master/Core/Resources/"
    click ILocalObj "https://github.com/Knoema/Localization/blob/master/Core/Repository/ILocalizedObject.cs"
    click EFProvider "https://github.com/Knoema/Localization/blob/master/EFProvider/LocalizationProvider.cs"
    click LocalContext "https://github.com/Knoema/Localization/blob/master/EFProvider/LocalizationContext.cs"
    click LocalCache "https://github.com/Knoema/Localization/blob/master/EFProvider/LocalizationCache.cs"
    click LocalObj "https://github.com/Knoema/Localization/blob/master/EFProvider/LocalizedObject.cs"

    %% Styles
    classDef client fill:#2374ab
    classDef mvc fill:#57a773
    classDef core fill:#ffc857
    classDef data fill:#ed474a
    
    %% Legend
    subgraph Legend
        ClientComp["Client Component"]:::client
        MVCComp["MVC Component"]:::mvc
        CoreComp["Core Component"]:::core
        DataComp["Data Component"]:::data
    end
```
