bestmomo/laravel5-artisan-language
Composer 安装命令:
composer require bestmomo/laravel5-artisan-language
包简介
Add artisan commands for language strings
README 文档
README
This package is to add artisan commands for language strings to Laravel>=5.4 project.
Because when you have all your base strings in your project you have no way to easily get them to create a JSON file for a locale. You have to check all files... So this package helps you and do that automaticaly, and do some other tasks like list all strings and synchronise a locale JSON file...
Features
Add these 4 artisan commands :
- language:strings to list all project strings (in app and resource/views folders)
- language:make to create a JSON file for the locale filled with project strings
- language:diff to show differences between locale JSON file and project strings
- language:sync to synchronise locale JSON file with project strings
Installation
Add package to your composer.json file :
composer require bestmomo/laravel5-artisan-language --dev
For Laravel 5.4 add service provider to config/app.php (with Laravel >=5.5 there is the package discovery):
Bestmomo\ArtisanLanguage\ArtisanLanguageProvider::class,
Configuration (optional)
if you need to change some parameters you can add a config file in the config path of your project which name is artisan-language.php with content like before :
<?php return [ "scan_paths" => [ app_path(), resource_path('views'), resource_path('assets/js'), ], "scan_pattern" => '/(@lang|__|\$t|\$tc)\s*(\(\s*[\'"])([^$]*)([\'"]+\s*(,[^\)]*)*\))/U', "lang_path" => resource_path('lang'), ];
Use
to generate a translation file for locale "fr" you should launch command before :
php artisan language:make fr
use option --force if the file already exists and you want overwrite it.
And it's done !
bestmomo/laravel5-artisan-language 适用场景与选型建议
bestmomo/laravel5-artisan-language 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25.48k 次下载、GitHub Stars 达 27, 最近一次更新时间为 2017 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bestmomo/laravel5-artisan-language 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bestmomo/laravel5-artisan-language 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 25.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 12
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-15