Skip to content

fix: merge localized article.<lang>.md with English so non-EN HTML is complete#2409

Merged
pethers merged 2 commits into
mainfrom
copilot/improve-html-generation-for-all-languages
May 11, 2026
Merged

fix: merge localized article.<lang>.md with English so non-EN HTML is complete#2409
pethers merged 2 commits into
mainfrom
copilot/improve-html-generation-for-all-languages

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

  • Identify regression in scripts/render-articles.ts — it swapped the entire English article.md for the small article.<lang>.md when present (no merge).
  • Add mergeLocalizedWithEnglish() in scripts/render-lib/article-merge.ts — keeps localized FM (title/description/language), preserves canonical-identity FM keys (date/slug/subfolder/source_folder/layout/generated_at) from English, and produces body = <localized body> + boundary + <full English body>.
  • Add 2 new i18n strings (articleEnglishCoverageHeading, articleEnglishCoverageNote) in LanguageMeta.translations for all 14 languages (incl. RTL ar/he and CJK ja/ko/zh).
  • Wire merge into scripts/render-articles.ts so non-EN languages with a localized file get the merged markdown.
  • Add 23 unit tests (tests/article-merge.test.ts).
  • Re-render existing 14-language articles for 5 dates with localized files.
  • Document the merge in Article-Generation.md.
  • Address @copilot-pull-request-reviewer feedback: update articleEnglishCoverageHeading JSDoc to reflect the real buildEnglishCoverageBoundary output (leading --- horizontal rule + ℹ️ info marker in the aside note).

@github-actions github-actions Bot added documentation Documentation updates html-css HTML/CSS changes 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 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

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

Applied Labels: documentation,html-css,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.

Copilot AI requested a review from pethers May 11, 2026 13:46
@pethers pethers marked this pull request as ready for review May 11, 2026 13:47
Copilot AI review requested due to automatic review settings May 11, 2026 13:47
@github-actions
Copy link
Copy Markdown
Contributor

🔍 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

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.

Pull request overview

Fixes a regression where non-English news/*-$LANG.html pages became truncated by replacing the full canonical English article.md with the short agent-translated article.<lang>.md. The change introduces a pure merge step that keeps localized front matter + localized executive summary while appending the full English analytical body under a localized “Detailed analysis (in English)” boundary.

Changes:

  • Add mergeLocalizedWithEnglish() (+ buildEnglishCoverageBoundary()) to merge localized and English articles while preserving canonical identity fields.
  • Extend LANGUAGE_META.*.translations with two new keys used to render the boundary heading + explanatory note across all 14 languages.
  • Wire the merge into scripts/render-articles.ts and add comprehensive Vitest coverage for merge rules and per-language boundary strings.

Reviewed changes

Copilot reviewed 25 out of 76 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/article-merge.test.ts New unit tests covering front-matter overlay rules, merge ordering, FM-only fallback, and per-language boundary rendering.
scripts/sitemap-html/i18n.ts Adds articleEnglishCoverageHeading / articleEnglishCoverageNote for all languages and extends LanguageMeta typing.
scripts/render-lib/index.ts Re-exports the new article-merge helpers from the render-lib public surface.
scripts/render-lib/article-merge.ts Implements the pure merge logic and boundary block generation.
scripts/render-articles.ts Uses the merge when article.<lang>.md exists so non-EN HTML remains complete.
Article-Generation.md Documents the localized+English merge contract to prevent future regressions.
news/2026-05-11-committeeReports-en.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-en.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-zh.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-no.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-nl.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-ko.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-ja.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-he.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-fr.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-fi.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-es.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-de.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-da.html Regenerated output (timestamp/meta updates).
news/2026-05-09-weekly-review-ar.html Regenerated output (timestamp/meta updates).
news/2026-05-08-propositions-en.html Regenerated output (timestamp/meta updates).

Comment on lines +79 to +86
* Section heading rendered between the localized executive summary
* and the full English body in non-English news articles. Used by
* `scripts/render-lib/article-merge.ts` when an `article.<lang>.md`
* file exists alongside the canonical `article.md`. The merged
* Markdown becomes:
* `<localized body>` + `## ${articleEnglishCoverageHeading}` +
* `> ${articleEnglishCoverageNote}` + `<full English body>`.
* Keep concise (max ~60 chars) — it appears as an `<h2>`.
@pethers
Copy link
Copy Markdown
Member

pethers commented May 11, 2026

@copilot apply changes based on the comments in this thread

@github-actions
Copy link
Copy Markdown
Contributor

🔍 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

@pethers pethers merged commit 094f60e into main May 11, 2026
24 checks passed
@pethers pethers deleted the copilot/improve-html-generation-for-all-languages branch May 11, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates html-css HTML/CSS changes 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