Looking to hire Laravel developers? Try LaraJobs

laravel-auto-lang maintained by nativecode

Description
Auto append missing Laravel translations to en.json
Last update
2026/05/20 11:30 (dev-main)
License
Links
Downloads
51

Comments
comments powered by Disqus

Laravel Auto Lang

Automatically scan Laravel translation strings and append missing translations to resources/lang/en.json.

Features

  • Scan __() translations in PHP and Blade files
  • Scan trans() translations in PHP/controllers
  • Scan t() translations in JS/TS/JSX/TSX
  • Supports local variable translation detection
  • Auto generate other language JSON files
  • Multiple translation provider fallback
  • Prevent API rate limits automatically
  • Recursive project scanning
  • Smart folder exclusions
  • Supports Laravel 10, 11, 12, and 13

Installation

composer require nativecode/laravel-auto-lang

Scan Translations

Run the scan command:

php artisan auto-lang:scan

PHP / Blade Example

{{ __('Dashboard') }}

{{ __('Plugins') }}

return trans('Welcome Back');

React / TSX Example

t('Login')

t("Register")

t(`Dashboard`)

Local Variable Example

const title = 'Settings';

t(title)

Generated:

{
    "Dashboard": "Dashboard",
    "Plugins": "Plugins",
    "Welcome Back": "Welcome Back",
    "Login": "Login",
    "Register": "Register",
    "Settings": "Settings"
}

Auto Translate JSON Files

Generate another language JSON automatically:

php artisan auto-lang:translate ta

Bulk Translate

php artisan auto-lang:translate ta ar ro

Generated:

resources/lang/ta.json
resources/lang/ar.json
resources/lang/ro.json

Translation Providers

Automatic fallback providers:

Google Translate
LibreTranslate
Lingva Translate

Rate Limit Protection

Automatic delay protection included:

usleep(300000)

to reduce API blocking risks.


Supported File Types

.php
.blade.php
.js
.ts
.jsx
.tsx

Excluded Folders

bootstrap/
config/
database/
routes/
storage/
tests/
vendor/

Supported Laravel Versions

Laravel Version Supported
10.x Yes
11.x Yes
12.x Yes
13.x Yes

Update Package

composer update nativecode/laravel-auto-lang

Run Scan Again

php artisan auto-lang:scan

Translate Language Files

php artisan auto-lang:translate ta ar ro

Example Output

Added: Dashboard
Added: Plugins
Added: Welcome Back
Added: Login
Added: Settings
Translation scan completed.

License

MIT