fidum/laravel-translation-linter
最新稳定版本:3.0.0
Composer 安装命令:
composer require fidum/laravel-translation-linter
包简介
Commands to help you keep your laravel translations organized.
README 文档
README
This package provides commands to help you keep your translations organized.
Shoutout to Hexadog for their package laravel-translation-manager which was used as the foundation for this package.
Installation
You can install the package via composer:
composer require --dev fidum/laravel-translation-linter
You can publish the config file with:
php artisan vendor:publish --tag="translation-linter-config" Click here to see the contents of the config file.
You should read through the config, which serves as additional documentation and make changes as needed.
Missing Command
This reads through all your code and finds all your language function usage. Then attempts to find matches in your language files and will output any keys in your code that do not exist as a language key.
$ php artisan translation:missing ERROR 3 missing translations found. +--------+--------------------------------+---------------------+ | Locale | Key | File | +--------+--------------------------------+---------------------+ | en | Missing PHP Class | app/ExampleJson.php | | en | Only Missing English PHP Class | app/ExampleJson.php | | de | Missing PHP Class | app/ExampleJson.php | +--------+--------------------------------+---------------------+
You can generate a baseline file which will be used to ignore specific keys with the --generate-baseline or -b command options:
$ php artisan translation:missing --generate-baseline INFO Baseline file written with 49 translation keys. $ php artisan translation:missing INFO No missing translations found! Unused Command
This reads through all your code and finds all your language function usage. Then attempts to find matches in your language files and will output any language keys that are not being used in your code.
Note: Some language keys are filtered out by default, you can change the filters used in the config file.
$ php artisan translation:unused ERROR 5 unused translations found. +--------+----------------------+-----------------------------------------------+ | Locale | Key | Value | +--------+----------------------+-----------------------------------------------+ | en | Unused PHP Class | I am unused in php class | | en | Unused Blade File | I am unused in blade | | en | Unused Vue Component | I am unused in vue component | | en | example.unused | I am unused in php class | | de | example.unused | Ich werde in einer PHP-Klasse nicht verwendet | +--------+----------------------+-----------------------------------------------+
You can generate a baseline file which will be used to ignore specific keys with the --generate-baseline or -b command options:
$ php artisan translation:unused --generate-baseline INFO Baseline file written with 5 unused translation keys. $ php artisan translation:unused INFO No unused translations found! 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.
统计信息
- 总下载量: 60.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04