Simplify locales

This commit is contained in:
Lance Pioch 2024-03-23 12:43:01 -04:00
parent 08d98581aa
commit b8b4750f46
3 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class IndexController extends Controller
{ {
return view('admin.settings.index', [ return view('admin.settings.index', [
'version' => $this->versionService, 'version' => $this->versionService,
'languages' => $this->getAvailableLanguages(true), 'languages' => $this->getAvailableLanguages(),
]); ]);
} }

View File

@ -60,7 +60,7 @@ class UserController extends Controller
public function create(): View public function create(): View
{ {
return view('admin.users.new', [ return view('admin.users.new', [
'languages' => $this->getAvailableLanguages(true), 'languages' => $this->getAvailableLanguages(),
]); ]);
} }
@ -71,7 +71,7 @@ class UserController extends Controller
{ {
return view('admin.users.view', [ return view('admin.users.view', [
'user' => $user, 'user' => $user,
'languages' => $this->getAvailableLanguages(true), 'languages' => $this->getAvailableLanguages(),
]); ]);
} }

View File

@ -13,9 +13,9 @@ trait AvailableLanguages
* Return all the available languages on the Panel based on those * Return all the available languages on the Panel based on those
* that are present in the language folder. * that are present in the language folder.
*/ */
public function getAvailableLanguages(bool $localize = false): array public function getAvailableLanguages(): array
{ {
return collect($this->getFilesystemInstance()->directories(base_path('lang')))->mapWithKeys(function ($path) use ($localize) { return collect($this->getFilesystemInstance()->directories(base_path('lang')))->mapWithKeys(function ($path) {
$code = basename($path); $code = basename($path);
$value = Locale::getDisplayName($code, app()->currentLocale()); $value = Locale::getDisplayName($code, app()->currentLocale());