michalskoula/codeigniter-ai-translation
最新稳定版本:1.0.6
Composer 安装命令:
composer require michalskoula/codeigniter-ai-translation
包简介
This package allows you to translate your CodeIgniter 3/4 language files to any language using Antrhopic Claude REST API.
README 文档
README
Translate your CodeIgniter 3/4 language files into any language using the Anthropic Claude REST API.
It will automatically add missing translations (array elements), so you can run it periodically to update your language files. Multi-dimensional arrays are also supported.
Installation
composer require michalskoula/codeigniter-ai-translation
Requires PHP 8.1+
Usage:
<?php require_once __DIR__ . '/vendor/autoload.php'; $translator = new MichalSkoula\CodeIgniterAITranslation\Translator( 'your-api-key', // Anthropic Claude API key 'cs', // source language (need to match you directory name) 'en', // target language (need to match you directory name; will be created automatically) 'application/language', // path to your language files 3 // CodeIgniter version (3 - default, 4) ); // if $file is null, if will translate all files in the directory $result = $translator->translate($file); echo "Translation process completed." . PHP_EOL; echo "Total files processed: " . $result->getProcessed() . PHP_EOL; echo "Total items translated: " . $result->getTranslated() . PHP_EOL; echo "Total items failed: " . $result->getFailed() . PHP_EOL; if ($result->isError()) { echo 'Error: ' . $result->getErrorMessage() . PHP_EOL; }
Development
./vendor/bin/rector
./vendor/bin/ecs --fix
Links
Homepage: https://skoula.cz/blog/2024/10/how-to-translate-codeigniter-3/4-language-files-with-ai/
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-17