Исправил переключение языка

This commit is contained in:
RedGrox
2026-05-19 20:40:57 +03:00
parent 9b94dbcbe7
commit 9b094fcfe7
+14 -8
View File
@@ -27,14 +27,20 @@ function toggleLang() {
currentLang = currentLang === 'en' ? 'ru' : 'en';
const t = translations[currentLang];
document.getElementById('title').textContent = t.title;
document.getElementById('desc').textContent = t.desc;
document.getElementById('button').textContent = t.button;
document.getElementById('aboutTitle').textContent = t.aboutTitle;
document.getElementById('aboutText').textContent = t.aboutText;
document.getElementById('projectsTitle').textContent = t.projectsTitle;
document.getElementById('contactTitle').textContent = t.contactTitle;
document.getElementById('contactText').textContent = t.contactText;
tryToggleTextContent('title', t.title);
tryToggleTextContent('desc', t.desc);
tryToggleTextContent('button', t.button);
tryToggleTextContent('aboutTitle', t.aboutTitle);
tryToggleTextContent('aboutText', t.aboutText);
tryToggleTextContent('projectsTitle', t.projectsTitle);
tryToggleTextContent('contactTitle', t.contactTitle);
tryToggleTextContent('contactText', t.contactText);
}
function tryToggleTextContent(elementId, textContent) {
let el = document.getElementById(elementId);
if (el != null)
el.textContent = textContent;
}
// Background animation