Skip to content

fix(i18n): Twitter Card labels (twitter:label1, twitter:label2) not localized for non-English articles #489

@pethers

Description

@pethers

📋 Issue Type

Bug Fix / i18n Quality

🎯 Objective

Fix Twitter Card twitter:label1 ("Reading time") and twitter:label2 ("Article type") to be localized per language. Currently these labels remain in English for all non-English language variants while only the twitter:data1 and twitter:data2 values are translated.

📊 Current State — Evidence from Recent PRs

Affected PRs: All news article PRs — #480, #482, #483, #485

Example — Government Propositions articles:

<!-- In 2026-02-24-government-propositions-de.html (German) -->
<meta name="twitter:label1" content="Reading time">     <!-- ❌ Should be "Lesezeit" -->
<meta name="twitter:data1" content="5 Min. Lesezeit">   <!-- ✅ Correctly localized -->
<meta name="twitter:label2" content="Article type">      <!-- ❌ Should be "Artikeltyp" -->
<meta name="twitter:data2" content="Analyse">            <!-- ✅ Correctly localized -->

<!-- Same pattern in Japanese, Arabic, Chinese, Korean, French, etc. -->
<meta name="twitter:label1" content="Reading time">      <!-- ❌ English in all languages -->
<meta name="twitter:label2" content="Article type">      <!-- ❌ English in all languages -->

Root cause: scripts/article-template.ts lines 347-349:

<meta name="twitter:label1" content="Reading time">
<meta name="twitter:label2" content="Article type">

These are hardcoded English strings. The template already receives a lang parameter but doesn't use it for label localization.

🚀 Desired State

Twitter Card labels localized per language:

Language twitter:label1 twitter:label2
en Reading time Article type
sv Lästid Artikeltyp
de Lesezeit Artikeltyp
fr Temps de lecture Type d'article
es Tiempo de lectura Tipo de artículo
ja 読了時間 記事タイプ
ar وقت القراءة نوع المقال
zh 阅读时间 文章类型
ko 읽기 시간 기사 유형
da Læsetid Artikeltype
no Lesetid Artikkeltype
fi Lukuaika Artikkelityyppi
nl Leestijd Artikeltype
he זמן קריאה סוג כתבה

🔧 Implementation Approach

  1. Add twitterLabel1 and twitterLabel2 translations to the LABELS object in scripts/data-transformers.ts
  2. Update scripts/article-template.ts to accept lang and look up localized Twitter labels
  3. Run npx vitest run to verify

🤖 Recommended Agent

code-quality-engineer — systematic fix in article template with translation table

✅ Acceptance Criteria

  • twitter:label1 is localized for all 14 languages
  • twitter:label2 is localized for all 14 languages
  • Existing twitter:data1 and twitter:data2 localization still works
  • Existing tests pass (npx vitest run)

📚 References

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions