Weave Code
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

Locales Laravel Package

laravel-lang/locales

Locale data package for Laravel Lang. Provides up-to-date locale definitions you can use across your Laravel apps, with documentation for installation and contribution guidelines. MIT licensed.

View on GitHub
Deep Wiki
Context7

Laravel Lang: Locales provides a curated set of locale definitions for Laravel apps, helping you standardize language/region settings and stay aligned with the Laravel Lang ecosystem. It’s a lightweight Composer package designed to plug into your existing localization workflow with minimal effort.

Use it to keep locale metadata consistent across projects and updates, while relying on a maintained source of truth.

  • Ready-to-use locale list for Laravel applications
  • Maintained by the Laravel Lang community
  • Works alongside your existing translations & i18n setup
  • Composer-friendly installation and updates
  • Open-source, MIT licensed
Frequently asked questions about Locales
How do I install laravel-lang/locales in my Laravel project?
Run `composer require laravel-lang/locales` in your project directory. The package integrates automatically with Laravel’s service container and requires no manual configuration unless you customize the default behavior. Check the [official documentation](https://laravel-lang.com/packages-locales.html) for advanced setup options.
Does this package replace Laravel’s built-in locale system?
No, it complements Laravel’s native localization. It provides a curated, maintained dataset of locale metadata (e.g., country names, currency codes) that you can use alongside Laravel’s `trans()`, `locale()`, and validation rules. It’s designed to work seamlessly without breaking existing logic.
Which Laravel versions does laravel-lang/locales support?
The package is fully compatible with Laravel 11, 12, and 13. It leverages Laravel’s service container and facades, so it adheres to modern Laravel patterns. For older versions (e.g., Laravel 10), check the [release notes](https://github.com/Laravel-Lang/locales/releases) for compatibility.
Can I use this for dynamic user locale selection (e.g., dropdowns)?
Yes. The package includes a `Locales::available()` method to fetch all supported locales, which you can use in Blade templates or API responses. For user-driven selection, pair it with Laravel’s session or middleware to set the active locale dynamically via `Locales::set()`.
How do I customize or extend the locale data?
You can override or extend the default locale data by publishing the config file (`php artisan vendor:publish --tag=locales-config`) and modifying the `config/locales.php` file. For advanced use cases, the `Locales::raw()` method provides direct access to the underlying data structure for manual manipulation.
Will this package slow down my application?
No, the package is optimized for performance. Locale data is cached by default, and the facade-based API (`Locales::`) adds minimal overhead. Only opt-in methods like `Locales::raw()` may impact performance if used excessively, but these are designed for edge cases like bulk operations.
How do I handle unsupported locales or fallback chains?
The package includes a fallback mechanism for unsupported locales. Use `Locales::get($code, $fallback = 'en')` to specify a default locale if the requested one isn’t available. For custom fallbacks, extend the `LocaleData` class or override the `fallback` config value in `config/locales.php`.
Can I use this package with Laravel’s validation rules?
Absolutely. The package integrates with Laravel’s validation system. For example, validate a locale code with `Rule::in(array_column(Locales::available()->pluck('code'), 'code'))`. This ensures consistency with the package’s dataset while leveraging Laravel’s built-in validation.
Is there a way to monitor which locales are most/least used?
Yes, you can track locale usage by logging calls to `Locales::getCurrent()` or by extending the package to emit events when locales are set. Pair this with Laravel’s logging or analytics tools to gather usage statistics for optimization or compliance reporting.
What alternatives exist for Laravel locale management?
Alternatives include manually maintaining locale arrays, using third-party libraries like `symfony/intl`, or custom database-driven solutions. However, `laravel-lang/locales` stands out for its Laravel-native integration, active maintenance by the Laravel Lang community, and alignment with Laravel’s ecosystem (e.g., translations via `laravel-lang/lang`). It’s ideal for teams prioritizing consistency and minimal 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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport