定制 genius-asif/laravel-lang-ai-translate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

genius-asif/laravel-lang-ai-translate

最新稳定版本:v1.0.1

Composer 安装命令:

composer require genius-asif/laravel-lang-ai-translate

包简介

A Laravel package to automate the translation from (en) language files to other languages using LLM APIs.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Package Logo

Laravel Language AI Translate

Effortlessly translate your Laravel language files from English to multiple languages using powerful AI APIs like Google Gemini, OpenAI, and DeepSeek. Automate your localization workflow and reach a global audience with ease.

Key Features

  • AI-Powered Translation: Leverage the capabilities of Google Gemini, OpenAI, and DeepSeek for accurate and efficient translations.
  • Automated Workflow: Simplify your translation process by automating the translation of entire language files.
  • Multiple Language Support: Translate to a wide range of languages supported by the integrated AI APIs.
  • Easy Integration: Seamlessly integrate into your Laravel project with a simple Artisan command.
  • Configurable Providers: Easily switch between different AI translation providers based on your needs and preferences.

Prerequisites

  • PHP 8.3 or higher
  • Laravel 11 or higher

Installation

You can install the package via Composer:

composer require genius-asif/laravel-lang-ai-translate

Publish the configuration file:

php artisan vendor:publish

This will create a config/lang-ai-translation.php file where you can configure your LLM API keys and language settings.

Configuration:

Open the config/lang-ai-translation.php file and add your API keys for the desired translation providers:

<?php

return [
    'languages' => [
        'hi' => 'Hindi',
        'es' => 'Spanish',
        'fr' => 'French',
        'ur' => 'Urdu',
    ],
    'providers' => [
        'google_gemini' => [
            'key' => env('GOOGLE_GEMINI_API_KEY', ''),
            'url' => env('GOOGLE_GEMINI_API_URL', '[https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=](https://www.google.com/search?q=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent%3Fkey%3D)' . env('GOOGLE_GEMINI_API_KEY')),
        ],
        'openai' => [
            'key' => env('OPENAI_API_KEY', ''),
            'url' => env('OPENAI_API_URL', '[https://api.openai.com/v1/chat/completions](https://api.openai.com/v1/chat/completions)'),
        ],
        'deepseek' => [
            'key' => env('DEEPSEEK_API_KEY', ''),
            'url' => env('DEEPSEEK_API_URL', '[https://api.deepseek.com/chat/completions](https://api.deepseek.com/chat/completions)'),
        ],
    ],
];

Ensure you add the corresponding API keys to your .env file.

Usage

Use the following Artisan command to translate your language files:

php artisan translate:lang

The command will prompt you to:

  1. Select the target language.
  2. Choose the AI translation provider.

alt text

The package will then automatically translate your language files from the lang/en directory to the selected language directory.

Testing

Coming soon...

Contributing

We'd love your help making the package even better! Feel free to submit a pull request or open an issue for any enhancements or bug fixes. Everyone's welcome! 🎉

Credits

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固