Feature: Sistema multi-idioma con LibreTranslate

- Nuevo includes/i18n.php con funciones t() para traducción
- Selector de idioma en navbar y login
- Traducciones aplicadas a: dashboard, login, mensajes programados, crear mensaje, sistema
- Usa idiomas activados desde admin/languages.php
- Caché de traducciones incluido
This commit is contained in:
2026-02-20 15:21:17 -06:00
parent 6a50e64b42
commit a44a64a01f
7 changed files with 347 additions and 117 deletions

View File

@@ -14,9 +14,9 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-crosshair"></i> Dashboard</h2>
<h2><i class="bi bi-crosshair"></i> <?= t('Dashboard') ?></h2>
<span class="text-muted" style="font-family: 'Share Tech Mono', monospace; font-size: 0.8rem;">
// BIENVENIDO, <?= strtoupper(htmlspecialchars(getCurrentUsername())) ?>
// <?= t('BIENVENIDO') ?>, <?= strtoupper(htmlspecialchars(getCurrentUsername())) ?>
</span>
</div>
@@ -30,7 +30,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
</div>
<div>
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--accent-orange);"><?= $pendingCount ?></div>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Pendientes</small>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Pendientes') ?></small>
</div>
</div>
</div>
@@ -46,7 +46,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
</div>
<div>
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--hud-cyan);"><?= $sentToday ?></div>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Enviados Hoy</small>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Enviados Hoy') ?></small>
</div>
</div>
</div>
@@ -64,7 +64,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--discord-color);">
<?= count(array_filter($scheduledMessages, fn($m) => $m['platform'] === 'discord')) ?>
</div>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Discord</small>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Discord') ?></small>
</div>
</div>
</div>
@@ -82,7 +82,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--telegram-color);">
<?= count(array_filter($scheduledMessages, fn($m) => $m['platform'] === 'telegram')) ?>
</div>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Telegram</small>
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Telegram') ?></small>
</div>
</div>
</div>
@@ -94,20 +94,20 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
<div class="col-md-8">
<div class="card border-0 shadow-sm">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-list-check"></i> Próximos Mensajes</h5>
<h5 class="mb-0"><i class="bi bi-list-check"></i> <?= t('Próximos Mensajes') ?></h5>
</div>
<div class="card-body">
<?php if (empty($scheduledMessages)): ?>
<p class="text-muted text-center py-4">// NO HAY MENSAJES PROGRAMADOS</p>
<p class="text-muted text-center py-4">// <?= t('NO HAY MENSAJES PROGRAMADOS') ?></p>
<?php else: ?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Destinatario</th>
<th>Plataforma</th>
<th>Fecha</th>
<th>Estado</th>
<th><?= t('Destinatario') ?></th>
<th><?= t('Plataforma') ?></th>
<th><?= t('Fecha') ?></th>
<th><?= t('Estado') ?></th>
</tr>
</thead>
<tbody>
@@ -131,7 +131,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
'disabled' => 'secondary',
default => 'light'
} ?>">
<?= $msg['status'] ?>
<?= t($msg['status']) ?>
</span>
</td>
</tr>
@@ -147,18 +147,18 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
<div class="col-md-4">
<div class="card border-0 shadow-sm">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-lightning"></i> Acciones Rápidas</h5>
<h5 class="mb-0"><i class="bi bi-lightning"></i> <?= t('Acciones Rápidas') ?></h5>
</div>
<div class="card-body">
<div class="d-grid gap-2">
<a href="create_message.php" class="btn btn-primary">
<i class="bi bi-pencil-square"></i> Nuevo Mensaje
<i class="bi bi-pencil-square"></i> <?= t('Nuevo Mensaje') ?>
</a>
<a href="recurrentes.php" class="btn btn-outline-secondary">
<i class="bi bi-collection"></i> Ver Plantillas
<i class="bi bi-collection"></i> <?= t('Ver Plantillas') ?>
</a>
<a href="scheduled_messages.php" class="btn btn-outline-secondary">
<i class="bi bi-list"></i> Ver Todos los Programados
<i class="bi bi-list"></i> <?= t('Ver Todos los Programados') ?>
</a>
</div>
</div>