fix(legal): translate the offer price-list headings in the English view
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 20s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m54s

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.
This commit is contained in:
Ilia Denisov
2026-07-13 13:49:01 +02:00
parent de5ab9186c
commit 25b5ed5516
+15 -3
View File
@@ -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);
}
}