PHPackages                             adiartawibawa/language-generator - 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. adiartawibawa/language-generator

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

adiartawibawa/language-generator
================================

A Laravel package to generate and translate language files using Google Translate

v1.0.0(1y ago)023MITPHPPHP &gt;=7.4

Since Aug 5Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Language Generator
==================

[](#language-generator)

`language-generator` is a Laravel package that allows you to generate and translate language files from one language to another using Google Translate.

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

[](#installation)

You can install the package via Composer:

```
composer require adiartawibawa/language-generator
```

### Service Provider Registration

[](#service-provider-registration)

If you are using Laravel 5.5 or later, the service provider will be automatically registered. For earlier versions of Laravel, you need to manually add the service provider in your `config/app.php` file:

```
'providers' => [
    // Other service providers...
    Adiartawibawa\LanguageGenerator\LanguageGeneratorServiceProvider::class,
],
```

### Configuration

[](#configuration)

To publish the configuration file, run the following command:

```
php artisan vendor:publish --provider="Adiartawibawa\LanguageGenerator\LanguageGeneratorServiceProvider" --tag="config"
```

This will create a `language-generator.php` configuration file in your `config` directory. You can customize the configuration as needed.

Usage
-----

[](#usage)

Once the package is installed and configured, you can use it via Artisan commands to generate and translate language files.

### Commands

[](#commands)

The package provides an Artisan command for generating and translating language files.

#### Generating and Translating Language Files

[](#generating-and-translating-language-files)

To generate and translate language files from one language to another, use the following command:

```
php artisan lang:generate {from} {to*} {--file=} {--json}
```

**Arguments:**

- `{from}`: The source language code.
- `{to*}`: The target language codes (you can specify multiple target languages).

**Options:**

- `--file=`: (Optional) Specify a particular file to translate.
- `--json`: (Optional) If specified, the source language file is assumed to be a JSON file.

**Examples:**

- Generate and translate all language files from English to Spanish and French:

    ```
    php artisan lang:generate en es fr
    ```
- Translate a specific file from English to Spanish:

    ```
    php artisan lang:generate en es --file=messages.php
    ```
- Translate a JSON file from English to Spanish:

    ```
    php artisan lang:generate en es --json
    ```

### Example Workflow

[](#example-workflow)

1. **Generating and Translating Language Files**

    Generate and translate language files from English to Spanish and French:

    ```
    php artisan lang:generate en es fr
    ```

    This will create Spanish and French language files with translated strings.
2. **Translating a Specific File**

    Translate the `messages.php` file from English to Spanish:

    ```
    php artisan lang:generate en es --file=messages.php
    ```
3. **Translating a JSON File**

    Translate the `lang/en.json` file to Spanish:

    ```
    php artisan lang:generate en es --json
    ```

Configuration Options
---------------------

[](#configuration-options)

The `language-generator.php` configuration file contains various options that you can customize:

```
return [
    /*
    |--------------------------------------------------------------------------
    | Google Translate API Endpoint
    |--------------------------------------------------------------------------
    |
    | This value determines the endpoint used to communicate with the Google
    | Translate API. You may change this value to any other endpoint if necessary.
    |
    */
    'api_endpoint' => 'https://translate.googleapis.com/translate_a/single?client=gtx',

    /*
    |--------------------------------------------------------------------------
    | Default Source Language
    |--------------------------------------------------------------------------
    |
    | This value determines the default source language code that will be used
    | when generating and translating language files if no source language is specified.
    |
    */
    'default_source_language' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Default Target Languages
    |--------------------------------------------------------------------------
    |
    | This value determines the default target languages that will be used
    | when generating and translating language files if no target languages are specified.
    |
    */
    'default_target_languages' => ['fr', 'es', 'de'],

    /*
    |--------------------------------------------------------------------------
    | Retry Settings
    |--------------------------------------------------------------------------
    |
    | These values determine the retry settings when making requests to the Google
    | Translate API. You can specify the number of retries and the interval between retries.
    |
    */
    'retry_attempts' => 3,
    'retry_interval' => 100, // in milliseconds

    /*
    |--------------------------------------------------------------------------
    | Progress Bar Settings
    |--------------------------------------------------------------------------
    |
    | This value determines the format of the progress bar displayed during the
    | translation process.
    |
    */
    'progress_bar_format' => ' %current%/%max% [%bar%] %percent:3s%% -- %message%',
];
```

License
-------

[](#license)

This package is open-source and licensed under the MIT license.

Troubleshooting
---------------

[](#troubleshooting)

If you encounter any issues, ensure you have the necessary configurations set up in the `language-generator.php` configuration file. Check for any API limitations or errors from Google Translate as well.

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

[](#contributing)

Contributions are welcome! Please open an issue or submit a pull request for any bugs or feature requests.

Contact
-------

[](#contact)

For any questions or inquiries, please contact Adi Arta Wibawa at .

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

645d ago

### Community

Maintainers

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

---

Top Contributors

[![adiartawibawa](https://avatars.githubusercontent.com/u/75978314?v=4)](https://github.com/adiartawibawa "adiartawibawa (2 commits)")

---

Tags

laravellanguagetranslategoogle-translate

### Embed Badge

![Health badge](/badges/adiartawibawa-language-generator/health.svg)

```
[![Health](https://phpackages.com/badges/adiartawibawa-language-generator/health.svg)](https://phpackages.com/packages/adiartawibawa-language-generator)
```

###  Alternatives

[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

543638.1k4](/packages/codezero-laravel-localized-routes)[zachleigh/laravel-lang-bundler

Create Laravel translations bundles.

2512.5k](/packages/zachleigh-laravel-lang-bundler)

PHPackages © 2026

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