fix: merge localized article.<lang>.md with English so non-EN HTML is complete#2409
Conversation
… complete Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/34f1e689-de65-48f2-a080-cbf5863f2110 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🏷️ Automatic Labeling SummaryThis 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
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
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.*.translationswith two new keys used to render the boundary heading + explanatory note across all 14 languages. - Wire the merge into
scripts/render-articles.tsand 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). |
| * 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>`. |
|
@copilot apply changes based on the comments in this thread |
…output Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/0af67e42-193a-4946-bdf6-50046cea37d5 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
scripts/render-articles.ts— it swapped the entire Englisharticle.mdfor the smallarticle.<lang>.mdwhen present (no merge).mergeLocalizedWithEnglish()inscripts/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>.articleEnglishCoverageHeading,articleEnglishCoverageNote) inLanguageMeta.translationsfor all 14 languages (incl. RTL ar/he and CJK ja/ko/zh).scripts/render-articles.tsso non-EN languages with a localized file get the merged markdown.tests/article-merge.test.ts).Article-Generation.md.articleEnglishCoverageHeadingJSDoc to reflect the realbuildEnglishCoverageBoundaryoutput (leading---horizontal rule +ℹ️info marker in the aside note).