mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-28 11:34:45 +02:00
Use php locale instead
This commit is contained in:
parent
62d56099d7
commit
18ad46fe16
@ -2,13 +2,11 @@
|
||||
|
||||
namespace App\Traits\Helpers;
|
||||
|
||||
use Matriphe\ISO639\ISO639;
|
||||
use Locale;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
trait AvailableLanguages
|
||||
{
|
||||
private ?ISO639 $iso639 = null;
|
||||
|
||||
private ?Filesystem $filesystem = null;
|
||||
|
||||
/**
|
||||
@ -19,7 +17,8 @@ trait AvailableLanguages
|
||||
{
|
||||
return collect($this->getFilesystemInstance()->directories(base_path('lang')))->mapWithKeys(function ($path) use ($localize) {
|
||||
$code = basename($path);
|
||||
$value = $localize ? $this->getIsoInstance()->nativeByCode1($code) : $this->getIsoInstance()->languageByCode1($code);
|
||||
|
||||
$value = Locale::getDisplayName($code, app()->currentLocale());
|
||||
|
||||
return [$code => title_case($value)];
|
||||
})->toArray();
|
||||
@ -32,12 +31,4 @@ trait AvailableLanguages
|
||||
{
|
||||
return $this->filesystem = $this->filesystem ?: app()->make(Filesystem::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the ISO639 class for generating names.
|
||||
*/
|
||||
private function getIsoInstance(): ISO639
|
||||
{
|
||||
return $this->iso639 = $this->iso639 ?: app()->make(ISO639::class);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"description": "The free, open-source game management panel. Supporting Minecraft, Spigot, BungeeCord, and SRCDS servers.",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-pdo": "*",
|
||||
|
Loading…
x
Reference in New Issue
Block a user