blumewas/laravel-locale-fallbacks
Composer 安装命令:
composer require blumewas/laravel-locale-fallbacks
包简介
Opiniated variant on how localizations should be resolved
README 文档
README
Opiniated variant on how localizations for an app should be loaded.
Installation
You can install the package via composer:
composer require blumewas/laravel-locale-fallbacks
You can publish the config file with:
php artisan vendor:publish --tag="laravel-locale-fallbacks-config"
This is the contents of the published config file:
return [ /** * Define the fallback chain for each locale. * The keys are the locale codes, and the values are arrays of fallback locales. * For example, if 'de' falls back to 'en', you would set: * 'de' => ['en']. * This means that if a translation is not found in 'de', it will look for * the translation in 'en'. * You can define multiple fallbacks for a locale. * For example, 'de' => ['en', 'fr'] means it will first * try 'en', and if not found, it will try 'fr'. * A fallback chain is also composed. E.g. if 'de' falls back to 'en', * and 'de-DE' falls back to 'de', we will first try 'de-DE', * then 'de', and finally 'en'. This would be equivalent to: * 'de-DE' => ['de', 'en'], * 'de' => ['en']. */ 'fallbacks' => [ 'de' => ['en'], ], /** * Whether to automatically add two-letter language codes as fallbacks. * This is useful for apps that have regional variations of languages * (e.g., 'en-US' and 'en-GB') and want to ensure that * the two-letter code ('en') is always available as a fallback. */ 'autofallback_two_letter_codes' => true, ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-16