ui: remove html step counter translations

This commit is contained in:
a.tolmachev
2026-05-02 13:33:24 +00:00
parent 3a4dddd071
commit c54d234daa
11 changed files with 30 additions and 14 deletions
-3
View File
@@ -2362,9 +2362,6 @@ function applyLang() {
document.querySelectorAll('[data-i18n]').forEach(function(el) {
el.textContent = t(el.getAttribute('data-i18n'));
});
document.querySelectorAll('[data-i18n-html]').forEach(function(el) {
el.innerHTML = t(el.getAttribute('data-i18n-html'));
});
// placeholder
document.querySelectorAll('[data-i18n-ph]').forEach(function(el) {
el.placeholder = t(el.getAttribute('data-i18n-ph'));
+21 -2
View File
@@ -50,6 +50,19 @@
);
}
function renderStepCounter(counter, step, total) {
if (!counter) return;
var language = localStorage.getItem('crank_lang') || 'en';
var parts = language === 'ru'
? { prefix: 'Шаг ', suffix: ' из ' + total }
: { prefix: 'Step ', suffix: ' of ' + total };
var strong = document.createElement('strong');
counter.textContent = parts.prefix;
strong.textContent = String(step);
counter.appendChild(strong);
counter.appendChild(document.createTextNode(parts.suffix));
}
function loadStep(step, callback) {
var panelId = step === 3 ? step3PanelId() : 'step-panel-' + step;
if (document.getElementById(panelId)) {
@@ -114,8 +127,8 @@
var percentNode = document.querySelector('.progress-pct');
if (percentNode) percentNode.textContent = percent + '%';
var counter = document.querySelector('[data-step-counter]');
if (counter) counter.innerHTML = tfKey('wizard.step_of', { step: step, total: TOTAL_STEPS });
var counter = pane ? pane.querySelector('[data-step-counter]') : null;
renderStepCounter(counter, step, TOTAL_STEPS);
var backButton = document.querySelector('.btn-back');
if (backButton) {
@@ -153,6 +166,12 @@
}, Promise.resolve());
}
window.addEventListener('crank:langchange', function() {
if (window.currentStep) {
doGoToStep(window.currentStep);
}
});
function bindProtocolCards() {
document.querySelectorAll('.protocol-card').forEach(function(card) {
card.addEventListener('click', function() {