定制 blumewas/laravel-locale-fallbacks 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

blumewas/laravel-locale-fallbacks

Composer 安装命令:

composer require blumewas/laravel-locale-fallbacks

包简介

Opiniated variant on how localizations should be resolved

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固