Download the PHP package nativecodein/laravel-translation-scanner without Composer
On this page you can find all versions of the php package nativecodein/laravel-translation-scanner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nativecodein/laravel-translation-scanner
More information about nativecodein/laravel-translation-scanner
Files in nativecodein/laravel-translation-scanner
Package laravel-translation-scanner
Short Description Laravel translation scanner that auto-extracts __(), trans() and t() strings from PHP, Blade, and Inertia React (JS/TS/JSX/TSX) files into resources/lang/en.json. Supports Laravel 10, 11, 12 and 13.
License MIT
Homepage https://github.com/nativecodein/laravel-translation-scanner
Informations about the package laravel-translation-scanner
Laravel Translation Scanner
Laravel Translation Scanner is a zero-config Laravel package that scans your entire project — PHP, Blade, and Inertia React (JS / TS / JSX / TSX) files — and automatically appends every missing translation string to resources/lang/en.json.
Stop manually copy-pasting strings into your language files. Run one Artisan command and ship i18n-ready Laravel apps in seconds.
Works seamlessly with Laravel + Inertia.js + React, Blade, and pure PHP controllers. Supports Laravel 10, 11, 12, and 13.
Why Laravel Translation Scanner?
- Automatic discovery — finds every
__(),trans(), andt()call across your codebase - Inertia React aware — scans
.js,.ts,.jsx, and.tsxfiles fort("..."),t(\...`), andt(variable)` usage - Local-variable resolution — resolves
const title = "Settings"; t(title)and addsSettings - Auto translation support — generate translated JSON language files instantly
- Bulk translate support — translate multiple locales in one command
- Provider fallback system — automatically switches between translation providers
- Rate-limit protection — built-in delay handling to reduce API blocking
- Non-destructive — only appends missing keys; never overwrites your existing translations
- Sorted output — keys are alphabetically sorted in
en.jsonfor clean diffs - Smart exclusions — skips
vendor/,node_modules/,bootstrap/,storage/,tests/, and other noise - Zero configuration — install and run
Installation
Install via Composer:
The service provider is auto-discovered. No further setup required.
Scan Translations
Run the scanner from your Laravel project root:
The command will:
- Read existing
resources/lang/en.json(or create it if missing). - Recursively scan your project for translatable strings.
- Append any missing keys with the key as the default value.
- Save the sorted
en.jsonback to disk.
Auto Translate Language Files
Generate translated language JSON files automatically:
Example generated file:
Bulk Translate
Translate multiple languages in one command:
Generated:
Translation Providers
The package automatically falls back between:
If one provider fails, the next provider is used automatically.
Rate Limit Protection
Built-in API protection:
This helps reduce temporary API blocking from free translation services.
Supported Translation Patterns
PHP / Blade
Inertia React / JS / TS / JSX / TSX
Local Variable Resolution
Example Output
After running php artisan translations:scan, your resources/lang/en.json:
Console output:
Supported File Types
| Extension | Scans For |
|---|---|
.php |
__('...'), trans('...') |
.blade.php |
__('...'), trans('...') |
.js |
t('...'), t(\...`),t(variable)` |
.ts |
t('...'), t(\...`),t(variable)` |
.jsx |
t('...'), t(\...`),t(variable)` |
.tsx |
t('...'), t(\...`),t(variable)` |
Excluded Folders
The scanner automatically skips these directories:
Supported Laravel Versions
| Laravel | Status |
|---|---|
| 10.x | Supported |
| 11.x | Supported |
| 12.x | Supported |
| 13.x | Supported |
Updating
Then re-run:
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Security
If you discover any security-related issues, please email [email protected] instead of using the public issue tracker.
Support
License
The MIT License (MIT). Please see LICENSE for more information.
Copyright © NativeCode.
Contributed by NativeCode