Fix SettingsController for new translations table structure

This commit is contained in:
infosave2007
2025-11-08 18:16:44 +03:00
parent 2106aa77e0
commit 7a105cce6e
+3 -3
View File
@@ -301,15 +301,15 @@ class SettingsController {
$stmt = $this->pdo->query("SELECT * FROM languages ORDER BY code"); $stmt = $this->pdo->query("SELECT * FROM languages ORDER BY code");
$languages = $stmt->fetchAll(); $languages = $stmt->fetchAll();
// Get total translation keys count // Get total translation keys count (distinct category + key_name combinations)
$stmt = $this->pdo->query("SELECT COUNT(DISTINCT translation_key) as count FROM translations WHERE language_code = 'en'"); $stmt = $this->pdo->query("SELECT COUNT(DISTINCT CONCAT(category, '.', key_name)) as count FROM translations WHERE locale = 'en'");
$totalKeys = $stmt->fetch(); $totalKeys = $stmt->fetch();
$totalCount = $totalKeys['count']; $totalCount = $totalKeys['count'];
$stats = []; $stats = [];
foreach ($languages as $lang) { foreach ($languages as $lang) {
$stmt = $this->pdo->prepare( $stmt = $this->pdo->prepare(
"SELECT COUNT(*) as count FROM translations WHERE language_code = ? AND translation_value IS NOT NULL AND translation_value != ''" "SELECT COUNT(*) as count FROM translations WHERE locale = ? AND translation IS NOT NULL AND translation != ''"
); );
$stmt->execute([$lang['code']]); $stmt->execute([$lang['code']]);
$translated = $stmt->fetch(); $translated = $stmt->fetch();