Skip to content

feat(i18n): Builder Phase 2A — базовые RU/EN элементы Mihomo Builder (#353) - #354

Merged
saymer-alt merged 1 commit into
mainfrom
feat/i18n-builder-2a-353
Nov 8, 2026
Merged

saymer-alt merged 1 commit into
mainfrom
feat/i18n-builder-2a-353

Conversation

@saymer-alt

@saymer-alt saymer-alt commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

feat(i18n): Builder Phase 2A — базовые RU/EN элементы Mihomo Builder (#353)

Draft. Merge только после отдельного owner GO. Ветка feat/i18n-builder-2a-353 от main e365f96a (после merged #350/#346). Head: 6cb70cda68e36e3279be14daec60a48b77b6ccf9.

Scope (узкий, по issue #353)

  • 37 семантических RU/EN ключей builder.* в i18n.js для видимого базового рабочего пути Builder: action bar (кнопки + title-подсказки + ARIA), workspace-nav (4 ссылки + aria), быстрый старт (заголовок, шаги), карточка профиля (заголовок + тексты 3 option'ов), режим маршрутизации (заголовок, AWL-тогл, router-hint), основные серверы/подписки (заголовок, label, placeholder, ARIA списков имён провайдеров, резервный label).
  • 3 динамические подсказки профиля (router / vps-local / vps-gateway): PROFILE_HINTS рендерится через profileHintLocalized() (textContent, не innerHTML); при отсутствии i18n.js или ключа — байт-в-байт прежнее поведение (RU-константа остаётся fallback). Ре-рендер при смене языка — через новый LGI18N.onLangChange (listener'ы только после валидного setLang, сбой одного не ломает переключение).
  • Mixed markup обработан безопасно: текст AWL-тогла обёрнут в <span data-i18n> внутри label, чекбокс и ctx-help не затронуты; DOM не пересоздаётся (только textContent / allowlisted атрибуты).
  • НЕ входит (deferred, см. ниже): builderActionStatus (много динамических рендеров), stackWarnings VPS-профиля, длинные mixed-hint'ы, вкладки WARP/Studio, quick-start.html, полная EN.

Строгие границы (не тронуто)

web4core.runtime.js, генерация YAML, HWID/device identity, маршрутизация/DPR/Tiered/AWL, проектный формат, сетевые операции, DOM IDs, option.value (проверено тестом), file:///offline. Локаль хранится только в link-generators.locale.v1 (enum ru|en, как в #350); в проект, YAML и fingerprint не входит (тест: rbCollectProject без locale/i18n-ключей, buildStateFingerprint не обращается к i18n).

Тесты

  • tests/i18n-builder-2a.cjs (node, 13 проверок): parity словаря 37×2, RU-значения = зеркальные исходные тексты UI (анти-дрейф), EN без кириллицы, каждый статический ключ подключён в разметке, data-i18n запрещён на input/select/textarea (значения не переводятся), data-i18n-attr только allowlist (title/placeholder/aria-label/aria-description), option.value/selected не изменились, AWL-чекбокс вне span-обёртки, profileHintLocalized (EN/RU через словарь + честный fallback при отсутствии i18n/ключа), PROFILE_HINTS-константа не дрейфует от словаря, единая точка рендера, i18n.js hygiene (no fetch/innerHTML/cookie) + onLangChange семантика, i18n не проникает в buildMihomo/fingerprint/проект.
  • tests/i18n-builder-2a-browser.cjs (Playwright, TEST_ENGINES): default RU на видимой вкладке Builder → переключение EN (labels/ARIA/placeholder, option.value неизменны) → динамический hint следует локали при смене профиля → RU→EN→RU с заполненной формой: DOM identity (те же узлы), значения формы, buildStateFingerprint идентичен, STALE не появляется, YAML в textarea не тронут, пересборка в EN и RU — байт-в-байт → locale только в localStorage (project JSON чист) → smoke 320/390 (селектор виден и работает). Мониторинг pageerror + non-CDN запросов.
  • Обновлены контракты: tests/i18n-foundation.cjs (DICT_KEYS расширен — exact-set guard), tests/version-badge.cjs (regex AWL-тогла терпит <span data-i18n>, интенция «щит у чекбокса» сохранена).

CI

Workflow Run Результат
Generator CI 42488520626 success 6/6 (static+node, browser, owner-UX firefox, owner-UX webkit, compat 1.19.31, compat 1.19.33)
Update web4core runtime 42488520226 success

Обязательный прогон на pinned Mihomo 1.19.31 и 1.19.33 — mihomo-compat job, оба PASS.

Per-check evidence на head 6cb70cd564cbb9fe288d63ea99b4ef4e83be8177:

Local node-регрессии (pre-push): policy-routing 33, no-direct-egress 18, config-roundtrip 10, routing-inspector 59 — PASS.

Честные границы / риски

…hints (#353)

Presentation only: action bar, workspace nav, quick start, profile/routing/
sources cards, 3 dynamic profile hints via profileHintLocalized + onLangChange.
No YAML/HWID/routing/DPR/web4core changes. Tests: i18n-builder-2a (node),
i18n-builder-2a-browser (TEST_ENGINES), CI steps in static/browser/owner-UX jobs.

Copy link
Copy Markdown
Owner Author

Independent review checkpoint — 2026-11-08

Verified against live GitHub PR HEAD 6cb70cd564cbb9fe288d63ea99b4ef4e83be8177 (base main=e365f96b86e63f6e19e1713948014574f31c8fb3). Note: the PR body introductory “Head” line currently cites a different SHA (6cb70cda68e36e3279be14daec60a48b77b6ccf9); that appears stale/incorrect. Use GitHub head.sha and the exact workflow run references for gating.

Generator CI #42488520626: 6/6 SUCCESS at current head (static+Node, Chromium, Firefox, WebKit, Mihomo 1.19.31 & 1.19.33). Runtime provenance #42488520226: SUCCESS at same head. PR OPEN DRAFT, mergeable clean versus present main, no unresolved review threads, seven intended files.

Diff inspection: 37 localized Builder labels/attributes and 3 dynamic profile hint strings via textContent/locale callback. option.value, routing logic, YAML, generated web4core.runtime.js, project storage and private data paths were not edited. Full English remains intentionally out of scope.

Integration overlap warning: draft VPS #352 edits .github/workflows/generator-ci.yml and index.html as well. After merging either PR, refresh/reconcile the other against new main and re-run all checks on the exact new SHA; do not reuse the old green evidence. Since #352 has an outstanding all-unhealthy provider no-leak runtime acceptance gate (#284), merging presentation-only #354 first is a reasonable conservative order, subject to owner GO.

Verdict: Code + CI ready for owner GO, but NO MERGE executed by this review.

@saymer-alt
saymer-alt marked this pull request as ready for review November 8, 2026 16:29
@saymer-alt
saymer-alt merged commit 23b851a into main Nov 8, 2026
10 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T16:30:34.328852Z 6cb70cd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@saymer-alt
saymer-alt deleted the feat/i18n-builder-2a-353 branch November 8, 2026 16:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cb70cd564

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.html
Comment on lines +3693 to +3696
if (window.LGI18N && typeof window.LGI18N.onLangChange === 'function') window.LGI18N.onLangChange(function () {
var hint = document.getElementById('profileHint');
if (hint) hint.textContent = profileHintLocalized(selectedProfile);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh the profile hint when restoring the saved locale

When a user selects English and reloads the page, the profile hint remains Russian even though the translated controls and language selector show English. The inline startup call to applyProfileUiState(selectedProfile) renders the hint before DOMContentLoaded, while LGI18N still defaults to Russian; subsequently, init() restores the saved English locale through syncDocument() without notifying this listener. Notify dynamic translation listeners during locale initialization, or render the hint after the stored locale has been restored, and cover the reload path in the browser regression.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant