Skip to content

Firmware explorer in Russian and Chinese - #312

Merged
openipc-ai merged 5 commits into
masterfrom
explorer-ru-zh
Sep 26, 2026
Merged

openipc-ai merged 5 commits into
masterfrom
explorer-ru-zh

Conversation

@openipc-ai

Copy link
Copy Markdown
Collaborator

The firmware explorer (#311) was English-only on every locale. This puts it on /ru/firmware-explorer and /zh/firmware-explorer in the page's language.

  • Text: full explorer.ru.yml / explorer.zh.yml catalogues (UI, tabs, help), localized page title and lede, and a nav/footer entry (Обозреватель прошивок / 固件浏览器).
  • Numbers and units: the island sets the formatter's locale once; sizes, counts, KiB labels and percentages go through it instead of toLocaleString('en'). Russian reads 1 710 / 2 048 КиБ, 10,89 МБ, 83,5 %, +64,0 КБ/нед; Chinese keeps 1,710 KiB / 10.89 MB with /周 and 已用.
  • Tests: the build test asserts each locale's own title and a complete explorer catalogue; format.test.ts pins the ru/zh formats.

Validated on dev.openipc.org (591c516): both locales clicked through in a browser with no JavaScript errors and no English-formatted numbers left on the Russian page.

openipc-ai and others added 3 commits September 26, 2026 17:32
The page shipped English-only, relying on the fallback. Every explorer
string, the page title and lede, and the menu label now have ru and zh
translations; the build test asserts each locale shows its own title and a
full explorer catalogue of its own rather than English.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 943 КиБ and 1,91 МБ on the Russian page, 已用 on the Chinese tooltip:
the island sets the formatter's locale once, and every size, count and
KiB label goes through it instead of toLocaleString('en').
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Localize firmware explorer for Russian and Chinese

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds complete Russian and Chinese explorer pages, navigation, and help content.
• Localizes numbers, units, percentages, and trend rates using the active page locale.
• Verifies catalogue completeness, localized titles, and Russian and Chinese formatting behavior.
Diagram

graph TD
  A["Locale YAML"] --> B["Exported JSON"] --> C["Explorer Island"] --> D["Localized Views"]
  E["Page Locale"] --> C --> F["Format Helpers"] --> D
  G["Build Tests"] --> B
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Create locale-scoped formatter instances
  • ➕ Avoids mutable module-level locale state
  • ➕ Supports multiple locale contexts and concurrent rendering
  • ➕ Makes formatter dependencies explicit in tests and components
  • ➖ Requires passing a formatter or context throughout explorer components
  • ➖ Adds plumbing to a browser-only island with one page locale
  • ➖ Produces a substantially larger change for the current requirement

Recommendation: The PR’s shared formatter with one locale initialization is appropriate for the current single-locale, browser-rendered explorer island and keeps call sites consistent. A locale-scoped formatter factory or context would be preferable if the explorer later supports concurrent locale contexts or server rendering, but its additional plumbing is not justified here.

Files changed (20) +735 / -33

Enhancement (18) +701 / -30
explorer.en.ymlAdd localized used-space message template +1/-0

Add localized used-space message template

• Adds the canonical 'segment_used' translation so used-space labels no longer embed English text in components.

data/locales/explorer.en.yml

explorer.ru.ymlAdd complete Russian explorer catalogue +150/-0

Add complete Russian explorer catalogue

• Introduces Russian translations for explorer controls, states, tables, trends, what-if tools, errors, and help content.

data/locales/explorer.ru.yml

explorer.zh.ymlAdd complete Chinese explorer catalogue +150/-0

Add complete Chinese explorer catalogue

• Introduces Chinese translations for the complete explorer interface, including detailed help and failure states.

data/locales/explorer.zh.yml

pages.ru.ymlLocalize the Russian explorer page shell +3/-0

Localize the Russian explorer page shell

• Adds a Russian firmware explorer title and introductory lede for the localized route.

data/locales/pages.ru.yml

pages.zh.ymlLocalize the Chinese explorer page shell +3/-0

Localize the Chinese explorer page shell

• Adds a Chinese firmware explorer title and introductory lede for the localized route.

data/locales/pages.zh.yml

ru.ymlAdd Russian explorer navigation label +1/-0

Add Russian explorer navigation label

• Adds the Russian firmware explorer label used by shared navigation and footer links.

data/locales/ru.yml

zh.ymlAdd Chinese explorer navigation label +1/-0

Add Chinese explorer navigation label

• Adds the Chinese firmware explorer label used by shared navigation and footer links.

data/locales/zh.yml

Explorer.tsxInitialize formatting from the explorer locale +3/-0

Initialize formatting from the explorer locale

• Sets the shared formatter locale before rendering so all child views use the page language.

frontend/apps/site/src/components/explorer/Explorer.tsx

Summary.tsxLocalize summary sizes and percentages +6/-6

Localize summary sizes and percentages

• Routes flash labels, tooltips, meter values, KiB units, and percentages through shared locale-aware formatters. Used-space wording now comes from the translation catalogue.

frontend/apps/site/src/components/explorer/Summary.tsx

Tables.tsxLocalize table counts and package shares +6/-6

Localize table counts and package shares

• Replaces English-only count and percentage formatting across package rows and top-file summaries.

frontend/apps/site/src/components/explorer/Tables.tsx

Trends.tsxLocalize trend chart numeric labels +5/-5

Localize trend chart numeric labels

• Formats chart accessibility text, ticks, capacity labels, and point tooltips using localized numbers and KiB units.

frontend/apps/site/src/components/explorer/Trends.tsx

WhatIf.tsxLocalize projected headroom units +2/-2

Localize projected headroom units

• Uses the shared KiB formatter for calculated root filesystem headroom instead of fixed English formatting.

frontend/apps/site/src/components/explorer/WhatIf.tsx

explorer.en.jsonExport the English used-space template +1/-0

Export the English used-space template

• Adds the generated English 'segment_used' key consumed by the browser-side explorer catalogue.

frontend/apps/site/src/i18n/explorer.en.json

explorer.ru.jsonExport the Russian explorer catalogue +159/-1

Export the Russian explorer catalogue

• Replaces the empty generated catalogue with the complete Russian runtime translation set.

frontend/apps/site/src/i18n/explorer.ru.json

explorer.zh.jsonExport the Chinese explorer catalogue +159/-1

Export the Chinese explorer catalogue

• Replaces the empty generated catalogue with the complete Chinese runtime translation set.

frontend/apps/site/src/i18n/explorer.zh.json

ru.jsonExport Russian page and navigation translations +5/-0

Export Russian page and navigation translations

• Adds generated Russian firmware explorer title, lede, and navigation label entries.

frontend/apps/site/src/i18n/ru.json

zh.jsonExport Chinese page and navigation translations +5/-0

Export Chinese page and navigation translations

• Adds generated Chinese firmware explorer title, lede, and navigation label entries.

frontend/apps/site/src/i18n/zh.json

format.tsCentralize locale-aware explorer formatting +41/-9

Centralize locale-aware explorer formatting

• Adds locale selection and localized units for English, Russian, and Chinese. Number, byte, KiB, percentage, signed-size, null, and weekly-rate helpers now honor the active locale.

frontend/apps/site/src/lib/explorer/format.ts

Tests (2) +34 / -3
explorer.build.test.tsVerify localized explorer builds and catalogue parity +13/-3

Verify localized explorer builds and catalogue parity

• Checks each built locale uses its own translated title. Non-English catalogues must differ from English and expose the complete English key set.

frontend/apps/site/src/lib/explorer/explorer.build.test.ts

format.test.tsTest Russian and Chinese formatting +21/-0

Test Russian and Chinese formatting

• Adds regression coverage for Russian separators and units, localized percentages and null values, plus Chinese counts and weekly rates. The test restores English formatting afterward.

frontend/apps/site/src/lib/explorer/format.test.ts

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Russian compression stays unlocalized ✓ Resolved 🐞 Bug ≡ Correctness
Description
Summary still builds compression_ratio with Math.round(...) + '%' instead of the newly
imported fmtPct. Whenever a report includes compression metadata, Russian users see an integer
such as 84% rather than the locale-formatted 83,5 % used by the rest of the explorer.
Code

frontend/apps/site/src/components/explorer/Summary.tsx[7]

+import { fmtBytes, fmtKiB, fmtNum, fmtPct } from '../../lib/explorer/format';
Evidence
The explorer sets the formatter locale before rendering, and fmtPct explicitly implements
localized one-decimal percentage output. The summary uses that function for meter percentages but
leaves the compression ratio on a separate raw Math.round(...)+ '%' path, while the new test
establishes 83,5 % as the required Russian representation.

frontend/apps/site/src/components/explorer/Explorer.tsx[31-34]
frontend/apps/site/src/components/explorer/Summary.tsx[81-85]
frontend/apps/site/src/lib/explorer/format.test.ts[83-95]
frontend/apps/site/src/lib/explorer/format.ts[63-65]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The compression ratio in `Summary` is still rounded and rendered with a literal percent sign, bypassing the locale-aware percentage formatter added by this PR.
## Fix Focus Areas
- frontend/apps/site/src/components/explorer/Summary.tsx[81-85]
- frontend/apps/site/src/lib/explorer/format.ts[63-65]
## Recommended Fix
Replace the `Math.round(sizes.rootfs.compression_ratio * 100) + '%'` rendering with `fmtPct(sizes.rootfs.compression_ratio * 100)`, preserving the existing conditional display of compression metadata.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread frontend/apps/site/src/components/explorer/Summary.tsx
@openipc-ai
openipc-ai merged commit fe3a857 into master Sep 26, 2026
6 checks passed
@openipc-ai
openipc-ai deleted the explorer-ru-zh branch September 26, 2026 18:45
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