Skip to main content

Laravel Translation Showcase

Discover real-world examples and use cases of Laravel Translation in action. See how different applications leverage multilingual content management to serve global audiences and deliver localized experiences.

Understanding Translation Components

Laravel Translation provides powerful features for managing multilingual content:

  • HasTranslation Trait: Core trait that makes any Eloquent model multilingual
  • Per-Field Translations: Each field can have different translations for different locales
  • Version History: Optional versioning to track translation changes over time
  • Query Scopes: Search and filter models based on translated content
  • Validation Rules: Ensure translation data integrity
  • API Resources: Transform models with translations for API responses

E-Commerce Product Catalog

Multilingual Product Management

Complete product information in multiple languages

Overview

E-commerce platforms serving global markets need product information in multiple languages. Laravel Translation enables you to store product names, descriptions, specifications, and SEO metadata in different locales. Customers see products in their preferred language, improving user experience and conversion rates.

Translatable Fields
  • Product name
  • Description
  • Short description
  • Meta title & description
  • Specifications
  • Features & benefits
Business Benefits
  • Global market reach
  • Improved SEO for each locale
  • Better user experience
  • Localized content management
  • Version history for content updates

Implementation Example

class Product extends Model
{
use HasTranslation;

protected array $translatables = [
'name',
'description',
'short_description',
'meta_title',
'meta_description',
'meta_keywords',
];

protected bool $translationVersioning = true;
}

// Create product with translations
$product = Product::create([
'sku' => 'PROD-001',
'price' => 99.99,
'translation' => [
'en' => [
'name' => 'Wireless Headphones',
'description' => 'High-quality wireless headphones...',
],
'fa' => [
'name' => 'هدفون بی‌سیم',
'description' => 'هدفون بی‌سیم با کیفیت بالا...',
],
],
]);

// Retrieve based on user locale
$name = $product->getTranslation('name', app()->getLocale());

Content Management System (CMS)

Multilingual Blog & Articles

Content publishing in multiple languages with version control

Overview

Content management systems often need to publish articles, blog posts, and pages in multiple languages. Laravel Translation enables content editors to manage translations efficiently, track changes with versioning, and ensure consistency across different language versions. The versioning feature is particularly valuable for content that undergoes frequent updates.

Use Cases
  • Blog posts & articles
  • News content
  • Documentation pages
  • Help center articles
  • Landing pages
  • Marketing content
Key Features
  • Version history tracking
  • Content search by translation
  • Easy content updates
  • Multi-language SEO
  • Content consistency

Implementation Example

class BlogPost extends Model
{
use HasTranslation;

protected array $translatables = [
'title',
'content',
'excerpt',
'meta_title',
'meta_description',
];

protected bool $translationVersioning = true;
}

// Create post with translations
$post = BlogPost::create([
'slug' => 'my-article',
'author_id' => 1,
'translation' => [
'en' => [
'title' => 'Getting Started with Laravel',
'content' => 'Laravel is a powerful framework...',
],
'fa' => [
'title' => 'شروع کار با Laravel',
'content' => 'Laravel یک فریمورک قدرتمند است...',
],
],
]);

// Search posts by translated title
$posts = BlogPost::whereTranslationLike('title', 'Laravel', 'en')->get();

Category & Taxonomy Management

Multilingual Categories

Organize content with translated category names and descriptions

Overview

Categories, tags, and taxonomies often need multilingual support. Product categories, blog categories, content tags, and other organizational structures benefit from translations. Users can navigate and filter content in their preferred language, improving discoverability and user experience.

Common Use Cases
  • Product categories
  • Blog categories
  • Content tags
  • Taxonomy terms
  • Navigation menus
  • Filter options
Benefits
  • Better navigation
  • Improved searchability
  • Localized filtering
  • SEO optimization
  • User-friendly interface

Implementation Example

class Category extends Model
{
use HasTranslation;

protected array $translatables = [
'name',
'description',
'slug',
];
}

// Create category with translations
$category = Category::create([
'parent_id' => null,
'translation' => [
'en' => [
'name' => 'Electronics',
'description' => 'Electronic devices and accessories',
],
'fa' => [
'name' => 'الکترونیک',
'description' => 'دستگاه‌ها و لوازم الکترونیکی',
],
],
]);

// Display category name based on locale
$categoryName = $category->getTranslation('name', app()->getLocale());

News & Media Platform

Multilingual News Articles

Publish news and media content in multiple languages

Overview

News platforms and media websites serving international audiences need articles available in multiple languages. Journalists and editors can create content in their native language, and the system can manage translations for other locales. Versioning ensures that content updates are tracked, and previous versions can be restored if needed.

Content Types
  • News articles
  • Press releases
  • Editorials
  • Interviews
  • Feature stories
  • Opinion pieces
Features
  • Multi-language publishing
  • Content versioning
  • Translation workflow
  • SEO optimization
  • Content search

Implementation Example

class NewsArticle extends Model
{
use HasTranslation;

protected array $translatables = [
'title',
'content',
'summary',
'meta_title',
'meta_description',
];

protected bool $translationVersioning = true;
}

// Search news by translated content
$articles = NewsArticle::searchTranslation('title', 'technology', 'en')
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->get();

Educational Platform

Multilingual Course Content

Educational content in multiple languages for global learners

Overview

Online learning platforms serving international students need course content in multiple languages. Courses, lessons, quizzes, and educational materials can be translated while maintaining the same structure. Students can learn in their preferred language, and instructors can manage content updates with version tracking.

Content Types
  • Course titles & descriptions
  • Lesson content
  • Quiz questions
  • Assignment instructions
  • Course materials
  • Certificates & badges
Benefits
  • Global accessibility
  • Localized learning experience
  • Content version control
  • Easy content updates
  • Multi-language search

Implementation Example

class Course extends Model
{
use HasTranslation;

protected array $translatables = [
'title',
'description',
'objectives',
'requirements',
];

protected bool $translationVersioning = true;
}

// Get course in user's language
$course = Course::find(1);
$title = $course->getTranslation('title', $user->locale);
$description = $course->getTranslation('description', $user->locale);

Real Estate Platform

Multilingual Property Listings

Property descriptions and details in multiple languages

Overview

Real estate platforms serving international markets need property listings in multiple languages. Property titles, descriptions, features, and location details can be translated to reach a broader audience. Potential buyers can view properties in their preferred language, improving engagement and conversion rates.

Translatable Fields
  • Property title
  • Description
  • Features & amenities
  • Location details
  • Neighborhood information
  • SEO metadata
Benefits
  • International market reach
  • Better property discoverability
  • Improved user experience
  • Localized content
  • SEO optimization

Implementation Example

class Property extends Model
{
use HasTranslation;

protected array $translatables = [
'title',
'description',
'features',
'location_description',
];
}

// Search properties by translated title
$properties = Property::whereTranslationLike('title', 'apartment', 'en')
->where('status', 'available')
->get();

Get Started

Ready to implement multilingual content in your application? Check out our comprehensive documentation: