bottelet/translation-checker
Composer 安装命令:
composer require bottelet/translation-checker
包简介
A translation checker package for Laravel, find, add, and translate missing strings
README 文档
README
Easily translate missing translations with AI, find missing translations you forgot to add to your language files, and maintain translations in your project. It provides a set of commands to help with language files, ensuring consistency and completeness across your translations. It works with Laravel and supports various frontend frameworks like Vue.js, React, and Svelte.
This package is only intended for Laravel's recommended approach to handle translation files. See Laravel Docs
How it works
- Scan Source Files: The system looks through your code for strings that need translation.
- Check Language Files: It then checks if these strings exist in your language files.
- Use AI to translate missing keys: It adds the missing key with empty values if there is no translation service used.
Example:
lang.json
{
"test.value": "Value"
}
lang.php
return [ 'test.value' => 'Value', ];
TestClass.php
class TestClass { public function getValue() { return __('translate this string'); } }
php artisan translations:check en
lang.json
{
"test.value": "Value",
"translate this string": null
}
lang.php
return [ 'test.value' => 'Value', 'translate this string' => null, ];
The reason we default to null when no translation service are used is because it defaults to the key used in the function call.
Quick Start
Install the package via composer:
composer require bottelet/translation-checker --dev
Usage
Translation Checker provides several commands to manage your translations. The most versatile is the check command:
php artisan translations:check en
You can also easily find all sync translations between all files:
php artisan translations:sync en
This will take all translations from the source files and sync them to all your other language files.
For detailed information on all available commands and their usage, refer to the documentation.
Testing
Run the tests with:
./vendor/bin/phpunit
Run PHPStan to check for code quality:
./vendor/bin/phpstan
Documentation
For full documentation, visit our GitHub documentation page.
If you encounter any issues or have suggestions, please create an issue on GitHub.
License
The MIT License (MIT). Please see License File for more information.
bottelet/translation-checker 适用场景与选型建议
bottelet/translation-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 61.01k 次下载、GitHub Stars 达 131, 最近一次更新时间为 2024 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bottelet/translation-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bottelet/translation-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 61.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 131
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-17