-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-simple.html
More file actions
108 lines (99 loc) · 4 KB
/
test-simple.html
File metadata and controls
108 lines (99 loc) · 4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Theme & Language</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #0E0E0F;
color: #F5F5DC;
transition: all 0.3s;
}
body.light-mode {
background: #F5F5DC;
color: #000000;
}
.controls {
margin-bottom: 20px;
display: flex;
gap: 10px;
align-items: center;
}
button, select {
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
background: #FF6A00;
color: white;
}
.test-text {
margin: 10px 0;
padding: 10px;
border: 1px solid #FF6A00;
border-radius: 5px;
}
</style>
</head>
<body>
<div class="controls">
<button onclick="toggleTheme()">
<i class="fas fa-moon" id="themeIcon"></i> Toggle Theme
</button>
<select id="languageSelect" onchange="changeLanguage()">
<option value="en">EN</option>
<option value="fr">FR</option>
<option value="de">DE</option>
<option value="zh">中文</option>
<option value="es">ES</option>
</select>
</div>
<h1 data-en="Welcome to LaunchPad" data-fr="Bienvenue à LaunchPad" data-de="Willkommen bei LaunchPad" data-zh="欢迎来到LaunchPad" data-es="Bienvenido a LaunchPad">Welcome to LaunchPad</h1>
<p class="test-text" data-en="This is a test of the language switching functionality." data-fr="Ceci est un test de la fonctionnalité de changement de langue." data-de="Dies ist ein Test der Sprachumschaltfunktion." data-zh="这是语言切换功能的测试。" data-es="Esta es una prueba de la funcionalidad de cambio de idioma.">This is a test of the language switching functionality.</p>
<script>
function toggleTheme() {
const body = document.body;
const themeIcon = document.getElementById('themeIcon');
if (body.classList.contains('light-mode')) {
body.classList.remove('light-mode');
if (themeIcon) themeIcon.className = 'fas fa-moon';
localStorage.setItem('theme', 'dark');
} else {
body.classList.add('light-mode');
if (themeIcon) themeIcon.className = 'fas fa-sun';
localStorage.setItem('theme', 'light');
}
}
function changeLanguage() {
const langSelect = document.getElementById('languageSelect');
const lang = langSelect.value;
localStorage.setItem('language', lang);
document.querySelectorAll(`[data-${lang}]`).forEach(element => {
const translation = element.getAttribute(`data-${lang}`);
if (translation) {
element.textContent = translation;
}
});
}
// Load saved preferences
document.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('theme');
const savedLang = localStorage.getItem('language') || 'en';
if (savedTheme === 'light') {
document.body.classList.add('light-mode');
const themeIcon = document.getElementById('themeIcon');
if (themeIcon) themeIcon.className = 'fas fa-sun';
}
const langSelect = document.getElementById('languageSelect');
if (langSelect) {
langSelect.value = savedLang;
changeLanguage();
}
});
</script>
</body>
</html>