This commit is contained in:
Ahmed Darrazi 2025-12-17 00:27:48 +01:00
parent 50c7e9562b
commit aa83dd1436

View File

@ -28,15 +28,32 @@ class LanguageService extends MediaService
$appLangPath = storage_path('app/lang/default');
$groups = [
'auth' => require storage_path('app/lang/groups/auth.php'),
'button' => require storage_path('app/lang/groups/button.php'),
'common' => require storage_path('app/lang/groups/common.php'),
'dashboard' => require storage_path('app/lang/groups/dashboard.php'),
'frontend' => require storage_path('app/lang/groups/frontend.php'),
'input' => require storage_path('app/lang/groups/input.php'),
'settings' => require storage_path('app/lang/groups/settings.php'),
];
$groupNames = ['auth','button','common','dashboard','frontend','input','settings'];
$groups = [];
foreach ($groupNames as $groupName) {
$repoGroupPath1 = base_path("lang/{$data['code']}/groups/{$groupName}.php");
$repoGroupPath2 = base_path("lang/{$data['code']}/{$groupName}.php");
if (file_exists($repoGroupPath1)) {
$groups[$groupName] = require $repoGroupPath1;
continue;
}
if (file_exists($repoGroupPath2)) {
$file = require $repoGroupPath2;
$groups[$groupName] = [
[
'name' => ucfirst(str_replace('_', ' ', $groupName)),
'slug' => $groupName,
'properties' => $file,
],
];
continue;
}
$groups[$groupName] = require storage_path("app/lang/groups/{$groupName}.php");
}
$languages = Language::create($data);