Auto-scan and localize Laravel Blade UI text into language files
hendriarga/blade-localizer is a Laravel package for auto-scan and localize laravel blade ui text into language files.
It currently has 0 GitHub stars and 0 downloads on Packagist.
Install it with composer require hendriarga/blade-localizer.
Discover more Laravel packages by hendriarga
or browse all Laravel packages to compare alternatives.
Last updated
Blade Localizer is a Laravel package that scans your Blade .blade.php files, extracts UI strings, and adds them to your lang/{locale}/ui.php or ui.json translation files. It also supports auto-replacing static text with the __() helper and translating them using the Google Translate API.
div, span, label, a, button, p, and even custom components like <x-*>{{ __('...') }}lang/{locale}/ui.php and ui.json filesplaceholder, title, aria-label, etc.__('...')composer require hendriarga/blade-localizer
php artisan vendor:publish --tag=blade-localizer
blade:localize Artisan commandphp artisan localize:blade
This command will scan your Blade files, extract UI strings, and add them to your lang/{locale}/ui.php or ui.json files. It will also automatically replace static text with the __() helper and translate them using the Google Translate API.
You can customize the behavior of the package by editing the config/blade-localizer.php file.
| Option | Description | Default |
| --- | --- | --- |
| locales | An array of locales to generate language files for. | ['en'] |
| views | An array of folders to scan for Blade files. | ['resources/views'] |
| filename | The name of the language file. | ui.php |
| skip_keywords | An array of keywords to skip when extracting UI strings. | [] |
| path | The path to the language file. Set to false to generate a new file. | false |
The package is open-sourced software licensed under the MIT license. Feel free to use, modify, and distribute this package as long as you follow the license terms.