# kashif400/app-localization architecture

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

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

## Overview

##### Project Type Analysis
This is a Flutter mobile application focused on implementing internationalization (i18n) and localization (l10n) functionality. It's a cross-platform project supporting Android, iOS, web, Windows, Linux, and macOS.

A. Core Components:
##### Application Layer
- Main App Container
- Language Change Controller (Provider-based state management)
- Home View

##### Localization Layer
- ARB Files Repository
- Generated Localizations
- Flutter Intl Package Integration

##### Platform-Specific Layers
- Native Platform Bridges
- Platform-Specific Configurations

B. Data Flow Components:
##### Storage Layer
- SharedPreferences (for language persistence)
##### State Management
- Provider Pattern Implementation

**┌─────────────────────────────────────────────┐**
- Flutter App                    │
- ┌─────────────────┐    ┌────────────────┐  │
- UI Layer      │    │  Controller    │  │
- (Home View)     │◄─►│    Layer       │  │
- ┘    └────────────────┘  │
- ▲                      ▲           │

- ┌─────────────────┐    ┌────────────────┐  │
- Localization   │    │    Storage     │  │
- Layer       │◄─►│     Layer      │  │
- ┘    └────────────────┘  │
- ┘

##### Notes Section
Important notes about:
- Generated files handling
- Platform-specific configurations
- Build process requirements

Remember to emphasize the central role of the localization system and how it integrates with Flutter's built-in internationalization support while maintaining a clean separation of concerns between UI, business logic, and data layers.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Flutter App"
        subgraph "UI Layer"
            HomeView["Home View"]
            LangSelect["Language Selection Interface"]
            LocalText["Localized Text Display"]
        end

        subgraph "Controller Layer"
            LangController["Language Change Controller"]
            ProviderState["Provider State Management"]
            LocalDelegate["Localization Delegates"]
        end

        subgraph "Localization Layer"
            ARBFiles["ARB Files Repository"]
            GenLoc["Generated Localizations"]
            L10nConfig["l10n.yaml Config"]
            subgraph "Language Files"
                EN["English (en)"]
                ES["Spanish (es)"]
                UR["Urdu (ur)"]
            end
        end

        subgraph "Storage Layer"
            SharedPrefs["SharedPreferences"]
            LangStorage["Language Preference Storage"]
        end

        subgraph "Platform Layer"
            Android["Android"]
            IOS["iOS"]
            Web["Web"]
            Windows["Windows"]
            Linux["Linux"]
            MacOS["MacOS"]
        end

        MainApp["Main App Container"]
    end

    %% Relationships
    MainApp --> HomeView
    MainApp --> LangController
    HomeView --> LangSelect
    HomeView --> LocalText
    LangController --> ProviderState
    LangController --> LocalDelegate
    LocalDelegate --> ARBFiles
    ARBFiles --> GenLoc
    L10nConfig --> GenLoc
    ARBFiles --> EN
    ARBFiles --> ES
    ARBFiles --> UR
    LangController --> SharedPrefs
    SharedPrefs --> LangStorage

    %% Platform connections
    MainApp --> Android
    MainApp --> IOS
    MainApp --> Web
    MainApp --> Windows
    MainApp --> Linux
    MainApp --> MacOS

    %% Styling
    classDef ui fill:#a8d1f0
    classDef controller fill:#90EE90
    classDef localization fill:#FFE5B4
    classDef storage fill:#DDA0DD
    classDef platform fill:#D3D3D3

    class HomeView,LangSelect,LocalText ui
    class LangController,ProviderState,LocalDelegate controller
    class ARBFiles,GenLoc,L10nConfig,EN,ES,UR localization
    class SharedPrefs,LangStorage storage
    class Android,IOS,Web,Windows,Linux,MacOS platform

    %% Click events
    click MainApp "https://github.com/Kashif400/app-localization/blob/main/lib/main.dart"
    click HomeView "https://github.com/Kashif400/app-localization/blob/main/lib/home_view.dart"
    click LangController "https://github.com/Kashif400/app-localization/blob/main/lib/controller/language_change_controller.dart"
    click ARBFiles "https://github.com/Kashif400/app-localization/tree/main/lib/l10n/"
    click EN "https://github.com/Kashif400/app-localization/blob/main/lib/l10n/app_en.arb"
    click ES "https://github.com/Kashif400/app-localization/blob/main/lib/l10n/app_es.arb"
    click UR "https://github.com/Kashif400/app-localization/blob/main/lib/l10n/app_ur.arb"
    click L10nConfig "https://github.com/Kashif400/app-localization/blob/main/l10n.yaml"
    click Android "https://github.com/Kashif400/app-localization/tree/main/android/"
    click IOS "https://github.com/Kashif400/app-localization/tree/main/ios/"
    click Web "https://github.com/Kashif400/app-localization/tree/main/web/"
    click Windows "https://github.com/Kashif400/app-localization/tree/main/windows/"
    click Linux "https://github.com/Kashif400/app-localization/tree/main/linux/"
    click MacOS "https://github.com/Kashif400/app-localization/tree/main/macos/"
    click Android "https://github.com/Kashif400/app-localization/blob/main/android/app/src/main/kotlin/com/example/app_localization/MainActivity.kt"
    click IOS "https://github.com/Kashif400/app-localization/blob/main/ios/Runner/AppDelegate.swift"
    click MacOS "https://github.com/Kashif400/app-localization/blob/main/macos/Runner/AppDelegate.swift"
    click Linux "https://github.com/Kashif400/app-localization/blob/main/linux/runner/main.cc"
    click Windows "https://github.com/Kashif400/app-localization/blob/main/windows/runner/main.cpp"
```
