ejesus/laravel-auto-translator
Composer 安装命令:
composer require ejesus/laravel-auto-translator
包简介
A Laravel package that leverages the DeepL Translation API to automatically translate all your language files based on an existing translation, making multilingual projects faster and easier to manage.
README 文档
README
A Laravel package that automatically translates content based on user input. This package allows users to specify a source language (--from) and a target language (--to), supporting multiple target languages by separating them with commas (e.g., pt,es). The package uses Deepl API for translation, requiring an API key to work.
Installation
- Install the package via Composer:
composer require edgar/laravel-auto-translator
- Add the API key to your
.envfile: To use Deepl API, you need to obtain an API key from Deepl (https://www.deepl.com/pro) and set it in your.envfile.
TRANSLATE_API_KEY=your_deepl_api_key
Usage
You can use the package with the following Artisan command:
php artisan translator:run --from=<source_language> --to=<target_languages>
Parameters
--from: The source language code (e.g.,enfor English,defor German).--to: The target language(s) for translation. You can specify multiple target languages by separating them with commas (e.g.,pt,esfor Portuguese and Spanish).
Example
To translate from English (en) to Portuguese (pt) and Spanish (es):
php artisan translator:run --from=en --to=pt,es
This command will automatically translate your content from English to both Portuguese and Spanish using Deepl API.
Requirements
-
Deepl API Key: You need to create an account on Deepl and generate an API key. Place the key in your
.envfile under the variableTRANSLATE_API_KEY. -
Laravel 8 or higher.
Notes
- The translation will be done based on the API capabilities of Deepl. If Deepl API has any rate limits or issues, the translation process might be delayed.
- The
--fromand--tolanguages should use standard ISO language codes (e.g.,en,es,de, etc.). - If multiple target languages are provided, the content will be translated and saved for each target language specified.
License
This package is open source and available under the MIT License.
ejesus/laravel-auto-translator 适用场景与选型建议
ejesus/laravel-auto-translator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ejesus/laravel-auto-translator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ejesus/laravel-auto-translator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-25