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.
Locales:: helper), aligning with Laravel’s service container, Blade templates, and validation systems. Minimal architectural disruption; leverages existing Laravel patterns (e.g., app/config/app.php for locale configuration).trans(), locale()) without redundancy.LocaleData objects and raw locale access, allowing teams to extend functionality (e.g., adding tenant-specific locale overrides or integrating with third-party services).laravel-lang/lang for translations and archtechx/enums for type safety, creating a cohesive localization stack. Avoids reinventing wheels for common use cases (e.g., country/currency dropdowns, RTL/LTR detection).Locales::) requires no changes to existing locale logic. Can be adopted incrementally (e.g., start with Locales::get() for dropdowns, later add Locales::set() for dynamic user preferences).config/app.php or config/locales.php (if using external config repo). No database migrations or schema changes required.Rule::in(array_column(Locales::available()->pluck('code'), 'code'))) and Blade directives (e.g., @foreach(Locales::installed() as $locale)).Locales::info() and Locales::getCurrent() enable seamless integration with APIs (e.g., returning locale metadata in responses) and Artisan commands (e.g., php artisan about for system info).laravel-lang/locale-list for source data. While static, the package includes fixes for critical issues (e.g., null locale handling in v2.9.2, Canada support in v2.10.0). Teams should validate data for edge cases (e.g., rare locales, custom regions).Locales::raw()->get()) may impact performance for large datasets but is opt-in.public string $locale), reducing runtime errors. Teams using older PHP versions may need to suppress type hints or use Locales::raw().Locales::set()), or is app-level configuration enough?Locales::raw() or eager-loading be needed to avoid N+1 queries?Rule::in(Locales::available()->pluck('code')) for locale-specific rules.@foreach(Locales::installed() as $locale) for dynamic UI components.Locales::info() for metadata in responses.Locales::getCurrent() for system commands.Locales::raw() or suppress type hints.composer require laravel-lang/locales). No build steps or dependencies beyond Laravel.Locales::available() in Blade/validation.
// Before
['en', 'fr', 'es'] => ['English', 'French', 'Spanish'];
// After
Locales::available()->pluck('name', 'code')
Locales::getCurrent() for user-specific locales.Locales::set() for user preferences).laravel-lang/lang, spatie/laravel-translation-loader).laravel/framework (built-in).laravel/framework.archtechx/enums (for typed locale codes).phpunit/phpunit, orchestra/testbench.config/app.php or external config repo.Locales:: methods.Locales::set() for user-specific locales (e.g., middleware, user profiles).Locales::info() to API responses for metadata.laravel-lang/lang for translation + locale metadata.LocaleData objects for custom logic (e.g., tenant-specific overrides).Locales::getCurrent() calls) for analytics.laravel-lang/locale-list. Teams can fork the repo or contribute updates via PRs.laravel-lang/locales for security updates (MIT license).withCountries, withCurrencies).LocaleData class for custom properties.Locales::raw()->get() to inspect underlying data.Locales::getFallback()).How can I help you explore Laravel packages today?