Skip to content

UI/UX, multi-language & dark/light theme overhaul — localize every generated page#2190

Merged
pethers merged 2 commits intomainfrom
copilot/enhance-ui-ux-and-multilang-support
May 2, 2026
Merged

UI/UX, multi-language & dark/light theme overhaul — localize every generated page#2190
pethers merged 2 commits intomainfrom
copilot/enhance-ui-ux-and-multilang-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

Summary

Implements UI/UX, completeness and multi-language consistency improvements for every generated and post-processed HTML page across the 14 supported languages. All 14 static landing pages (index_*.html), all 2,683+ news/article pages, news indexes, and political-intelligence pages now flow through a single i18n source of truth: scripts/render-lib/chrome-i18n.ts.

Highest-leverage fix

Before this PR, chrome.ts:353 hardcoded English 'Swedish parliamentary intelligence · Open-source · Apache-2.0' for every translated news article, news index, sitemap, and political-intelligence page. The Swedish, Arabic, Japanese, etc. variants were rendering English in their .rm-logo-tagline. Likewise the hero block in the 14 index_*.html landing pages was hand-edited per file and drifted between variants.

This PR routes every chrome string through chromeStrings(lang) and adds a replaceHero() step to the prebuild normalize script.

Changes

Phase B — Theme toggle improvement

  • Dual-icon morphing button (☀️ + 🌙) so users see what theme will activate next, not what's active now.
  • CSS swaps visibility based on html[data-theme]; transition respects prefers-reduced-motion.
  • Inline label visible on tablet+, screen-reader-only on phones (≤480px).
  • Localized aria-label, title, data-label-{dark,light} per language.

Phase C — Chrome i18n completeness

  • +10 keys to ChromeStrings × 14 languages = 140 new translated strings:
    headerTagline, heroSubtitle, heroTagline, electionCountdownLabel, electionDateLong, heroStatPoliticians, heroStatBallots, heroStatDocuments, heroStatBills, heroStatDecisions.
  • chrome.ts now sources cs.headerTagline instead of the hardcoded English literal.

Phase D — Static-page hero normalization extended

  • New replaceHero() in scripts/normalize-static-html-chrome.ts injects the localized hero block into all 14 index_*.html landing pages on every prebuild.
  • Replaces hand-authored hero subtitle, tagline, election-countdown, theme-toggle button, and 5 hero-stat labels with values from chrome-i18n.ts.
  • Editing hero copy now means editing one TS file, not 14 HTML files.

Phase E — Icon consistency

  • Hero stats prefixed with iconography (👥 🗳️ 📄 📜 🏛️) on all 14 landing pages.
  • Footer column headings get matching icons (📖 About · 🔗 Quick Links · 🏢 Built by · 🛡️ ISMS · 🌍 Languages) on all 42 static landing pages and 2,683 news/article pages.

Phase F — Tests & validation

  • New tests/chrome-i18n-hero.test.ts (5 cases): every new key defined for every language, no English copy-paste, Swedish/Arabic/English chrome render their own tagline.
  • All 3,151 existing tests still pass (85 test files).
  • HTMLHint clean across 3,539 files.
  • ESLint clean (0 errors; only pre-existing warnings in unrelated files).
  • npx tsc -p tsconfig.scripts.json clean.

Phase G — Documentation

  • Article-Generation.md §"Light and dark mode" — documents the new dual-icon button + CSS contract.
  • New §"Static-page hero block contract" — table of every hero element and its source-of-truth chromeStrings key.
  • New §"Chrome i18n source of truth" — codifies the completeness / translation / render-parity invariants enforced by tests.

Out of scope (deferred to follow-up PRs)

Files changed

  • scripts/render-lib/chrome-i18n.ts — +10 keys × 14 languages
  • scripts/render-lib/chrome.tstagline constant sourced from cs.headerTagline
  • scripts/normalize-static-html-chrome.tsreplaceHero(), themeToggleButton(), 4 footer-heading icons
  • styles.css — dual-icon morph styles for theme toggle
  • 14 × index_*.html — regenerated hero
  • All 42 static landing pages + 2,683 news/article pages — footer headings get icons (post-processed at prebuild time)
  • Article-Generation.md — new contract sections
  • tests/chrome-i18n-hero.test.ts — new test (5 cases)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions github-actions Bot added documentation Documentation updates dashboard Interactive dashboards (Chart.js/D3.js) html-css HTML/CSS changes i18n Internationalization/localization translation Translation updates rtl RTL language support (Arabic, Hebrew) testing Test coverage refactor Code refactoring news News articles and content generation size-xl Extra large change (> 1000 lines) labels May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: documentation,dashboard,html-css,i18n,translation,rtl,testing,refactor,size-xl,news

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@pethers pethers marked this pull request as ready for review May 2, 2026 14:01
Copilot AI review requested due to automatic review settings May 2, 2026 14:01
@pethers pethers merged commit 51a537e into main May 2, 2026
27 checks passed
@pethers pethers deleted the copilot/enhance-ui-ux-and-multilang-support branch May 2, 2026 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

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

Labels

dashboard Interactive dashboards (Chart.js/D3.js) documentation Documentation updates html-css HTML/CSS changes i18n Internationalization/localization news News articles and content generation refactor Code refactoring rtl RTL language support (Arabic, Hebrew) size-xl Extra large change (> 1000 lines) testing Test coverage translation Translation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants