1. Go to this page and download the library: Download kanekescom/laravel-lingo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kanekescom / laravel-lingo example snippets
// Find all "key": patterns in raw JSON
preg_match_all('/"([^"]+)"\s*:/', $jsonContent, $matches);
use Kanekescom\Lingo\Facades\Lingo;
// Load by locale and manipulate
Lingo::locale('id')->sortKeys()->save();
Lingo::locale('id')->clean()->save();
// Sync with source files
Lingo::locale('id')->sync()->save(); // Default: resources/views
Lingo::locale('id')->sync('app/Filament')->save(); // Single folder
Lingo::locale('id')->sync(['resources/views', 'app/Filament'])->save(); // Multiple paths
Lingo::locale('id')->sync('app/Http/Controllers/HomeController.php')->save(); // Single file
// Get data
$stats = Lingo::locale('id')->stats();
$untranslated = Lingo::locale('id')->onlyUntranslated()->get();
// Create from array (overwrites file)
lingo(['Hello' => 'Halo'], 'id')->save();
// Using helper with sync (cleaner syntax)
lingo()->sync(['resources/views', 'app/Filament'])->to('id')->save();
// Merge with existing translations
Lingo::locale('id')->merge(['Hello' => 'Halo'])->save();
// Without locale - fallback to app()->getLocale()
lingo(['Hello' => 'Halo'])->save();
bash
php artisan lingo:check id # → Searches: lang/id.json, resources/lang/id.json
php artisan lingo:check lang/id.json # → Used directly as file path
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.