pablobae/module-simple-ai-translator
Composer 安装命令:
composer require pablobae/module-simple-ai-translator
包简介
AI-powered translation module for Magento 2, enabling seamless integration with services like DeepL and ChatGPT for automated language translation. Provides configurable translation settings, language pairs, and model types for enhanced localization and multi-language store capabilities.
关键字:
README 文档
README
SimpleAiTranslator is a Magento 2 extension that provides intelligent translation services by integrating with AI-powered APIs, including ChatGPT and DeepL, to offer easy and efficient multilingual content management.
Features
- ChatGPT Integration: Translate text using OpenAI's powerful ChatGPT API.
- DeepL Integration: Utilize DeepL for high-quality translation.
- Admin Configuration: Fully configurable via Magento Admin (
Stores > Configuration). - Unit Tests: Ensures reliable performance and quality.
- Error handling and logging
- Command-line interface for translations
- Unit Tests: Ensures reliable performance and quality.
Requirements
- Magento 2.4.x
- PHP 8.1 or higher
- DeepL API key (Free or Pro) and/or ChatGPT API key
Installation
Using Composer
composer require pablobae/module-simple-ai-translator bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean
Manual Installation
- Create the following directory in your Magento installation:
app/code/Pablobae/SimpleAiTranslator
- Download the module and copy its contents to the above directory
- Enable the module:
bin/magento module:enable Pablobae_SimpleAiTranslator bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean
Configuration
Navigate to Stores > Configuration > Pablobae Extensions > Simple AI Translator
Getting API Keys
DeepL API Key
- Visit DeepL API Account
- Sign up for a DeepL API account (Free or Pro)
- Access your API key from the account dashboard
- Use api-free.deepl.com for Free API or api.deepl.com for Pro API
ChatGPT API Key
- Visit OpenAI Platform
- Create or log into your OpenAI account
- Navigate to API Keys section
- Create a new secret key
- Store the key securely as it won't be shown again
Configuration Options
General
- Enable/Disable module
- Select AI Engine (DeepL or ChatGPT)
DeepL Settings
- API Key
- API Domain (Free/Pro)
- Default languages
- Advanced translation options
ChatGPT Settings
- API Key
- Model selection
- Temperature
- Default languages
- Request timeout
Usage
Admin Panel
The extension integrates with Magento's product management interface, allowing you to:
- Translate product descriptions
- Translate product attributes
Command Line
Use the CLI command for batch translations:
bin/magento pablobae:translate --text 'text to be translated' --language 'es'
Programmatic Usage
use Pablobae\SimpleAiTranslator\Service\Translator; class YourClass { public function __construct( private readonly Translator $translator ) {} public function translate(string $text, ?string $storeId = null): string { return $this->translator->translate($text, $storeId); } }
Supported Languages
DeepL API Languages
- English (US & UK)
- German
- French
- Spanish
- Italian
- Dutch
- Polish
- Portuguese (BR & PT)
- Russian
- Japanese
- Chinese And more...
ChatGPT Languages
ChatGPT supports a broader range of languages including:
- All major European languages
- Asian languages (Chinese, Japanese, Korean)
- Arabic
- Hindi
- African languages
- Indigenous languages And many more, as ChatGPT can understand and generate content in most world languages.
Note: While ChatGPT supports more languages, DeepL typically provides more accurate translations for its supported language pairs.
Error Handling
The extension includes comprehensive error handling for:
- Invalid/expired API keys
- Rate limits and quota exceeded
- Network timeouts
- Invalid language codes
- Malformed responses
Testing
Unit tests are provided to verify the core functionalities of the API clients (ChatGPT and DeepL). To run the tests:
- From the Magento root directory, execute:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml
Make sure you have PHPUnit installed and configured for Magento.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and feature requests, please create an issue.
Alternatively, you can also join my Slack channel
License
This project is licensed under the GNU General Public License v3.0 or later. See the LICENSE file for details.
Credits
Developed by Pablo César Baenas Castelló (while testing AI agents)
www.pablobaenas.com | www.aradaen.com
pablobae/module-simple-ai-translator 适用场景与选型建议
pablobae/module-simple-ai-translator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ecommerce」 「translator」 「localization」 「multi-language」 「ai」 「magento2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pablobae/module-simple-ai-translator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pablobae/module-simple-ai-translator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pablobae/module-simple-ai-translator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Package for convenient work with Laravel's localization features
Field for number with restricted count of digits and decimal places
Nevogate Payment Gateway SDK
Deepl Automated translations for Laravel lang files
Dealing with payments through the Egyptian payment gateway PayMob
A PHP (and Laravel) package to interface with the Snipcart api.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-04-22
