Feature: Agregar selección de idiomas por plataforma (Telegram/Discord)
- Agregar columnas telegram_enabled y discord_enabled a supported_languages - Nueva interfaz en admin/languages.php con checkboxes para Telegram y Discord - Los bots ahora solo muestran botones de traducción para los idiomas seleccionados por plataforma
This commit is contained in:
@@ -10,16 +10,19 @@ require_once __DIR__ . '/includes/i18n.php';
|
||||
|
||||
function getTranslationButtons(PDO $pdo, string $text): array
|
||||
{
|
||||
$stmt = $pdo->query("SELECT language_code, flag_emoji FROM supported_languages WHERE is_active = 1");
|
||||
$languages = $stmt->fetchAll();
|
||||
$stmtTelegram = $pdo->query("SELECT language_code, flag_emoji FROM supported_languages WHERE is_active = 1 AND telegram_enabled = 1");
|
||||
$telegramLanguages = $stmtTelegram->fetchAll();
|
||||
|
||||
if (count($languages) <= 1) {
|
||||
$stmtDiscord = $pdo->query("SELECT language_code, flag_emoji FROM supported_languages WHERE is_active = 1 AND discord_enabled = 1");
|
||||
$discordLanguages = $stmtDiscord->fetchAll();
|
||||
|
||||
if (count($telegramLanguages) <= 1 && count($discordLanguages) <= 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'telegram' => buildTelegramTranslationButtons($pdo, $languages, $text),
|
||||
'discord' => buildDiscordTranslationButtons($languages, $text)
|
||||
'telegram' => count($telegramLanguages) > 1 ? buildTelegramTranslationButtons($pdo, $telegramLanguages, $text) : [],
|
||||
'discord' => count($discordLanguages) > 1 ? buildDiscordTranslationButtons($discordLanguages, $text) : []
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user