Stemmers and stopword lists for Lunr.js that add multilingual full-text search across dozens of languages in the browser or Node.js.
mcamara/laravel-localization
Laravel package for i18n URL localization: locale-prefixed routes, browser language detection, translatable route slugs and language selector helpers.
- Stars
- 3,558
- Forks
- 505
- Open issues
- 11
- Last commit
- 2 months ago
What is it?
Laravel Localization adds multilingual URL handling to Laravel applications. Routes are defined once inside a locale prefix group, and the package sets the application locale from the URL segment, so /en/about and /es/acerca both resolve to the same controller while App::getLocale() reflects the active language.
The package can detect a visitor's language from the browser's Accept-Language header, store the chosen locale in a session or cookie, and redirect requests to the localized URL. It can also hide the default locale in URLs, translate route segments through lang files, and provides helpers such as localizeUrl, getSupportedLocales and getCurrentLocaleDirection for building language selectors and locale-aware links.
Routes are generated per request, so php artisan route:cache is not supported by default; a LoadsTranslatedCachedRoutes trait and route:trans:cache command are provided for caching. The README also recommends a successor package, niels-numbers/laravel-localizer, for new projects that need native route caching.
Key features
- 01Locale-prefixed route groups that let you define routes once for all languages.
- 02Browser language detection through the Accept-Language header.
- 03Session and cookie based locale redirect middleware.
- 04Translatable route segments defined in lang/**/routes.php files.
- 05Helpers for localized URLs, locale names, native names, direction and script.
- 06Optional hiding of the default locale in URLs and custom locale URL mappings.
Use cases
- Building a Laravel website that serves content in several languages under distinct URL prefixes.
- Adding a language selector that links each page to its equivalent URL in other locales.
- Serving translated slugs such as /en/article/... and /es/articulo/... for SEO-friendly multilingual sites.
Quick start
- 1
Install the package with Composer
composer require mcamara/laravel-localization - 2
Publish the config file
php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider" - 3
Wrap your localized routes in the LaravelLocalization::setLocale() route group in routes/web.php
Things to know
- Routes are generated per request, so php artisan route:cache is not supported out of the box.
- Laravel and PHP version support is tied to specific package versions listed in the compatibility table.
Topics
FAQ
- What is laravel-localization?
- Laravel package for i18n URL localization: locale-prefixed routes, browser language detection, translatable route slugs and language selector helpers. Laravel Localization adds multilingual URL handling to Laravel applications. Routes are defined once inside a locale prefix group, and the package sets the application locale from the URL segment, so /en/about and /es/acerca both resolve to the same controller while App::getLocale() reflects the active language.
- Is laravel-localization free to use? What license does it have?
- laravel-localization is open source under the MIT license. Check the license terms before using it in commercial products.
- Is laravel-localization still maintained?
- Updated within 6 months. The last commit to laravel-localization was on Aug 24, 2026.
- What can I use laravel-localization for?
- Building a Laravel website that serves content in several languages under distinct URL prefixes. Adding a language selector that links each page to its equivalent URL in other locales. Serving translated slugs such as /en/article/... and /es/articulo/... for SEO-friendly multilingual sites.
- How do I install laravel-localization?
- Install the package with Composer: composer require mcamara/laravel-localization Publish the config file: php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider" Wrap your localized routes in the LaravelLocalization::setLocale() route group in routes/web.php
- Where can I get laravel-localization?
- The source code and installation instructions are on GitHub: https://github.com/mcamara/laravel-localization
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A community-maintained WordPress plugin that adds multilingual content to posts and pages, stored together in a single post.
A Laravel wrapper around PhpSpreadsheet for exporting collections, queries and Blade views to Excel or CSV, and importing spreadsheets into Eloquent models.
A PHP SDK for building Telegram bots on the Telegram Bot API, with built-in Laravel support.
A real-time chat package for Laravel that adds direct messages, groups, attachments, and a bundled messenger UI to a Laravel app.
A Laravel Scout driver that adds full-text search to Eloquent models using the TNTSearch PHP engine, with no external search server.