From aa83dd14367762668cf622db131091dc4ed1e4a2 Mon Sep 17 00:00:00 2001 From: Ahmed Darrazi Date: Wed, 17 Dec 2025 00:27:48 +0100 Subject: [PATCH] bugfixes --- .../Language/app/Services/LanguageService.php | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Modules/Language/app/Services/LanguageService.php b/Modules/Language/app/Services/LanguageService.php index 8895b69b..86aa0977 100644 --- a/Modules/Language/app/Services/LanguageService.php +++ b/Modules/Language/app/Services/LanguageService.php @@ -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);