Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Translation Laravel Package

illuminate/translation

Laravel's translation library offers a clean, fluent API for retrieving localized strings, handling pluralization and parameter replacement across PHP language files and JSON. It supports locale fallbacks, runtime locale switching, and works standalone or within the full framework.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Market expansion sequencing. Localization is a gating item for entering new regions; this component is the engine that makes UI strings, validation messages, emails, and framework-level text translatable at no incremental cost. It lets roadmap conversations focus on which markets and when, not on whether we can technically localize.
  • Build vs. buy for translation infrastructure. The default answer is "neither — it's already in the framework." That removes a build item from the backlog entirely. The buy decision then narrows to a much smaller question: do we need a translation management layer (Crowdin, Lokalise, Phrase) and/or machine translation on top of file-based strings?
  • Scope boundary for v1 localization. File-based translation cleanly covers product-owned strings (nav, forms, errors, transactional email, notification copy). It does not cover user-generated content or per-tenant dynamic content — those require an MT/API integration. Making that boundary explicit early prevents an inflated localization commitment in planning.
  • Fallback and degradation policy. Configuring a fallback locale is a product decision about acceptable UX in partially translated markets: ship with English fallbacks and iterate, or hold a locale until coverage hits a threshold. Worth deciding deliberately rather than defaulting.
  • Locale rollout mechanics as a product lever. Dynamic locale switching (user preference, middleware-driven) supports decisions like "do we ship per-user language selection in this release or infer from browser?" — cheap to include, and it affects activation in multilingual markets.
  • Vendor/package copy ownership. Overriding third-party package translations is a small but real maintenance commitment. If we ship locales with heavy vendor UI (admin panels, billing portals), budget for reviewing vendor strings per locale release.
  • Extensibility as a hedge. If the roadmap later calls for database- or CMS-backed translations, the framework exposes a loader extension point, so the initial file-based decision is reversible without a rewrite. That materially lowers the risk of committing to the simple path now.
  • Cost and licensing posture. MIT, maintained inside the core framework, zero procurement and no per-seat or per-locale fees. Localization cost becomes translation labor and review, not licensing.

When to Consider This Package

Adopt (effectively, "use the framework's built-in localization") when:

  • The product is a Laravel application. This is the primary and near-disqualifying criterion — it is a subtree split of laravel/framework, not a standalone library.
  • Translation needs are standard: grouped message files, placeholders, pluralization, fallback locales, vendor overrides.
  • Translation content is owned by the product team and versioned alongside code — i.e., strings change at deploy cadence.
  • Locale count and string volume are modest (tens of locales, low thousands of strings). File-based storage stays fast and legible at this scale.
  • The team is developer-led and comfortable with strings living in the repo and going through code review.

Look elsewhere when:

  • Non-Laravel stack. Symfony, vanilla PHP, a Node or Python service, or a polyglot estate where only part of the surface is Laravel. Standalone wiring requires manually assembling container/config dependencies and there is no first-party documentation for it; risk is moderate-to-high and support is effectively absent.
  • You need a translation workflow, not a translation runtime. Translator portals, approval queues, translation memory, screenshot context, and in-context review are not in scope. Pair a TMS with this package rather than replacing it.
  • Translations must be editable at runtime by non-engineers. Database-backed or CMS-driven string management needs a custom loader and its own operational story (caching, invalidation, audit). Buildable, but it is a project, not a config flag.
  • Per-tenant or user-generated content translation. Requires an MT/vendor API; this package provides no outbound translation capability.
  • Compliance or regional review mandates per-string audit trails. File diffs give history but not a reviewer-facing audit surface.
  • Do not composer require illuminate/translation as a standalone dependency — consume it via laravel/framework. Worth stating explicitly to prevent an engineering misstep during kickoff.

How to Pitch It (Stakeholders)

Executives. Laravel's translation capability ships with the framework under MIT — no license, no procurement, no new vendor. It converts "localization" from a multi-sprint platform build into a translation-and-review effort, which is the dominant driver of time-to-market for new regions. The risk profile is favorable: it is maintained by the core framework team and used by the framework itself, so it will not be orphaned. The honest caveat is scope — this is the translation engine, not a translator workflow tool. If we want professional translators working in a portal with review cycles, that is a separate, modest vendor line item, and it should be scoped as such rather than assumed to be included.

Engineering. Zero setup in a Laravel app — it is already installed. The team interacts through __() and trans_choice() in Blade, controllers, and services; direct Translator usage is rare. Placeholders, pluralization rules, fallback locales, and vendor package overrides are all supported out of the box. Three things to get right up front: pick one file format per group (PHP or JSON, never mixed), normalize locale casing in middleware, and cache translations for production (php artisan translation:export on Laravel 11+). Performance is straightforward — avoid repeated Lang::get() calls inside loops; fetch the group once. If we later need DB- or API-backed strings, Lang::extend() with a custom loader keeps that door open without re-architecting, so the file-based start is not a one-way door.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
muka/shape-reader
tdt/json
refinery29/php-cs-fixer-config
hotmeteor/eco-env
mvaliolahi/hydrate
wearede/tbcpay-php
parsnick/steak
thibaud-dauce/mattermost-php
multilinguals/apollo-client
antaresbr/collection
kr0lik/phpstan-rules
loco/loco
starfederation/datastar-php
yupmin/modern-phystrix
stephenjude/extended-artisan-commands
lumphp/laravel-macroable
lumphp/laravel-collections
lumphp/laravel-contracts
sermepa/sermepa
arkecosystem/fortify