コード例 #1
0
ファイル: index.php プロジェクト: xpressengine/xpressengine
}
$https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : '';
$schema = !empty($https) && 'off' !== strtolower($https) ? 'https' : 'http';
$url = $schema . '://' . $_SERVER['SERVER_NAME'];
$subdir = trim(str_replace('web_installer/index.php', '', $_SERVER['SCRIPT_NAME']), '/');
if (!empty($subdir)) {
    $url .= '/' . $subdir;
}
$supportLocales = getAllLangFileNames();
$allLangs = [];
foreach ($supportLocales as $locale) {
    $allLangs[$locale] = (require getLangFilePath($locale));
}
$locale = 'ko';
$selectedLocale = 'Language';
if (isset($_COOKIE['install_locale']) && file_exists(getLangFilePath($_COOKIE['install_locale'])) === true) {
    $locale = $_COOKIE['install_locale'];
    $selectedLocale = $allLangs[$_COOKIE['install_locale']]['localeExpression'];
}
$langs = $allLangs[$locale];
function getAllLangFileNames()
{
    $names = [];
    foreach (scandir('lang') as $name) {
        $parts = pathinfo($name);
        if ($parts['extension'] != 'php') {
            continue;
        }
        $names[] = $parts['filename'];
    }
    return $names;
コード例 #2
0
ファイル: start.php プロジェクト: mergar/webdev
function get_translate($phrase)
{
    $lang = getLang();
    $file = getLangFilePath($lang);
    if (!file_exists($file)) {
        $file = getLangFilePath('en');
    }
    require $file;
    if (isset($lang[$phrase])) {
        return $lang[$phrase];
    } else {
        return $phrase;
    }
}