UK: 'Головна', JA: 'ホーム', ZH: '首页', PL: 'Strona główna', KK: 'Басты бет', IT: 'Home', LV: 'Sākums', }, catalog: { EN: 'Catalog', RU: 'Каталог', FR: 'Catalogue', DE: 'Katalog', ES: 'Catálogo', PT: 'Catálogo', UK: 'Каталог', JA: 'カタログ', ZH: '产品目录', PL: 'Katalog', KK: 'Каталог', IT: 'Catalogo', LV: 'Katalogs', }, }; const allRecords = document.getElementById('allrecords'); if (!allRecords) return; let lang = (window.navigator.userLanguage || window.navigator.language).toUpperCase().slice(0, 2); // Переопределение языка на основе атрибута if (!lang) { const projectLang = allRecords.getAttribute('data-tilda-project-lang'); if (projectLang) lang = projectLang; } // Отмечены разрешенные языки. По умолчанию используется английский const acceptedLangs = ['EN', 'RU', 'FR', 'DE', 'ES', 'PT', 'UK', 'JA', 'ZH', 'PL', 'KK', 'IT', 'LV']; if (acceptedLangs.indexOf(lang) === -1) { lang = 'EN'; } const SEARCH_CLASS = 't-menuwidgeticons__link_'; const icons = menuEl.querySelectorAll('.t-menuwidgeticons__link'); icons.forEach(function (icon) { const iconСlasses = icon.className.split(' '); const typeClass = iconСlasses.find(function (iconСlass) { return iconСlass.indexOf(SEARCH_CLASS) !== -1 ? iconСlass : false; }); const type = typeClass.replace(SEARCH_CLASS, ''); const text = translation[type][lang]; const html = t_menuWidgets__getWidgetsTextHTML(text, type); icon.insertAdjacentHTML('beforeend', html); });}function t_menuWidgets__getWidgetsTextHTML(text, type) { let html = ''; html += '<span class="t-menuwidgeticons__text t-menuwidgeticons__text_' + type + ' t-text">'; html += text; html += '</span>'; return html;}