mirror of
https://github.com/RedGrox2013/AloeGames-Site.git
synced 2026-07-13 23:16:58 +00:00
Исправил переключение языка
This commit is contained in:
+14
-8
@@ -27,14 +27,20 @@ function toggleLang() {
|
|||||||
currentLang = currentLang === 'en' ? 'ru' : 'en';
|
currentLang = currentLang === 'en' ? 'ru' : 'en';
|
||||||
const t = translations[currentLang];
|
const t = translations[currentLang];
|
||||||
|
|
||||||
document.getElementById('title').textContent = t.title;
|
tryToggleTextContent('title', t.title);
|
||||||
document.getElementById('desc').textContent = t.desc;
|
tryToggleTextContent('desc', t.desc);
|
||||||
document.getElementById('button').textContent = t.button;
|
tryToggleTextContent('button', t.button);
|
||||||
document.getElementById('aboutTitle').textContent = t.aboutTitle;
|
tryToggleTextContent('aboutTitle', t.aboutTitle);
|
||||||
document.getElementById('aboutText').textContent = t.aboutText;
|
tryToggleTextContent('aboutText', t.aboutText);
|
||||||
document.getElementById('projectsTitle').textContent = t.projectsTitle;
|
tryToggleTextContent('projectsTitle', t.projectsTitle);
|
||||||
document.getElementById('contactTitle').textContent = t.contactTitle;
|
tryToggleTextContent('contactTitle', t.contactTitle);
|
||||||
document.getElementById('contactText').textContent = t.contactText;
|
tryToggleTextContent('contactText', t.contactText);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tryToggleTextContent(elementId, textContent) {
|
||||||
|
let el = document.getElementById(elementId);
|
||||||
|
if (el != null)
|
||||||
|
el.textContent = textContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Background animation
|
// Background animation
|
||||||
|
|||||||
Reference in New Issue
Block a user