Initial Release v1.0.0: Full feature set with Docker automation, Nginx/Alpine stack

This commit is contained in:
dyzulk
2026-01-16 11:21:32 +07:00
commit 45623973a8
139 changed files with 24302 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Helpers;
class LanguageHelper
{
/**
* Get list of available languages from public/lang directory
*
* @return array Array of languages with code and name
*/
public static function getAvailableLanguages()
{
$langDir = ROOT . '/public/lang';
$languages = [];
if (!is_dir($langDir)) {
return [];
}
$files = scandir($langDir);
foreach ($files as $file) {
if ($file === '.' || $file === '..') continue;
if (pathinfo($file, PATHINFO_EXTENSION) === 'json') {
$code = pathinfo($file, PATHINFO_FILENAME);
// Read file to get language name if defined, otherwise use code
$content = file_get_contents($langDir . '/' . $file);
$data = json_decode($content, true);
$name = $data['_meta']['name'] ?? strtoupper($code);
$flag = $data['_meta']['flag'] ?? '🌐';
$languages[] = [
'code' => $code,
'name' => $name,
'flag' => $flag
];
}
}
return $languages;
}
}