Overview
Laravel Multi-Lang centralises every moving part you need to internationalise Eloquent models—schema, traits, helpers, scopes, caching, CLI tooling, and observability—into a single, cohesive package. This page gives you the “map of the territory” before we dive into the detailed guides.
Feature matrix
| Area | What you get | Where to learn more |
|---|---|---|
| On-model translations | Translatable trait, attribute fallbacks, translation helpers, facade | Core Concepts |
| Querying content | Full suite of whereTranslate* scopes, grouped predicates, wildcard locales | Querying Translations |
| Managing content | setTranslation, batch updates, soft deletes with auto-restore, pluralisation helpers | Managing Translations |
| Performance | Eager-loading scopes, per-request caching, shared cache stores, performance tips | Caching & Performance |
| Automation | Audit/export/import Artisan commands, JSON schema, scheduled snapshots | Automation & CLI |
| Extensibility | Custom cache stores, fallback chains, middleware, observers, broadcasting | Extensibility & Integrations |
| Quality & testing | Factories, Pest test coverage, usage patterns in tests, CI tips | Testing & QA |
Quick wins
- Add the trait: mark your models as
Translatableand list the attributes that should become translatable. - Seed translations: use
setTranslation()orsetTranslationsBatch()to write content per locale. - Query smart: filter translated content with
whereTranslate(),whereTranslateLike(), and friends. - Guard performance: eager load via
withTranslations()and optionally plug translations into Redis viaTranslationCacheStore. - Automate workflows: run
multi-lang:audit,multi-lang:export, andmulti-lang:importin CI, scheduled jobs, or content pipelines. - Scale safely: rely on soft deletes, cached lookups, and observability hooks to manage large datasets.
Standard translation flow
flowchart LR
A[Model uses Translatable trait] --> B[Seed translations: setTranslation / batch]
B --> C[Eager load locales with withTranslations]
C --> D[Access attributes or translate()]
D --> E[Query via whereTranslate scopes]
C --> F[Cache store (array / Redis / custom)]
B --> G[Audit & export via CLI]
G --> H[Import translated JSON]
Documentation map
- New to the package? Start with Getting Started for installation and first translations.
- See how the trait works internally? Jump to Core Concepts.
- Filtering records in controllers or repositories? Querying Translations covers every scope.
- Managing content at scale? Managing Translations explains batch updates, soft deletes, pluralisation, and helpers.
- Worried about performance? Caching & Performance outlines eager loading, shared caches, and tuning advice.
- Need automation pipelines? Automation & CLI details the Artisan commands with examples (CI, scheduled exports).
- Extending behaviour? Extensibility & Integrations documents custom cache stores, fallback chains, middleware, and observers.
- Write robust tests? Testing & QA shows how to integrate translations into your test suite.
With the lay of the land set, continue with Getting Started or dive straight into the topic most relevant to your project. The remaining guides are intentionally modular—feel free to cherry-pick what you need.