Files
slava.home/main_plugin/auth/lang.js.php
2025-11-07 20:53:17 +02:00

24 lines
863 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @file lang.js.php
* @brief Генерирует JavaScript-файл с языковыми строками для плагина авторизации
*/
global $path, $_SESSION;
/** @brief Загружает языковой массив для плагина авторизации */
$lang = include $path . 'lang.php';
/** @brief Определяет текущий язык пользователя, берется из GET-параметра или сессии, по умолчанию 'en' */
$lng = $_GET['lng'] ?? ($_SESSION['lng'] ?? 'en');
/** @brief Массив для подстановки языковых строк в шаблон JS */
$placeholders = [];
foreach ($lang[$lng] as $key => $value) {
$placeholders['{{' . $key . '}}'] = $value;
}
echo strtr(file_get_contents($path . 'auth.js'), $placeholders);
?>