PHPackages                             visualbuilder/ai-translate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. visualbuilder/ai-translate

ActiveLibrary[Localization &amp; i18n](/categories/localization)

visualbuilder/ai-translate
==========================

Translate localisation files with AI

1.0.12(2y ago)154.0k↓33.3%1[1 issues](https://github.com/visualbuilder/ai-translate/issues)GPL-2.0-or-laterPHPPHP ^8.1

Since Jul 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/visualbuilder/ai-translate)[ Packagist](https://packagist.org/packages/visualbuilder/ai-translate)[ Docs](https://github.com/visualbuilder/ai-translate)[ RSS](/packages/visualbuilder-ai-translate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (15)Used By (0)

AI Translator for Laravel locales
=================================

[](#ai-translator-for-laravel-locales)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b28d09281658cc0c8a4a7276cdea88a037f50736403c9953287e6a258d44fcc9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76697375616c6275696c6465722f61692d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visualbuilder/ai-translate)[![Total Downloads](https://camo.githubusercontent.com/49e37f924b2589ea619ad315e77266bae25fb20658f4f7a5068ddd1e90297aa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76697375616c6275696c6465722f61692d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visualbuilder/ai-translate)[![run-tests](https://github.com/visualbuilder/ai-translate/actions/workflows/run-tests.yml/badge.svg)](https://github.com/visualbuilder/ai-translate/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/visualbuilder/ai-translate/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/visualbuilder/ai-translate/actions/workflows/php-cs-fixer.yml)

[![Example](./media/translationBanner.png)](./media/translationBanner.png)

- Just set a list of languages that you would like your site translating to and leave it to GPT.
- Can use GPT-3.5-turbo or GPT-4
- Estimates cost before running
- More accurate than Google Translate
- Handles variables in the translation string - they will not be translated.
- Handles both PHP and JSON files
- Model translations coming soon

Examples
--------

[](#examples)

Examples:- From English:

- 'accepted' =&gt; 'The :attribute must be accepted.',
- 'accepted\_if' =&gt; 'The :attribute must be accepted when :other is :value.',

To Arabic:-

- 'accepted' =&gt; 'يجب قبول الـ :attribute',
- 'accepted\_if' =&gt; 'يجب قبول الـ :attribute عندما يكون الـ :other هو :value',

To Ukrainian:-

- 'accepted' =&gt; ':attribute має бути прийнятий.',
- 'accepted\_if' =&gt; ':attribute має бути прийнятий, коли :other є :value.',

To German:-

- 'accepted' =&gt; 'Die :attribute müssen akzeptiert werden.',
- 'accepted\_if' =&gt; 'Die :attribute müssen akzeptiert werden, wenn :other :value ist.',

To Spanish:-

- 'accepted' =&gt; 'El :attribute debe ser aceptado.',
- 'accepted\_if' =&gt; 'El :attribute debe ser aceptado cuando :other es :value.',

To Chinese Simplified:-

- 'accepted' =&gt; ':attribute必须被接受。',
- 'accepted\_if' =&gt; '当:attribute是:other时，:value必须被接受。',

To Swedish:-

- 'accepted' =&gt; ':attribute måste accepteras.',
- 'accepted\_if' =&gt; ':attribute måste accepteras när :other är :value.',

Requirements
------------

[](#requirements)

PHP 8.1 Is the minimum for the OpenAI Wrapper.

Tested with Laravel ^9.45 and 10.x

Filament is not required (but can add to their already awesome set of translations.)

Installation
------------

[](#installation)

Download the package via composer:

```
composer require visualbuilder/ai-translate
```

Run the install to copy the config files:-

```
php artisan vb:ai:install
```

This will create `config/ai-translate.php` and `config/openai.php` if it isn't already installed.

If you don't have GPT keys already visit:

Add these keys to your .env

```
OPENAI_API_KEY=sk-xxxxxxx
OPENAI_ORGANIZATION=org-xxxxxx
```

Usage
-----

[](#usage)

Check the config file to make sure you have included the required source locale directories. Copy from the list of known\_locales the languages you wish to translate into the target\_locales array.

Currently handles `.json` and `.php` translation files. Attribute tokens should remain unchanged. This was a challenge as GPT-3.5 refused to ignore :attribute and always translated it even when told explicity to ignore it. To solve this all tokens are replaced with \*\*\* before translation and added back in after translation ensuring continuity.

[![php artisan vb:ai:translate --help](./media/help.png)](./media/help.png)

To run the script:-

```
php artisan vb:ai:translate
```

The script will scan all the source\_directories for translation files and then provide an estimate of the cost to translate into the required languages for each GPT Model.

If you're happy to continue, select the model you wish to use and each source file will be translated.

[![php artisan vb:ai:translate](./media/screenshot.png)](./media/screenshot.png)

If the target file exists, only new keys not in the target will be translated. Unless you use the --force option which will overwrite any existing translations.

I will be adding additional capabilities for model translations and for Spatie Language lines. I have these in a couple of projects so want to extend features.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lee Evans](https://github.com/visualbuilder)

License
-------

[](#license)

The GNU GPLv3. Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

1042d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.0.11PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/133e7275d57b3053e870a66332b987ae0be489e1c61938f22196d42cf19d2be9?d=identicon)[ekoukltd](/maintainers/ekoukltd)

---

Top Contributors

[![cannycookie](https://avatars.githubusercontent.com/u/500822?v=4)](https://github.com/cannycookie "cannycookie (32 commits)")

---

Tags

visualbuilderai-translate

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/visualbuilder-ai-translate/health.svg)

```
[![Health](https://phpackages.com/badges/visualbuilder-ai-translate/health.svg)](https://phpackages.com/packages/visualbuilder-ai-translate)
```

###  Alternatives

[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
