refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
50
app/Console/Commands/LangGenerate.php
Normal file
50
app/Console/Commands/LangGenerate.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class LangGenerate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'lang:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate i18n json assets';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$dirs = new DirectoryIterator(resource_path('lang').'/');
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if (! $dir->isDir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lang = $dir->getFilename();
|
||||
if ($lang == '.' || $lang == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->call('lang:js', [
|
||||
'--json' => true,
|
||||
'--source' => $dir->getPathname(),
|
||||
'target' => 'public/js/langs/'.$lang.'.json',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user