From 25b5ed551646dd87a16c4550df4559b903ba45ad Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Mon, 13 Jul 2026 13:49:01 +0200 Subject: [PATCH] fix(legal): translate the offer price-list headings in the English view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The price list is spliced in Russian; the client-side offer transliteration turned its section headings and column headers into transliteration too. Translate the known backend-projected strings (the two section headings and the column headers Наименование/Рубли/Голоса в VK/Stars в Telegram/«Фишки») to English and transliterate only the product names, as requested. --- ui/src/lib/offer.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ui/src/lib/offer.ts b/ui/src/lib/offer.ts index b112437..ce2ea98 100644 --- a/ui/src/lib/offer.ts +++ b/ui/src/lib/offer.ts @@ -177,8 +177,18 @@ export function renderLegalHtml(doc: { ru: LegalDoc; en: LegalDoc; canonical: st var langBtn = document.getElementById('legal-lang'); var themeBtn = document.getElementById('legal-theme'); - // Offer only: the price list is spliced in Russian, so transliterate the Cyrillic that - // survives in the English body (the product names) to keep it in-language. + // Offer only: the price list is spliced in Russian. Its section headings and column headers + // are translated to English (PRICE_TR — the exact strings the backend projects); the product + // names fall through to transliteration. + var PRICE_TR = { + 'Приобретение внутриигровой валюты «Фишка»:': 'Purchase of the «Chip» in-game currency:', + 'Использование внутриигровой валюты «Фишка»:': 'Use of the «Chip» in-game currency:', + 'Наименование': 'Item', + 'Рубли': 'Roubles', + 'Голоса в VK': 'VK Votes', + 'Stars в Telegram': 'Telegram Stars', + '«Фишки»': '«Chips»' + }; function translit(s) { var m = { 'а':'a','б':'b','в':'v','г':'g','д':'d','е':'e','ё':'e','ж':'zh','з':'z','и':'i', 'й':'y','к':'k','л':'l','м':'m','н':'n','о':'o','п':'p','р':'r','с':'s','т':'t','у':'u', @@ -193,8 +203,10 @@ export function renderLegalHtml(doc: { ru: LegalDoc; en: LegalDoc; canonical: st function translitEn() { var en = document.querySelector('main[data-lang="en"]'); if (!en || !document.createTreeWalker) return; - var w = document.createTreeWalker(en, NodeFilter.SHOW_TEXT, null, false), n; + var w = document.createTreeWalker(en, NodeFilter.SHOW_TEXT, null, false), n, tr; while ((n = w.nextNode())) { + tr = PRICE_TR[n.nodeValue]; + if (typeof tr === 'string') { n.nodeValue = tr; continue; } if (/[а-яё]/i.test(n.nodeValue)) n.nodeValue = translit(n.nodeValue); } }