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