nativecode / laravel-auto-lang
Auto append missing Laravel translations to en.json
2.0.2
2026-05-20 09:30 UTC
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
README
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