PHPackages                             rdosgroup/gpt-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. rdosgroup/gpt-translate

ActiveLaravel-package[Localization &amp; i18n](/categories/localization)

rdosgroup/gpt-translate
=======================

A Laravel package to create a base translation file, and translate it to any language with ChatGPT API

1.1.5(1y ago)9218↓50%5MITPHPPHP ^8.3

Since Aug 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/rdosgroup/gpt-translate)[ Packagist](https://packagist.org/packages/rdosgroup/gpt-translate)[ RSS](/packages/rdosgroup-gpt-translate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

GPT-Translate for Laravel
=========================

[](#gpt-translate-for-laravel)

`gpt-translate` is a package for Laravel that allows you to generate and translate language files using the power of OpenAI's ChatGPT API. The package supports translations in multiple languages, including English, Spanish, French, German, Italian, and Portuguese. You can call these strings using `__()`, `@lang()`, `$t()`, or `trans()`, and they can be located in php, js, ts, or vue files.

Furthermore, `gpt-translate` enables you to translate your base language file, whether you previously had it or generated it using the package, to other languages using the ChatGPT API. Supported languages for translation include English, Spanish, French, German, Italian, and Portuguese.

New Features
============

[](#new-features)

- Automatically generate base translation files by scanning your application for translation strings.
- Translate your base language file to other languages using the ChatGPT API.
- Provide custom context for more accurate translations.
- Exclude specific words or phrases from being translated.
- Support for different models (e.g., GPT-3.5, GPT-4).

Getting Started
---------------

[](#getting-started)

**Installation**
Install the package using composer:

```
composer require rdosgroup/gpt-translate
```

**Add Service Provider**Add the following to your `config/app.php` file:

```
'providers' => [
    ...
    Rdosgroup\GptTranslate\TranslateProvider::class,
    ...
],
```

**Publish the Configuration File**
You need to publish the `openai.php` configuration file:

```
php artisan vendor:publish
```

**Environment Configuration**
Add the `OPENAI_API_KEY` and `OPENAI_ORGANIZATION` and `GPT_TRANSLATE_DEFAULT_CONTEXT` and `GPT_TRANSLATE_EXCLUDE_WORDS` variables to your `.env` file with the details from your OpenAI account.

**Generate Base Translation File**
If you don’t already have a base translation file, generate it using:

```
php artisan translate:make --lang=en
```

As shown, this command creates a `lang/en.json` in your root folder. If your application is in another language, pass the appropriate `lang` parameter, e.g., for French:

```
php artisan translate:make --lang=fr
```

**Translate with ChatGPT**
After having your base translation file, whether generated by the package or otherwise, run the translation command for ChatGPT to do the translation, e.g.:

```
php artisan translate:lang --origin=en --lang=fr
```

This translates the original `en.json` to French and creates a new `fr.json` file.

**Provide Context (Optional)**
For more accurate translations, briefly describe the context of your application’s purpose. This helps ChatGPT better understand and translate the text. Use the `context` parameter:

```
php artisan translate:lang --origin=en --lang=fr --context="a pet product sales application"
```

**Exclude Specific Words or Phrases from Translation (Optional)**You can specify words or phrases that should not be translated. This is useful for brand names, technical terms, or other content that must remain in the original language:

```
php artisan translate:lang --origin=en --lang=fr --exclude="Laravel,Eloquent,PHP"
```

**Specify the Model (Optional)**
By default, the package uses GPT-4o. If desired, specify any other OpenAI model compatible with the Chat API:

```
php artisan translate:lang --origin=en --lang=fr --model=gpt-4o-mini
```

**Specify the Resource Path**
By default, the package scans the `lang` folder for translation strings. If your translation strings are located elsewhere, specify the path:

```
php artisan translate:lang --origin=en --lang=fr --path=./lang/vendor/nova
```

**Configuration for Context and Exclusions (Optional)**

```
php artisan vendor:publish --tag=gpt-translate-config
```

Then, you can customize the default context and exclusions in the `config/gpt-translate.php` file

```
return [
  'default_context' => env('GPT_TRANSLATE_DEFAULT_CONTEXT', 'Your default context here'),
  'exclude_words' => explode(',', env('GPT_TRANSLATE_EXCLUDE_WORDS', 'Laravel,Eloquent,PHP')),
];
```

Example Usage with All Parameters
=================================

[](#example-usage-with-all-parameters)

```
php artisan translate:lang --origin=en --lang=fr --context="a tech startup specializing in AI products" --exclude="ChatGPT,OpenAI,Laravel" --model=gpt-4 --path=./lang/vendor/nova
```

Conclusion
----------

[](#conclusion)

Leverage the power of ChatGPT and the flexibility of `gpt-translate` to localize your Laravel application effectively and efficiently. With the ability to provide context, exclude specific terms, and choose the model, `gpt-translate` ensures that your translations are accurate and appropriate for your application's needs.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance45

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

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 ~83 days

Recently: every ~4 days

Total

8

Last Release

426d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.1.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6d89ac427839c704b43833a51c2b8bf1b525ddae47014a084ca9939b33e534a?d=identicon)[richxgc](/maintainers/richxgc)

---

Top Contributors

[![richxgc](https://avatars.githubusercontent.com/u/1498225?v=4)](https://github.com/richxgc "richxgc (16 commits)")

### Embed Badge

![Health badge](/badges/rdosgroup-gpt-translate/health.svg)

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

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[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.4M491](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

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

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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