承接 ibrahimamasha/autotranslator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ibrahimamasha/autotranslator

最新稳定版本:2.1.0

Composer 安装命令:

composer require ibrahimamasha/autotranslator

包简介

Automatically translate Laravel JSON files using AI or free tools.

README 文档

README

Laravel AutoTranslator is a simple Laravel package to automate translating your language files — ideal for bilingual projects like Arabic/English.

It scans your code for translation keys, fills in missing entries in lang/en.json, and auto-translates them into Arabic (lang/ar.json) using MyMemory or DeepL.

Features

  • Scans Blade and PHP files for __() and @lang() keys
  • Auto-generates lang/en.json and lang/ar.json
  • Uses MyMemory by default (free, no API key)
  • Fallback support for DeepL (requires API key, 500k characters/month free)
  • Works with just two Artisan commands

Installation

composer require ibrahimamasha/autotranslator

Configuration (Optional)

Publish the config file:

php artisan vendor:publish --tag=config

Example config/autotranslator.php:

return [
    'source' => 'en',
    'target' => 'ar',
    'driver' => 'mymemory', // default: free, no key needed

    'mymemory' => [
        'email' => env('MYMEMORY_EMAIL'),
        'key' => env('MYMEMORY_KEY'),
    ],

    'deepl' => [
        'key' => env('DEEPL_KEY'), // required if using DeepL
    ],
];

MyMemory is the default driver and works without an API key.
DeepL offers more accurate results, but requires an API key (500,000 free characters/month).

Usage

1. Create translation files

php artisan translate:setup

2. Scan and translate

php artisan translate:scan

Example

For this code:

__('Dashboard')
@lang('No messages yet')

The package generates:

{
  "Dashboard": "Dashboard",
  "No messages yet": "No messages yet"
}
{
  "Dashboard": "لوحة التحكم",
  "No messages yet": "لا توجد رسائل بعد"
}

Author

Ibrahim Amasha
LinkedIn
GitLab

License

MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-07-04