feat: add new translation files for app development, corporate, home menu, and miscellaneous site content, enhancing multilingual support and user experience
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Database\Seeders\Concerns\SeedsSiteTranslations;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SiteTranslationsSeeder extends Seeder
|
||||
{
|
||||
use SeedsSiteTranslations;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected array $dataFiles = [
|
||||
'home_menu_translations.php',
|
||||
'home_menu_locale_patch.php',
|
||||
'neler_yapariz_translations.php',
|
||||
'app_development_translations.php',
|
||||
'corporate_translations.php',
|
||||
'misc_site_translations.php',
|
||||
];
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
foreach ($this->dataFiles as $file) {
|
||||
$path = database_path('data/' . $file);
|
||||
|
||||
if (! is_file($path)) {
|
||||
$this->command?->warn("Translation data file not found: {$file}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var array{site?: array<string, array<string, string>>, pages?: array<string|int, array<string, array<string, string>>>} $data */
|
||||
$data = require $path;
|
||||
|
||||
if (! empty($data['site'])) {
|
||||
$this->seedSiteTranslations($data['site']);
|
||||
}
|
||||
|
||||
if (! empty($data['pages'])) {
|
||||
$this->seedPageTranslations($data['pages']);
|
||||
}
|
||||
|
||||
$this->command?->info("Applied translations from {$file}");
|
||||
}
|
||||
|
||||
$this->flushTranslationCache();
|
||||
|
||||
$this->command?->info('All site translations applied successfully.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user