coding-socks/lost-in-translation
Composer 安装命令:
composer require coding-socks/lost-in-translation
包简介
This package helps to find missing translation strings in your Laravel blade files
README 文档
README
This package helps to find missing translation strings in your Laravel blade files.
Installation
You can easily install this package using Composer, by running the following command:
composer require coding-socks/lost-in-translation --dev
Usage
You can list all missing translation for a specific location using the command below.
php artisan lost-in-translation:find {locale}
Example:
php artisan lost-in-translation:find nl
It is sometimes recommended to increase the verbosity using -v flag. In verbose mode the command will print warnings and errors to the standard output.
Publish
Publish the configuration file only:
php artisan vendor:publish --tag=lost-in-translation-config
Publish the Command class only:
php artisan vendor:publish --tag=lost-in-translation-commands
Defaults
The command considers app.locale as your applications default locale.
The command scans your lang directory for comparison with the default and target locale.
The command scans your app, and resources/views directory for translation retrieval.
The command detects the following in your blade and application files:
@lang('key')Blade directives are compiled toapp('translator')->get('key')__('key')any call to the__functiontrans('key')any call to thetransfunctiontrans_choice('key', x)any call to thetrans_choicefunctionapp('translator')->get('key')any directgetmethod call on thetranslatorApp::make('translator')->get('key')any directgetmethod call on thetranslatorLang::get('key')anygetstatic call on theLangfacade<<<'blade'inline components in nowdoc withbladelabel are compiled and their content is scanned.
Help
Description:
Find missing translation strings in your Laravel blade files
Usage:
lost-in-translation:find [options] [--] <locale>
Arguments:
locale The locale to be checked
Options:
--sorted Sort the values before printing
--no-progress Do not show the progress bar
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Implementation
This implementation reads all your blade files, compiles them to PHP (illuminate/view), parses them as PHP (nikic/php-parser), and then finds the relevant nodes in the AST.
This, in my opinion, is a cleaner and less error-prone than using regular expressions.
coding-socks/lost-in-translation 适用场景与选型建议
coding-socks/lost-in-translation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 173.13k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2024 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 coding-socks/lost-in-translation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coding-socks/lost-in-translation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 173.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-15