Charles f8ad720f52
Admin Area Translations (#965)
* Init

* Health Page

* Admin API Keys

* Update API Keys

* Database Hosts

* Mounts

* remove `s`

* Users

* Webhooks

* Server

never again...

* Fix Server

* Settings

* Update Mounts

* Update Databasehost

* Update Server

* Oops, Update Server

* Nodes

* Update User

* Dashboard

* Update Server

* Profile

* Egg

* Role & Update Egg

* Add base Laravel lang files

* update apikey

* remove html back to settings, remove comment

* add `:resource` to create_action

* Update Egg

* Update Egg v2

* Update 1

* trans cf info label

* Update charts

* more trans

* Update Webhook

* update Health

* Update Server

* Update Role

* Fixes

* Bulk Update

* AnotherOne

* Fix relation button label

* rename `admin1` to `admin`

Leftover from testing... oops

* More Translations

* Updates

* `pint` + Relation Manager Titles
2025-02-08 23:16:54 -05:00

28 lines
660 B
PHP

<?php
namespace App\Services\Helpers;
use Illuminate\Support\Facades\File;
use Locale;
class LanguageService
{
public const TRANSLATED_COMPLETELY = [
'en',
];
public function isLanguageTranslated(string $countryCode = 'en'): bool
{
return in_array($countryCode, self::TRANSLATED_COMPLETELY, true);
}
public function getAvailableLanguages(string $path = 'lang'): array
{
return collect(File::directories(base_path($path)))->mapWithKeys(function ($path) {
$code = basename($path);
return [$code => title_case(Locale::getDisplayName($code, $code))];
})->toArray();
}
}