Skip to main content

Laravel Language Showcase

Discover real-world examples and use cases of Laravel Language in action. See how different applications leverage language management to support multiple locales, calendar systems, and text directions.

Understanding Language Components

Laravel Language provides powerful features for managing languages:

  • Language Service: Core service for CRUD operations
  • Language Model: Eloquent model with query scopes
  • Calendar Support: Multiple calendar systems (Gregorian, Jalali, Hijri, etc.)
  • Validation Rules: Built-in rules for locale and language validation
  • Middleware: Automatic locale and timezone setting
  • Events: Lifecycle events for language management

Multi-Language E-Commerce Platform

Global E-Commerce

Multi-language support with calendar awareness

Overview

Build a global e-commerce platform that supports multiple languages with different calendar systems. Persian customers see dates in Jalali calendar, Arabic customers see Hijri calendar, while Western customers see Gregorian calendar. Each language has its own text direction (RTL for Persian/Arabic, LTR for English).

Key Features
  • Multiple calendar systems
  • RTL/LTR text direction
  • Locale-based date formatting
  • Automatic locale detection
  • Language switching
Supported Languages
  • Persian (Jalali, RTL)
  • Arabic (Hijri, RTL)
  • English (Gregorian, LTR)
  • Hebrew (Hebrew, RTL)
  • And more...

Implementation Example

use JobMetric\Language\Facades\Language;
use JobMetric\Language\Support\CurrentLanguage;

// Setup languages
Language::addLanguageData('fa');
Language::addLanguageData('en');
Language::addLanguageData('ar');

// In controller
class ProductController extends Controller
{
public function show(Product $product)
{
$language = CurrentLanguage::get();

return view('products.show', [
'product' => $product,
'language' => $language,
'direction' => $language->direction,
'calendar' => $language->calendar,
]);
}
}

// In blade view
<div dir="{{ $direction }}">
<h1>{{ $product->name }}</h1>
<p>{{ tz_format($product->created_at, 'Y-m-d') }}</p>
</div>

Content Management System

Multi-Language CMS

Language management for content platforms

Overview

Implement a content management system that supports multiple languages with automatic locale detection, language switching, and calendar-aware date formatting. Content editors can manage languages through an admin panel, and the system automatically handles locale settings, text directions, and date formatting.

Key Features
  • Admin language management
  • Automatic locale detection
  • Language switching UI
  • Calendar-aware dates
  • RTL/LTR support
Use Cases
  • Blog platforms
  • News websites
  • Documentation sites
  • Corporate websites
  • Portals

Implementation Example

use JobMetric\Language\Facades\Language;

class LanguageController extends Controller
{
public function index()
{
$languages = Language::all(['status' => true]);

return view('admin.languages.index', [
'languages' => $languages,
]);
}

public function store(StoreLanguageRequest $request)
{
$response = Language::store($request->validated());

return redirect()->route('admin.languages.index')
->with('success', $response->message);
}

public function switch($locale)
{
session(['language' => $locale]);
app()->setLocale($locale);

return redirect()->back();
}
}

Get Started

Ready to implement language management in your application? Check out our comprehensive documentation: