Кнопка переключателя языков для шаблона Intec Universe - пример кода на javascript

 
Вставляем код по ссылке на вкладке JavqScript: /bitrix/admin/constructor_builds_edit.php?build=1&lang=ru
Код
BX.ready(function () {
    const curUrl = window.location.href;
    const origin = window.location.origin;

    // Находим родительский блок
    const buttonsContainer = BX.findChild(document, { className: 'widget-authorization-buttons' }, true);

    if (!buttonsContainer) {
        console.error('Контейнер widget-authorization-buttons не найден!');
        return;
    }

    // Вспомогательная функция для создания элементов
    const createElement = (tag, props = {}, children = []) => {
        return BX.create(tag, { props, children });
    };

    // Формируем ссылку и текст для кнопки
    const href =
        BX.message('SITE_DIR') === '/'
            ? '/ru' + curUrl.replace(origin, '')
            : curUrl.replace(BX.message('SITE_DIR'), '/').replace(origin, '');
    const text = BX.message('LANGUAGE_ID') === 'ua' ? 'RU' : 'UA';

    // Создаем новую кнопку с минимальной вложенностью
    const newButton = createElement('div', { className: 'intec-grid-item-auto' }, [
        createElement('div', { className: 'widget-authorization-button' }, [
            createElement('div', { className: 'intec-grid intec-grid-nowrap intec-grid-a-v-center intec-grid-i-h-4' }, [
                createElement('div', { className: 'intec-grid-item-auto' }, [
                    createElement('a', { className: 'widget-authorization-button-content', href }, [text]),
                ]),
            ]),
        ]),
    ]);

    // Добавляем новый блок в контейнер
    BX.append(newButton, buttonsContainer);
});
Читают тему