mirror of
https://github.com/appwrite/appwrite
synced 2026-04-25 23:47:19 +00:00
23 lines
679 B
PHP
23 lines
679 B
PHP
<?php
|
|
|
|
use Utopia\Config\Config;
|
|
use Utopia\Locale\Locale;
|
|
|
|
Locale::$exceptions = false;
|
|
|
|
$locales = Config::getParam('locale-codes', []);
|
|
|
|
foreach ($locales as $locale) {
|
|
$code = $locale['code'];
|
|
|
|
$path = __DIR__ . '/../config/locale/translations/' . $code . '.json';
|
|
|
|
if (!\file_exists($path)) {
|
|
$path = __DIR__ . '/../config/locale/translations/' . \substr($code, 0, 2) . '.json'; // if `ar-ae` doesn't exist, look for `ar`
|
|
if (!\file_exists($path)) {
|
|
$path = __DIR__ . '/../config/locale/translations/en.json'; // if none translation exists, use default from `en.json`
|
|
}
|
|
}
|
|
|
|
Locale::setLanguageFromJSON($code, $path);
|
|
}
|