# Dashboard Module Multi-Language Implementation Plan

## Executive Summary

This document outlines a comprehensive plan for implementing Arabic and English language support in the Dashboard module (`Modules/Dashboard`). The module currently has all text hardcoded in Arabic, requiring a systematic approach to extract, organize, and implement translations following Laravel best practices.

---

## 1. Module Structure Overview

### 1.1 Directory Structure

```
Modules/Dashboard/
|-- app/
|   |-- Http/Controllers/
|   |   |-- AuditController.php
|   |   |-- BackupController.php
|   |   |-- CompanyController.php
|   |   |-- CompanyOwnerController.php
|   |   |-- DashboardController.php
|   |   |-- IssuingAuthorityController.php
|   |   |-- LicenseTypeController.php
|   |   |-- ProductController.php
|   |   |-- ProfileController.php
|   |   |-- ViolationTypeController.php
|   |-- Providers/
|       |-- DashboardServiceProvider.php (has registerTranslations method)
|-- resources/
|   |-- views/
|       |-- index.blade.php (main dashboard)
|       |-- audit/
|       |-- backup/
|       |-- companies/
|       |-- company_owners/
|       |-- components/
|       |-- issuing-authorities/
|       |-- license-types/
|       |-- profile/
|       |-- violation-types/
|-- routes/
    |-- web.php
```

### 1.2 Current Localization State

- **No language files exist** in the project (no `lang/` directory)
- **All text is hardcoded in Arabic** in blade templates
- **RTL is hardcoded** as `dir="rtl"` in the master layout
- **ServiceProvider** already has [`registerTranslations()`](Modules/Dashboard/app/Providers/DashboardServiceProvider.php:71) method configured

---

## 2. Files Requiring Modification

### 2.1 Blade Views (17 files)

| File Path | Purpose | Translatable Items |
|-----------|---------|-------------------|
| `resources/views/components/layouts/master.blade.php` | Master layout | Navigation items, user menu, page titles |
| `resources/views/components/nav-item.blade.php` | Navigation component | Icon mappings |
| `resources/views/index.blade.php` | Main dashboard | Stats cards, chart labels, activity feed |
| `resources/views/companies/index.blade.php` | Companies list | Table headers, buttons, empty states |
| `resources/views/companies/create.blade.php` | Create company form | Form labels, section titles, buttons |
| `resources/views/companies/edit.blade.php` | Edit company form | Form labels, section titles, buttons |
| `resources/views/companies/show.blade.php` | Company details | Info labels, section titles |
| `resources/views/company_owners/index.blade.php` | Company owners list | Table headers, buttons |
| `resources/views/company_owners/edit.blade.php` | Edit owner form | Form labels, buttons |
| `resources/views/audit/index.blade.php` | Audit log list | Stats cards, table headers |
| `resources/views/audit/show.blade.php` | Audit log details | Info labels |
| `resources/views/backup/index.blade.php` | Backup management | Stats, modal labels, buttons |
| `resources/views/profile/index.blade.php` | User profile | Form labels, section titles |
| `resources/views/issuing-authorities/index.blade.php` | Issuing authorities list | Table headers, buttons |
| `resources/views/issuing-authorities/create.blade.php` | Create form | Form labels |
| `resources/views/issuing-authorities/edit.blade.php` | Edit form | Form labels |
| `resources/views/license-types/index.blade.php` | License types list | Table headers, status labels |
| `resources/views/license-types/create.blade.php` | Create form | Form labels |
| `resources/views/license-types/edit.blade.php` | Edit form | Form labels |
| `resources/views/violation-types/index.blade.php` | Violation types list | Table headers, status labels |
| `resources/views/violation-types/create.blade.php` | Create form | Form labels |
| `resources/views/violation-types/edit.blade.php` | Edit form | Form labels |

### 2.2 Controllers (8 files)

| Controller | Translatable Content |
|------------|---------------------|
| `CompanyController.php` | Flash messages, API responses, validation errors |
| `DashboardController.php` | Activity titles/descriptions |
| `AuditController.php` | Flash messages, error messages |
| `BackupController.php` | Flash messages, API responses |
| `ProfileController.php` | Flash messages, validation errors |
| `IssuingAuthorityController.php` | Flash messages |
| `LicenseTypeController.php` | Flash messages |
| `ViolationTypeController.php` | Flash messages |

---

## 3. Translatable Content Categories

### 3.1 Navigation Items (Master Layout)

| Arabic | English Key | English Translation |
|--------|-------------|---------------------|
| `{{ __('dashboard::nav.dashboard') }}` | `dashboard` | Dashboard |
| `{{ __('dashboard::nav.companies') }}` | `companies` | Companies |
| `{{ __('dashboard::nav.company_owners') }}` | `company_owners` | Company Owners |
| `{{ __('dashboard::nav.backup') }}` | `backup` | Backup |
| `{{ __('dashboard::nav.audit_log') }}` | `audit_log` | Audit Log |
| `{{ __('dashboard::nav.issuing_authorities') }}` | `issuing_authorities` | Issuing Authorities |
| `{{ __('dashboard::nav.license_types') }}` | `license_types` | License Types |
| `{{ __('dashboard::nav.violation_types') }}` | `violation_types` | Violation Types |
| `{{ __('dashboard::nav.settings') }}` | `settings` | Settings |
| `{{ __('dashboard::nav.profile') }}` | `profile` | Profile |
| `{{ __('dashboard::nav.logout') }}` | `logout` | Logout |
| `{{ __('dashboard::nav.system_admin') }}` | `system_admin` | System Admin |

### 3.2 Status Labels

| Arabic | English Key | English Translation |
|--------|-------------|---------------------|
| `{{ __('dashboard::status.active') }}` | `active` | Active |
| `{{ __('dashboard::status.inactive') }}` | `inactive` | Inactive |
| `{{ __('dashboard::status.pending') }}` | `pending` | Pending Review |
| `{{ __('dashboard::status.mandatory') }}` | `mandatory` | Mandatory |
| `{{ __('dashboard::status.optional') }}` | `optional` | Optional |

### 3.3 Severity Levels

| Arabic | English Key | English Translation |
|--------|-------------|---------------------|
| `{{ __('dashboard::severity.critical') }}` | `critical` | Critical |
| `{{ __('dashboard::severity.high') }}` | `high` | High |
| `{{ __('dashboard::severity.medium') }}` | `medium` | Medium |
| `{{ __('dashboard::severity.low') }}` | `low` | Low |
| `{{ __('dashboard::severity.info') }}` | `info` | Informational |

### 3.4 Common Actions

| Arabic | English Key | English Translation |
|--------|-------------|---------------------|
| `{{ __('dashboard::actions.add_new') }}` | `add_new` | Add New |
| `{{ __('dashboard::actions.edit') }}` | `edit` | Edit |
| `{{ __('dashboard::actions.delete') }}` | `delete` | Delete |
| `{{ __('dashboard::actions.view') }}` | `view` | View |
| `{{ __('dashboard::actions.save') }}` | `save` | Save |
| `{{ __('dashboard::actions.cancel') }}` | `cancel` | Cancel |
| `{{ __('dashboard::actions.filter') }}` | `filter` | Filter |
| `{{ __('dashboard::actions.search') }}` | `search` | Search |
| `{{ __('dashboard::actions.download') }}` | `download` | Download |
| `{{ __('dashboard::actions.refresh') }}` | `refresh` | Refresh |

### 3.5 Flash Messages

| Arabic | English Key | English Translation |
|--------|-------------|---------------------|
| `{{ __('dashboard::messages.created_successfully') }}` | `created_successfully` | Created successfully |
| `{{ __('dashboard::messages.updated_successfully') }}` | `updated_successfully` | Updated successfully |
| `{{ __('dashboard::messages.deleted_successfully') }}` | `deleted_successfully` | Deleted successfully |
| `{{ __('dashboard::messages.error_occurred') }}` | `error_occurred` | An error occurred |
| `{{ __('dashboard::messages.not_found') }}` | `not_found` | Not found |

---

## 4. Proposed Language File Structure

### 4.1 Directory Structure

```
Modules/Dashboard/
|-- lang/
    |-- ar/
    |   |-- app.php          # General application strings
    |   |-- nav.php          # Navigation items
    |   |-- status.php       # Status labels
    |   |-- actions.php      # Action buttons
    |   |-- messages.php     # Flash messages
    |   |-- validation.php   # Validation messages
    |   |-- companies.php    # Company-specific labels
    |   |-- audit.php        # Audit-specific labels
    |   |-- backup.php       # Backup-specific labels
    |   |-- profile.php      # Profile-specific labels
    |   |-- license_types.php
    |   |-- violation_types.php
    |-- en/
        |-- (same structure as ar/)
```

### 4.2 Sample Language Files

#### `lang/ar/app.php`

```php
<?php

return [
    'name' => 'FuelPlus',
    'title' => 'FuelPlus Admin Dashboard',
    'currency' => 'SAR',
    'currency_symbol' => 'SAR',
    
    'stats' => [
        'total_companies' => 'Total Companies',
        'total_stations' => 'Total Stations',
        'active_users' => 'Active Users',
        'monthly_revenue' => 'Monthly Revenue',
        'from_last_month' => 'Since last month',
    ],
    
    'chart' => [
        'monthly_revenue' => 'Monthly Revenue',
        'total_revenue' => 'Total Revenue',
        'monthly_average' => 'Monthly Average',
        'last_month_growth' => 'Last Month Growth',
        'bar_view' => 'Bar',
        'line_view' => 'Line',
    ],
    
    'activity' => [
        'recent_activity' => 'Recent Activity',
        'view_all' => 'View All Activities',
        'no_activity' => 'No recent activities',
    ],
    
    'pagination' => [
        'showing' => 'Showing',
        'to' => 'to',
        'of' => 'of',
        'results' => 'results',
        'previous' => 'Previous',
        'next' => 'Next',
    ],
    
    'empty' => [
        'no_data' => 'No data available',
        'start_adding' => 'Start by adding your first item',
    ],
];
```

#### `lang/en/app.php`

```php
<?php

return [
    'name' => 'FuelPlus',
    'title' => 'FuelPlus Admin Dashboard',
    'currency' => 'SAR',
    'currency_symbol' => 'SAR',
    
    'stats' => [
        'total_companies' => 'Total Companies',
        'total_stations' => 'Total Stations',
        'active_users' => 'Active Users',
        'monthly_revenue' => 'Monthly Revenue',
        'from_last_month' => 'Since last month',
    ],
    
    'chart' => [
        'monthly_revenue' => 'Monthly Revenue',
        'total_revenue' => 'Total Revenue',
        'monthly_average' => 'Monthly Average',
        'last_month_growth' => 'Last Month Growth',
        'bar_view' => 'Bar',
        'line_view' => 'Line',
    ],
    
    'activity' => [
        'recent_activity' => 'Recent Activity',
        'view_all' => 'View All Activities',
        'no_activity' => 'No recent activities',
    ],
    
    'pagination' => [
        'showing' => 'Showing',
        'to' => 'to',
        'of' => 'of',
        'results' => 'results',
        'previous' => 'Previous',
        'next' => 'Next',
    ],
    
    'empty' => [
        'no_data' => 'No data available',
        'start_adding' => 'Start by adding your first item',
    ],
];
```

#### `lang/ar/nav.php`

```php
<?php

return [
    'dashboard' => 'Dashboard',
    'companies' => 'Companies',
    'company_owners' => 'Company Owners',
    'backup' => 'Backup',
    'audit_log' => 'Audit Log',
    'issuing_authorities' => 'Issuing Authorities',
    'license_types' => 'License Types',
    'violation_types' => 'Violation Types',
    'settings' => 'Settings',
    'profile' => 'Profile',
    'logout' => 'Logout',
    'system_admin' => 'System Admin',
];
```

#### `lang/ar/messages.php`

```php
<?php

return [
    'created_successfully' => 'Created successfully',
    'updated_successfully' => 'Updated successfully',
    'deleted_successfully' => 'Deleted successfully',
    'error_occurred' => 'An error occurred',
    'not_found' => 'Item not found',
    'confirm_delete' => 'Are you sure you want to delete this item?',
    'loading' => 'Loading...',
    'creating' => 'Creating...',
    'processing' => 'Processing...',
    
    'companies' => [
        'fetched_successfully' => 'Companies fetched successfully',
        'fetch_error' => 'Error fetching companies',
        'created_with_manager' => 'Company and manager created successfully',
        'creation_error' => 'Error creating company',
        'cannot_delete_with_stations' => 'Cannot delete company with stations',
        'cannot_delete_with_users' => 'Cannot delete company with users',
        'status_changed' => 'Company status changed successfully',
    ],
    
    'backup' => [
        'created_successfully' => 'Backup created successfully',
        'creation_error' => 'Error creating backup',
        'download_error' => 'Error downloading backup',
        'deleted_successfully' => 'Backup deleted successfully',
        'delete_error' => 'Error deleting backup',
        'cleanup_success' => 'Old backups cleaned successfully',
        'cleanup_error' => 'Error cleaning backups',
    ],
];
```

---

## 5. RTL Support Implementation

### 5.1 Dynamic Direction Detection

The master layout must dynamically set the text direction based on the current locale:

```html
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}" dir="{{ app()->getLocale() === 'ar' ? 'rtl' : 'ltr' }}">
```

### 5.2 CSS Considerations

1. **Use logical properties** where possible:
   - `margin-inline-start` instead of `margin-left`/`margin-right`
   - `padding-inline-end` instead of `padding-left`/`padding-right`
   - `border-inline-start` instead of `border-left`/`border-right`

2. **Tailwind CSS RTL support**:
   - Use `space-x-reverse` for flexbox spacing (already in use)
   - Use `ms-*` and `me-*` for margin start/end
   - Use `ps-*` and `pe-*` for padding start/end

3. **Font selection**:
   - Arabic: `Baloo Bhaijaan 2` (already configured)
   - English: Consider adding an English-appropriate font

### 5.3 Updated Master Layout Head Section

```html
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>@yield('title', __('dashboard::app.title'))</title>

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    @if(app()->getLocale() === 'ar')
        <link href="https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    @else
        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    @endif

    <!-- Styles -->
    @vite(['resources/css/app.css', 'resources/js/app.jsx'])
    
    @stack('styles')
</head>
```

---

## 6. Language Switching Implementation

### 6.1 Language Switcher Component

Create a language switcher in the header section of the master layout:

```html
<!-- Language Switcher -->
<div class="relative" x-data="{ open: false }">
    <button @click="open = !open" 
            class="flex items-center space-x-2 space-x-reverse rounded-lg p-2 hover:bg-gray-100">
        <i data-lucide="globe" class="h-5 w-5 text-gray-600"></i>
        <span class="text-sm text-gray-700">{{ app()->getLocale() === 'ar' ? 'AR' : 'EN' }}</span>
        <i data-lucide="chevron-down" class="h-4 w-4 text-gray-400"></i>
    </button>
    
    <div x-show="open" @click.away="open = false" x-transition
         class="absolute left-0 z-50 mt-2 w-32 rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5">
        <a href="{{ route('language.switch', 'ar') }}" 
           class="flex items-center px-4 py-2 text-sm {{ app()->getLocale() === 'ar' ? 'text-primary-600 bg-primary-50' : 'text-gray-700 hover:bg-gray-100' }}">
            {{ __('dashboard::language.arabic') }}
        </a>
        <a href="{{ route('language.switch', 'en') }}" 
           class="flex items-center px-4 py-2 text-sm {{ app()->getLocale() === 'en' ? 'text-primary-600 bg-primary-50' : 'text-gray-700 hover:bg-gray-100' }}">
            {{ __('dashboard::language.english') }}
        </a>
    </div>
</div>
```

### 6.2 Language Switch Route and Controller

Add to `routes/web.php`:

```php
Route::get('language/{locale}', function ($locale) {
    if (in_array($locale, ['en', 'ar'])) {
        session()->put('locale', $locale);
        app()->setLocale($locale);
    }
    return redirect()->back();
})->name('language.switch');
```

### 6.3 Middleware for Locale Persistence

Create `app/Http/Middleware/SetLocale.php`:

```php
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class SetLocale
{
    public function handle(Request $request, Closure $next): Response
    {
        if (session()->has('locale')) {
            app()->setLocale(session()->get('locale'));
        } else {
            // Default to Arabic for Saudi Arabia context
            app()->setLocale(config('app.locale', 'ar'));
        }
        
        return $next($request);
    }
}
```

Register in `bootstrap/app.php`:

```php
->withMiddleware(function (Middleware $middleware) {
    $middleware->web()->append(\App\Http\Middleware\SetLocale::class);
})
```

---

## 7. Implementation Steps for Code Mode

### Phase 1: Infrastructure Setup

1. **Create language directories**
   - Create `Modules/Dashboard/lang/ar/` directory
   - Create `Modules/Dashboard/lang/en/` directory

2. **Create language files**
   - Create all language files as specified in Section 4.2
   - Ensure all translation keys are properly organized

3. **Create locale middleware**
   - Create `SetLocale` middleware
   - Register in the application middleware stack

4. **Add language switch route**
   - Add route to `routes/web.php`
   - Test language switching functionality

### Phase 2: Master Layout Updates

5. **Update master layout** (`resources/views/components/layouts/master.blade.php`)
   - Replace hardcoded `dir="rtl"` with dynamic direction
   - Replace all hardcoded Arabic text with translation keys
   - Add language switcher component
   - Update font loading based on locale

6. **Update nav-item component** (`resources/views/components/nav-item.blade.php`)
   - Ensure proper RTL/LTR support for icons

### Phase 3: View Files Updates

7. **Update main dashboard** (`resources/views/index.blade.php`)
   - Replace all hardcoded text with translation keys
   - Update JavaScript strings to use translated values

8. **Update company views**
   - `companies/index.blade.php`
   - `companies/create.blade.php`
   - `companies/edit.blade.php`
   - `companies/show.blade.php`

9. **Update company owners views**
   - `company_owners/index.blade.php`
   - `company_owners/edit.blade.php`

10. **Update audit views**
    - `audit/index.blade.php`
    - `audit/show.blade.php`

11. **Update backup views**
    - `backup/index.blade.php`

12. **Update profile views**
    - `profile/index.blade.php`

13. **Update issuing authorities views**
    - `issuing-authorities/index.blade.php`
    - `issuing-authorities/create.blade.php`
    - `issuing-authorities/edit.blade.php`

14. **Update license types views**
    - `license-types/index.blade.php`
    - `license-types/create.blade.php`
    - `license-types/edit.blade.php`

15. **Update violation types views**
    - `violation-types/index.blade.php`
    - `violation-types/create.blade.php`
    - `violation-types/edit.blade.php`

### Phase 4: Controller Updates

16. **Update CompanyController**
    - Replace hardcoded messages with `__('dashboard::messages.*')`
    - Update API response messages

17. **Update DashboardController**
    - Replace activity titles and descriptions with translatable strings

18. **Update remaining controllers**
    - AuditController
    - BackupController
    - ProfileController
    - IssuingAuthorityController
    - LicenseTypeController
    - ViolationTypeController

### Phase 5: Testing and Validation

19. **Test language switching**
    - Verify all pages display correctly in both languages
    - Verify RTL/LTR switching works properly

20. **Test form submissions**
    - Verify validation messages appear in correct language
    - Verify flash messages appear in correct language

21. **Test JavaScript interactions**
    - Verify JavaScript alerts and confirmations use correct language

---

## 8. Translation Key Usage Examples

### 8.1 In Blade Templates

```html
{{-- Navigation --}}
<x-dashboard::nav-item href="{{ route('dashboards.index') }}" :active="request()->routeIs('dashboards.*')" icon="dashboard">
    {{ __('dashboard::nav.dashboard') }}
</x-dashboard::nav-item>

{{-- Page Title --}}
@section('page-title', __('dashboard::companies.page_title'))
@section('page-description', __('dashboard::companies.page_description'))

{{-- Form Label --}}
<label for="name" class="block text-sm font-medium text-gray-700">
    {{ __('dashboard::companies.labels.name') }} <span class="text-red-500">*</span>
</label>

{{-- Button --}}
<button type="submit" class="...">
    <i data-lucide="save" class="ml-2 h-4 w-4"></i>
    {{ __('dashboard::actions.save') }}
</button>

{{-- Status Badge --}}
<span class="{{ $company->status === 'active' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' }} ...">
    {{ $company->status === 'active' ? __('dashboard::status.active') : __('dashboard::status.inactive') }}
</span>

{{-- Empty State --}}
<h3 class="text-lg font-medium text-gray-900">{{ __('dashboard::companies.empty.title') }}</h3>
<p class="text-sm text-gray-500">{{ __('dashboard::companies.empty.description') }}</p>
```

### 8.2 In Controllers

```php
// Flash messages
return redirect()->route('dashboard.companies.index')
    ->with('success', __('dashboard::messages.companies.created_successfully'));

// API responses
return response()->json([
    'status' => true,
    'message' => __('dashboard::messages.companies.fetched_successfully'),
    'data' => $companies
]);

// Validation errors (custom)
if ($validator->fails()) {
    return back()->withErrors($validator)->withInput()
        ->with('error', __('dashboard::messages.validation_error'));
}
```

### 8.3 In JavaScript (Blade Templates)

```html
<script>
function showNotification(message, type = 'info') {
    // ...
}

// Use translated strings from data attributes or global object
const translations = {
    confirmDelete: @json(__('dashboard::messages.confirm_delete')),
    loading: @json(__('dashboard::messages.loading')),
    creating: @json(__('dashboard::messages.creating')),
};

// Or use data attributes
<button onclick="return confirm(this.dataset.confirm)" 
        data-confirm="{{ __('dashboard::messages.confirm_delete') }}">
```

---

## 9. Validation Messages

### 9.1 Custom Validation Messages in Arabic

Create `Modules/Dashboard/lang/ar/validation.php`:

```php
<?php

return [
    'required' => 'This field is required',
    'email' => 'Please enter a valid email address',
    'unique' => 'This value already exists',
    'exists' => 'Selected value is invalid',
    'min' => [
        'string' => 'This field must be at least :min characters',
    ],
    'max' => [
        'string' => 'This field may not be greater than :max characters',
    ],
    
    'custom' => [
        'name' => [
            'required' => 'Company name is required',
        ],
        'email' => [
            'unique' => 'This email is already registered',
        ],
        'registration_number' => [
            'unique' => 'This registration number is already registered',
        ],
    ],
];
```

---

## 10. Summary of Changes

### Files to Create

| File | Purpose |
|------|---------|
| `Modules/Dashboard/lang/ar/*.php` (11 files) | Arabic translations |
| `Modules/Dashboard/lang/en/*.php` (11 files) | English translations |
| `app/Http/Middleware/SetLocale.php` | Locale middleware |

### Files to Modify

| Category | Count |
|----------|-------|
| Blade Views | 17 files |
| Controllers | 8 files |
| Routes | 1 file |
| Middleware Registration | 1 file |

### Total Estimated Changes

- **New files**: 23 files
- **Modified files**: 27 files
- **Translation keys**: ~300+ keys

---

## 11. Best Practices and Recommendations

1. **Use translation keys consistently** - Always use `__('dashboard::key')` syntax for module translations

2. **Organize translations logically** - Group related translations in dedicated files (nav, status, actions, etc.)

3. **Avoid inline translations** - Never hardcode translations in controllers; always use language files

4. **Test both languages regularly** - Ensure all features work in both Arabic and English

5. **Consider JSON-based translations** - For JavaScript-heavy features, consider using JSON translation files

6. **Document translation keys** - Maintain a translation key reference for future developers

7. **Use proper RTL CSS** - Leverage Tailwind's RTL support and logical CSS properties

8. **Handle pluralization** - Use Laravel's pluralization features where needed:
   ```php
   '{{ trans_choice('dashboard::messages.items_count', $count, ['count' => $count]) }}'
   ```

---

## 12. Architecture Diagram

```mermaid
flowchart TD
    subgraph Request Flow
        A[User Request] --> B[SetLocale Middleware]
        B --> C{Session has locale?}
        C -->|Yes| D[Set App Locale]
        C -->|No| E[Use Default Locale - ar]
        D --> F[Process Request]
        E --> F
    end
    
    subgraph Translation System
        G[Blade View] --> H[__ helper function]
        H --> I[Lang File Loader]
        I --> J{Current Locale}
        J -->|ar| K[Modules/Dashboard/lang/ar/*.php]
        J -->|en| L[Modules/Dashboard/lang/en/*.php]
        K --> M[Return Arabic String]
        L --> N[Return English String]
    end
    
    subgraph RTL Support
        O[Master Layout] --> P{Locale is Arabic?}
        P -->|Yes| Q[dir=rtl]
        P -->|No| R[dir=ltr]
        Q --> S[Arabic Font - Baloo Bhaijaan]
        R --> T[English Font - Inter]
    end
    
    F --> G
    M --> O
    N --> O
```

---

## 13. Next Steps

1. **Review this plan** with the development team
2. **Switch to Code mode** to begin implementation
3. **Follow the implementation steps** in Section 7 sequentially
4. **Test thoroughly** after each phase
5. **Document any additional translations** discovered during implementation

---

*Document created: 2026-02-25*
*Module: Modules/Dashboard*
*Languages: Arabic (ar), English (en)*