-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug-lang-toggle.html
More file actions
117 lines (105 loc) · 2.92 KB
/
debug-lang-toggle.html
File metadata and controls
117 lines (105 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Language Toggle Debug</title>
<link rel="stylesheet" href="css/language-toggle.css" />
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #161624;
color: #f0f2f5;
}
:root {
--primary: #9275e5;
--text-secondary: #c0c5d0;
--text-muted: #8792a8;
--border: rgba(192, 197, 208, 0.2);
}
.test-element {
margin: 20px 0;
padding: 10px;
background: rgba(30, 30, 48, 0.8);
border-radius: 8px;
}
</style>
</head>
<body>
<h1>Language Toggle Debug</h1>
<div class="language-toggle">
<button id="lang-es" class="language-toggle-btn active">ES</button>
<span class="language-toggle-separator">|</span>
<button id="lang-en" class="language-toggle-btn">EN</button>
</div>
<div class="test-element">
<h2 data-i18n="test.title">Test Title</h2>
<p data-i18n="test.description">Test Description</p>
</div>
<div id="debug-info">
<h3>Debug Information:</h3>
<ul id="debug-list"></ul>
</div>
<script src="js/translations.js"></script>
<script>
// Debug script
const debugList = document.getElementById("debug-list");
function addDebugInfo(message) {
const li = document.createElement("li");
li.textContent = `${new Date().toLocaleTimeString()}: ${message}`;
debugList.appendChild(li);
}
addDebugInfo("Script loaded");
// Check if translations object exists
if (typeof translations !== "undefined") {
addDebugInfo("Translations object found");
addDebugInfo(
`Available languages: ${Object.keys(translations).join(", ")}`
);
} else {
addDebugInfo("ERROR: Translations object not found");
}
// Check if buttons exist
const enButton = document.getElementById("lang-en");
const esButton = document.getElementById("lang-es");
if (enButton && esButton) {
addDebugInfo("Language toggle buttons found");
} else {
addDebugInfo("ERROR: Language toggle buttons not found");
}
// Add test translations
if (typeof translations === "undefined") {
window.translations = {
en: {
test: {
title: "Test Title (English)",
description: "Test Description (English)",
},
},
es: {
test: {
title: "Título de Prueba (Español)",
description: "Descripción de Prueba (Español)",
},
},
};
addDebugInfo("Created test translations");
}
</script>
<script src="js/language-toggle.js"></script>
<script>
// Additional debug after language-toggle.js loads
setTimeout(() => {
addDebugInfo("Language toggle script should be loaded now");
addDebugInfo(
`Current language: ${
typeof getCurrentLanguage === "function"
? getCurrentLanguage()
: "function not available"
}`
);
}, 100);
</script>
</body>
</html>