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
Laravel Localize

Laravel Localize Laravel Package

pawelmysior/laravel-localize

A lightweight Laravel localization package for building multilingual apps. It helps manage the active locale, generate locale-aware routes, and switch languages cleanly, making it easy to serve the same application in multiple languages without heavy configuration.

View on GitHub
Deep Wiki
Context7

Localize your Laravel application with a single global command

Frequently asked questions about Laravel Localize
How do I install pawelmysior/laravel-localize in a Laravel application?
Install it with Composer by running composer require pawelmysior/laravel-localize from your project root. If your app relies on Laravel package auto-discovery the service provider is registered for you; otherwise register it manually in config/app.php. After that, follow the repository README to declare the locales your application should serve.
Which Laravel and PHP versions does laravel-localize support?
The supported Laravel and PHP ranges are declared in the package's composer.json, so check those constraints against your application before requiring it. Composer will refuse to install the package if your framework version falls outside the declared range. Review the repository releases for the most current compatibility details.
How do I switch the application language at runtime with this package?
The package is built around managing the active locale, which means you can change the language for the current request without rewriting your translation calls. You switch the locale from your own code, such as a controller action or middleware, and the rest of the request renders using Laravel's standard translation helpers for that locale. This keeps language switching clean and separate from your views and business logic.
How do locale-aware routes work in laravel-localize?
The package generates locale-aware routes so the same application route can be resolved for a specific language rather than hardcoding a single locale into your route definitions. That lets you link to a page in another language without duplicating route entries for every locale you support. Check the README for the exact route helper and naming conventions used by the package.
Does laravel-localize replace Laravel's built-in translation files?
No. It works alongside Laravel's native localization features, so your existing lang directory files and __() helper calls continue to work as usual. The package focuses on the active locale and locale-aware routing, not on replacing the translator itself. You still maintain translation strings the normal Laravel way.
How much configuration does it take to add a second language?
The package is intentionally lightweight and aims to work with minimal configuration, which is one of its main selling points compared to heavier localization packages. In most setups you declare your supported locales and make sure the matching lang directories exist. Consult the repository README for the exact setup steps and any publishable config file.
Can I remember the user's chosen language between requests?
Because the package manages the active locale rather than tying it to a single request, you can persist the user's choice yourself, typically in the session or a cookie. A common pattern is to store the selected locale when the user switches language and restore it early in each request, for example in middleware. That way the locale applies consistently across the whole session.
How do I test locale switching in Laravel feature tests?
Treat locale switching like any other request behaviour: perform a request against a locale-aware route and assert that the rendered content matches the expected translation. You can also set the locale directly in tests via the application locale before asserting output. Keep separate test cases per locale so regressions in one language are easy to spot.
Does laravel-localize add overhead in production, and does it work with route caching?
The package does very little beyond managing the active locale and generating locale-aware routes, so the runtime cost is negligible compared with your normal request handling. The main thing to verify is that your locale-aware route generation still behaves correctly after running php artisan route:cache. Test the cached-route path in staging before deploying.
How does laravel-localize compare to mcamara/laravel-localization, and is it maintained?
mcamara/laravel-localization is a much larger package with features like translated route segments, hreflang tags and locale negotiation, whereas laravel-localize deliberately stays small and focused on the active locale and locale-aware routes. If you only need clean language switching, the lighter package is often easier to reason about. Before adopting either, check the GitHub repository for recent commits, releases and open issues to confirm current maintenance.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core