Skip to content

Commit 3fdf710

Browse files
author
ToperGAMES
committed
lang
1 parent 8f0a71d commit 3fdf710

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

index.html

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,56 @@
3838
</style>
3939
</head>
4040
<body>
41-
<h1>Welcome to Toper's World</h1>
42-
<p>Choose your path:</p>
43-
<a href="/games/">🎮 Gaming Zone</a>
44-
<a href="/dev/">👨‍💻 Dev & Hacker Lab</a>
41+
<div style="margin-bottom:2rem;">
42+
<label for="lang-switch" style="font-weight:bold;">🌐</label>
43+
<select id="lang-switch" style="padding:0.5rem 1rem; border-radius:8px; border:none; font-size:1rem; background:#ff4b2b; color:#fff; font-weight:bold; transition:0.3s ease; cursor:pointer; outline:none;">
44+
<style>
45+
#lang-switch:focus, #lang-switch:hover {
46+
background: #e03a1d;
47+
}
48+
</style>
49+
<option value="en">English</option>
50+
<option value="ru">Русский</option>
51+
</select>
52+
</div>
53+
<h1 id="main-title">Welcome to Toper's World</h1>
54+
<p id="main-desc">Choose your path:</p>
55+
<a id="games-link" href="/games/">🎮 Gaming Zone</a>
56+
<a id="dev-link" href="/dev/">👨‍💻 Dev & Hacker Lab</a>
57+
<script>
58+
const translations = {
59+
en: {
60+
title: "Welcome to Toper's World",
61+
desc: "Choose your path:",
62+
games: "🎮 Gaming Zone",
63+
dev: "👨‍💻 Dev & Hacker Lab"
64+
},
65+
ru: {
66+
title: "Добро пожаловать в мир Топера",
67+
desc: "Выберите свой путь:",
68+
games: "🎮 Игровая зона",
69+
dev: "👨‍💻 Лаборатория разработчика и хакера"
70+
}
71+
};
72+
const langSwitch = document.getElementById('lang-switch');
73+
function setLang(lang) {
74+
document.getElementById('main-title').textContent = translations[lang].title;
75+
document.getElementById('main-desc').textContent = translations[lang].desc;
76+
document.getElementById('games-link').textContent = translations[lang].games;
77+
document.getElementById('dev-link').textContent = translations[lang].dev;
78+
}
79+
langSwitch.addEventListener('change', function() {
80+
setLang(this.value);
81+
});
82+
// Автоматический выбор языка по браузеру
83+
const userLang = (navigator.language || navigator.userLanguage || 'en').slice(0,2);
84+
if (userLang === 'ru') {
85+
langSwitch.value = 'ru';
86+
setLang('ru');
87+
} else {
88+
langSwitch.value = 'en';
89+
setLang('en');
90+
}
91+
</script>
4592
</body>
4693
</html>

0 commit comments

Comments
 (0)