sepremex / laramissingkey
Manage language files with ease.
Requires
- php: ^8.2
- illuminate/console: ^12.0
- illuminate/filesystem: ^12.0
- illuminate/support: ^12.0
Requires (Dev)
- pestphp/pest: ^3.8
README
Because sometimes... you just want your damn translation keys in place.
🤦 Why this package exists?
So... imagine working on a glorious Laravel app, multilingual AF, international ambitions, flags everywhere, buttons for French, Spanish, Martian, whatever.
Now imagine you're 42 routes deep, blade templates everywhere, controllers echoing __('Welcome')
like gospel...
And then... you realize Laravel doesn't give a damn if you're missing keys.
Worse, those heroic packages that promise to find and sync them?
- Some are abandoned.
- Some scan only half your app.
- Some inject routes in your vendor folders like they own your project.
- One even needed me to click a damn UI to sync keys.
😐 Nah. We got fed up.
So, we did what any pissed-off dev does: we wrote our own package.
💡 What does it do?
This thing runs:
php artisan lmissingkey:sync
And it does the following:
- Searches your entire
app/
andresources/views/
for translation keys like__('key')
and@lang('key')
- Reads all existing language files (both
.json
and.php
grouped ones) - Finds which keys are missing
- Appends only valid flat keys to the correct
/lang/{locale}.json
file- No duplicating
auth.failed
in the wrong place - No overwriting your carefully handcrafted artisan translations
- No duplicating
- Ignores anything Laravel might do to screw it up. Because trust issues.
🚀 Install
composer require sepremex/laramissingkey
🛠️ Usage
php artisan lmissingkey:sync
Boom. Missing keys get written into the right files.
❓ What it doesn't do (yet...)
- Doesn't edit your
/lang/{locale}/*.php
files (we're working on that) - Doesn't translate for you (we're good, but not Google Translate on steroids)
- Doesn't throw glitter when it finds keys (maybe later)
🧠 Why not just fix existing packages?
Because some of them were written in 2016...
...by developers who now work for Meta, or raise goats in the Alps, or just don’t reply to GitHub issues anymore.
So we said:
"Let’s do it ourselves. And do it better."
❤️ Credits
Brought to you by a highly caffeinated developer tired of missing __('Submit')
for the 20th time.
Powered by rage, sarcasm, and love for clean code.
🐍 License
MIT. Fork it, break it, sell it to Elon, just don’t make it worse.