quarkinocom/laravel-translation-manager
Composer 安装命令:
composer require quarkinocom/laravel-translation-manager
包简介
A Laravel Artisan command package to manage and automate language translations, leveraging OpenAI for high-quality translations.
README 文档
README
The Laravel Translation Manager is an Artisan command suite designed for managing and automating the translation process in Laravel applications. Utilizing the OpenAI API, this package simplifies tasks such as displaying, comparing, translating, and repairing language files across different languages, making it a must-have for developers working on multilingual projects.
Installation
To get started, install the package through Composer:
composer require quarkinocom/laravel-translation-manager
This command automatically installs the package and registers its service provider via Laravel's package discovery.
Publishing Configuration
To customize the package's settings, such as specifying your OpenAI API key, publish the configuration file:
php artisan vendor:publish --provider="Quarkinocom\TranslationManager\TranslationManagerServiceProvider" --tag="config"
This command copies the translation-manager.php configuration file to your project's config directory.
Usage
The package introduces several Artisan commands to streamline language file management:
Show Command
Display a list of all translation files for a specified language, including the count of translation keys.
Usage:
php artisan language:translate show {language}
Sample Command:
php artisan language:translate show en
Expected Output:
+---------------------+---------------+-------+
| Directory | File | Keys |
+---------------------+---------------+-------+
| /resources/lang/en | messages.php | 10 |
| /resources/lang/en | validation.php| 42 |
+---------------------+---------------+-------+
Total files: 2
Compare Command
Compare translation files between two languages, highlighting missing or empty keys.
Usage:
php artisan language:translate compare {source-language} {target-language}
Sample Command:
php artisan language:translate compare en fr
Expected Output:
+---------------------+-----------+-----------------------+
| File | Key | Status |
+---------------------+-----------+-----------------------+
| messages.php | welcome | Missing in target |
| validation.php | required | Empty value in target |
+---------------------+-----------+-----------------------+
Differences detected: 2
Translate Command
Translate missing or empty keys from the source language to the target language. Optionally, create or update translation files.
Usage:
- To translate all keys:
php artisan language:translate translate {source-language} {target-language}
- To repair (translate only missing or empty keys):
php artisan language:translate repair {source-language} {target-language}
Sample Command:
php artisan language:translate translate en fr
Expected Result: This command will output the number of keys translated and API calls made, without a specific table format as the result is dependent on the translations performed.
Git Repository
Explore or contribute to Laravel Translation Manager on GitHub:
https://github.com/quarkinocom/laravel-translation-manager
Contributing
Contributions are welcome and greatly appreciated! Feel free to fork the repository, make your changes, and submit a pull request. For substantial changes, please open an issue first to discuss what you would like to change. Remember to update tests as needed.
quarkinocom/laravel-translation-manager 适用场景与选型建议
quarkinocom/laravel-translation-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 quarkinocom/laravel-translation-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quarkinocom/laravel-translation-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-16