Conversation
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…hrases Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate remaining data-translate="true" markers in non-Swedish news/*.html articles by batch-applying the existing translateSwedishContent() post-processor, and committing the resulting HTML updates so translation validation passes.
Changes:
- Added a batch fixer script to rewrite
news/*.htmlfiles by removingdata-translate="true"markers viatranslateSwedishContent(). - Updated many non-Swedish news HTML files to remove
data-translate="true"markers on Swedish spans. - Committed regenerated article content across multiple languages (month-ahead / committee-reports / government-propositions / week-ahead).
Reviewed changes
Copilot reviewed 50 out of 106 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/fix-data-translate-markers.ts | New batch script to remove data-translate="true" markers from non-Swedish news articles. |
| news/2026-02-27-week-ahead-en.html | Removes translation markers in EN article content. |
| news/2026-02-22-month-ahead-zh.html | Removes translation markers in ZH article content. |
| news/2026-02-22-month-ahead-no.html | Removes translation markers in NO article content. |
| news/2026-02-22-month-ahead-nl.html | Removes translation markers in NL article content. |
| news/2026-02-22-month-ahead-ko.html | Removes translation markers in KO article content. |
| news/2026-02-22-month-ahead-he.html | Removes translation markers in HE article content. |
| news/2026-02-22-month-ahead-fr.html | Removes translation markers in FR article content. |
| news/2026-02-22-month-ahead-es.html | Removes translation markers in ES article content. |
| news/2026-02-22-month-ahead-en.html | Removes translation markers in EN article content. |
| news/2026-02-22-month-ahead-de.html | Removes translation markers in DE article content. |
| news/2026-02-22-month-ahead-ar.html | Removes translation markers in AR article content. |
| news/2026-02-22-government-propositions-zh.html | Removes translation markers in ZH propositions article content. |
| news/2026-02-22-government-propositions-no.html | Removes translation markers in NO propositions article content. |
| news/2026-02-22-government-propositions-nl.html | Removes translation markers in NL propositions article content. |
| news/2026-02-22-government-propositions-ko.html | Removes translation markers in KO propositions article content. |
| news/2026-02-22-government-propositions-ja.html | Removes translation markers in JA propositions article content. |
| news/2026-02-22-government-propositions-he.html | Removes translation markers in HE propositions article content. |
| news/2026-02-22-government-propositions-fr.html | Removes translation markers in FR propositions article content. |
| news/2026-02-22-government-propositions-fi.html | Removes translation markers in FI propositions article content. |
| news/2026-02-22-government-propositions-es.html | Removes translation markers in ES propositions article content. |
| news/2026-02-22-government-propositions-en.html | Removes translation markers in EN propositions article content. |
| news/2026-02-22-government-propositions-de.html | Removes translation markers in DE propositions article content. |
| news/2026-02-22-government-propositions-da.html | Removes translation markers in DA propositions article content. |
| news/2026-02-22-government-propositions-ar.html | Removes translation markers in AR propositions article content. |
| news/2026-02-22-committee-reports-zh.html | Removes translation markers in ZH committee-reports article content. |
| news/2026-02-22-committee-reports-no.html | Removes translation markers in NO committee-reports article content. |
| news/2026-02-22-committee-reports-nl.html | Removes translation markers in NL committee-reports article content. |
| news/2026-02-22-committee-reports-ko.html | Removes translation markers in KO committee-reports article content. |
| news/2026-02-22-committee-reports-ja.html | Removes translation markers in JA committee-reports article content. |
| news/2026-02-22-committee-reports-he.html | Removes translation markers in HE committee-reports article content. |
| news/2026-02-22-committee-reports-fr.html | Removes translation markers in FR committee-reports article content. |
| news/2026-02-22-committee-reports-fi.html | Removes translation markers in FI committee-reports article content. |
| news/2026-02-22-committee-reports-es.html | Removes translation markers in ES committee-reports article content. |
| news/2026-02-22-committee-reports-en.html | Removes translation markers in EN committee-reports article content. |
| news/2026-02-22-committee-reports-de.html | Removes translation markers in DE committee-reports article content. |
| news/2026-02-22-committee-reports-da.html | Removes translation markers in DA committee-reports article content. |
| news/2026-02-22-committee-reports-ar.html | Removes translation markers in AR committee-reports article content. |
| @@ -343,53 +343,53 @@ <h4><a href="https://www.riksdagen.se/en/calendar/?from=2026-03-06&to=2026-0 | |||
|
|
|||
| <h2>Parliamentary Questions to Ministers</h2> | |||
| <div class="document-entry"> | |||
| <h4><span data-translate="true" lang="sv">Åtgärder för att nå transportmålet</span></h4> | |||
| <h4><span lang="sv">measureer för att nå transportmålet</span></h4> | |||
There was a problem hiding this comment.
The <span lang="sv">…</span> now contains mixed/incorrect-language text ("measureer för att nå transportmålet"). This is both a spelling issue ("measureer") and an accessibility issue because lang="sv" indicates Swedish while the content is not Swedish. Either keep the original Swedish text if it’s intentionally untranslated, or fully translate to English and remove/set the lang attribute accordingly.
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDC120260324ip/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Interpellationssvar</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDC120260324ip/" target="_blank" rel="noopener noreferrer"><span lang="sv">质询ssvar</span></a></h4> |
There was a problem hiding this comment.
This entry still contains a Swedish suffix due to partial prefix-translation (e.g. "质询ssvar"). That indicates Interpellationssvar wasn’t translated as a whole term, and the result is mixed-language text wrapped in lang="sv". Please ensure the dictionary has an exact-match entry for the full Swedish term (and/or adjust the prefix-match algorithm) and regenerate/re-run the fixer so the output is a fully Chinese phrase without leftover Swedish fragments.
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3F%C3%B6U202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">国防委员会s sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on defence and security policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Utbildningsutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">教育委员会s sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on education policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Civilutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">民事委员会s sammanträde</span></a></h4> |
There was a problem hiding this comment.
Several committee meeting entries are only partially translated (e.g. "国防委员会s sammanträde"), leaving the Swedish genitive suffix and the Swedish word "sammanträde" in a non-Swedish article. This contradicts the PR goal of translating Swedish parliamentary terms. Add exact dictionary entries for the full phrase (e.g. "försvarsutskottets sammanträde") and regenerate/re-run the fixer so the rendered text is fully in the target language (and doesn’t keep lang="sv" when translated).
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3F%C3%B6U202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Committee on Defences sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on defence and security policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Utbildningsutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Committee on Educations sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on education policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Civilutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Committee on Civil Affairss sammanträde</span></a></h4> |
There was a problem hiding this comment.
These committee meeting labels show partial translation artifacts from Swedish genitive handling (e.g. "Committee on Defences sammanträde", "Civil Affairss"), which reads incorrectly in English and leaves Swedish text in the UI. This suggests the dictionary/prefix-match logic is still splitting at the committee name and appending the remainder. Prefer exact-match dictionary entries for the full genitive phrase ("…utskottets sammanträde") and for standalone "sammanträde", then re-run generation so the output is fully translated (and avoid keeping lang="sv" on translated text).
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3F%C3%B6U202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Comité de la défenses sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on defence and security policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Utbildningsutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3UbU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Comité de l'éducations sammanträde</span></a></h4> | ||
| <p class="policy-significance">Touches on education policy. Parliamentary committee review and chamber debate will shape the final outcome.</p> | ||
| </div> | ||
|
|
||
| <div class="document-entry"> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span data-translate="true" lang="sv">Civilutskottets sammanträde</span></a></h4> | ||
| <h4><a href="https://riksdagen.se/sv/dokument-och-lagar/dokument/HDA3CU202603241100/" target="_blank" rel="noopener noreferrer"><span lang="sv">Comité des affaires civiless sammanträde</span></a></h4> |
There was a problem hiding this comment.
The translated committee meeting strings still include Swedish remnants (e.g. "Comité de la défenses sammanträde") and are wrapped in lang="sv", which misrepresents the language for screen readers. After fixing the dictionary/prefix-match for full phrases, ensure the span lang is removed or set to the article language when a translation is applied.
| <h3><span lang="sv">瑞典国家审计局报告 om miljöräddning vid stora olyckor till sjöss</span></h3> | ||
| <p>该提案涉及 This Defence Ministry proposal concerns national security or defence posture.<br><strong>提交至:</strong> Försvarsdepartementet</p> |
There was a problem hiding this comment.
This heading is now mixed Chinese + Swedish ("Swedish National Audit Office report om …") but still marked lang="sv". That’s both a translation-quality issue and an accessibility issue (incorrect language metadata). After updating the dictionary/prefix matching, regenerate so the entire phrase is consistently in Chinese, or keep it fully Swedish if intentionally untranslated (and then don’t prepend Chinese).
| <h3><span lang="sv">瑞典国家审计局报告 om miljöräddning vid stora olyckor till sjöss</span></h3> | |
| <p>该提案涉及 This Defence Ministry proposal concerns national security or defence posture.<br><strong>提交至:</strong> Försvarsdepartementet</p> | |
| <h3>瑞典国家审计署关于重大海上事故环境救援的报告</h3> | |
| <p>该提案涉及一项国防部的提案,内容关系到国家安全和防务态势。<br><strong>提交至:</strong> Försvarsdepartementet</p> |
| * What it does: | ||
| * - For each non-SV article containing `data-translate="true"` spans: | ||
| * 1. Attempts dictionary translation of the enclosed Swedish text | ||
| * 2. Removes the `data-translate="true"` attribute (and the span wrapper | ||
| * when no other attributes remain) | ||
| * 3. Keeps the `lang="sv"` attribute for screen-reader accessibility | ||
| * when the phrase could not be translated | ||
| * |
There was a problem hiding this comment.
The header comment claims the script removes the span wrapper when no other attributes remain and that it keeps lang="sv" only when translation fails. However translateSwedishContent() (translation-dictionary.ts) always preserves lang="sv" on the span (it just strips data-translate), so the wrapper will never be removed and translated content will still be tagged as Swedish. Consider updating translateSwedishContent() to drop/adjust lang when translation occurs (and only keep lang="sv" when the inner text is unchanged), then re-run this script.
| const NON_SWEDISH_LANGS: readonly string[] = [ | ||
| 'en', 'da', 'no', 'fi', 'de', 'fr', 'es', 'nl', 'ar', 'he', 'ja', 'ko', 'zh', | ||
| ]; | ||
|
|
||
| function getLanguageFromFilename(filename: string): string | null { | ||
| const match = filename.match(/-([a-z]{2})\.html$/); | ||
| return match ? (match[1] ?? null) : null; | ||
| } | ||
|
|
||
| function processFile(filepath: string): { modified: boolean; markersBefore: number; markersAfter: number } { | ||
| const filename = path.basename(filepath); | ||
| const lang = getLanguageFromFilename(filename); | ||
|
|
||
| if (!lang || !NON_SWEDISH_LANGS.includes(lang)) { | ||
| return { modified: false, markersBefore: 0, markersAfter: 0 }; | ||
| } | ||
|
|
||
| const original = fs.readFileSync(filepath, 'utf-8'); | ||
|
|
||
| const markersBefore = (original.match(/data-translate="true"/g) ?? []).length; | ||
| if (markersBefore === 0) { | ||
| return { modified: false, markersBefore: 0, markersAfter: 0 }; | ||
| } | ||
|
|
||
| const modified = translateSwedishContent(original, lang as Language); | ||
|
|
There was a problem hiding this comment.
lang is derived as string and then cast to Language when calling translateSwedishContent(). This can hide unexpected values at compile time and may cause runtime issues if new languages are added or filenames don’t match the expected pattern. Prefer typing NON_SWEDISH_LANGS as readonly Language[] and narrowing lang to Language before calling the translation function (removing the cast).
…ed before marker removal Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…ve without translating) Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…flow agents Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Two related translation bugs: (1) the static dictionary stripped
data-translate="true"markers even when no match was found, leaving silent Swedish text in Arabic/Hebrew/etc. articles; (2) agent workflows only passively detected untranslated spans — they never explicitly instructed Copilot to translate them using LLM capabilities.TypeScript:
translatePhrasereturnsnullon no-matchtranslatePhrase()return type changedstring → string | null. Returnsnullwhen no dictionary entry matches (instead of the original Swedish text).svstill returns the string unchanged.translateSwedishContent()now only strips the marker when translation is non-null — ifnull, the original span includingdata-translate="true"is left intact for validation tooling and the LLM pass to handle.Agent workflows: mandatory LLM translation pass in all 10
news-*.mdfilesAll 10 news generation workflow files now contain an identical MANDATORY LLM Translation Pass block in Step 4. Three files had their old weak "check + maybe translate" pattern replaced; seven files had no active translation step at all and received the block before their validation command.
The block:
data-translate="true"spansar/he, native script for CJK, zero markers in committed outputOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.