{t.englishOnly}
- )}{t.historical}
From 30a394ad2fa5c162004ba08163454c65b7c6517f Mon Sep 17 00:00:00 2001
From: Sergi Gonzalez <31130069+TheHypnoo@users.noreply.github.com>
Date: Fri, 30 Oct 2026 14:53:42 +0100
Subject: [PATCH] feat(blog): show a translation bar with a help-translate link
on untranslated posts
---
src/i18n/locales/de.json | 1 +
src/i18n/locales/en.json | 1 +
src/i18n/locales/es.json | 1 +
src/i18n/locales/fr.json | 1 +
src/i18n/locales/id.json | 1 +
src/i18n/locales/it.json | 1 +
src/i18n/locales/ja.json | 1 +
src/i18n/locales/ko.json | 1 +
src/i18n/locales/pt.json | 1 +
src/i18n/locales/th.json | 1 +
src/i18n/locales/tr.json | 1 +
src/i18n/locales/vi.json | 1 +
src/i18n/locales/zh-Hans.json | 1 +
src/lib/links.ts | 1 +
src/pages/[lang]/blog/[slug]/index.astro | 50 ++++++++++++++++++++----
15 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json
index 00ffd05..42b2671 100644
--- a/src/i18n/locales/de.json
+++ b/src/i18n/locales/de.json
@@ -28,6 +28,7 @@
"share": "Teilen",
"copyLink": "Link kopieren",
"englishOnly": "Dieser Beitrag ist nur auf Englisch verfügbar.",
+ "helpTranslate": "Hilf beim Übersetzen",
"historical": "Dieser datierte Artikel hält die Perry-Version und die Messwerte zum Zeitpunkt der Veröffentlichung fest. Für aktuelle Entscheidungen gelten die aktuellen Einschränkungen, der Plattform-Leitfaden und die Benchmark-Daten."
},
"compare": {
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 7a4f628..90279c9 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -28,6 +28,7 @@
"share": "Share",
"copyLink": "Copy link",
"englishOnly": "This post is available in English only.",
+ "helpTranslate": "Help translate it",
"historical": "This dated article records the Perry version and measurements available when it was published. Use the current limitations, platform guide, and benchmark artifact for decisions today."
},
"compare": {
diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json
index b7403e1..7e6c751 100644
--- a/src/i18n/locales/es.json
+++ b/src/i18n/locales/es.json
@@ -28,6 +28,7 @@
"share": "Compartir",
"copyLink": "Copiar enlace",
"englishOnly": "Este artículo solo está disponible en inglés.",
+ "helpTranslate": "Ayuda a traducirlo",
"historical": "Este artículo fechado recoge la versión de Perry y las mediciones disponibles cuando se publicó. Para decidir hoy, consulta las limitaciones actuales, la guía de plataformas y los datos de benchmarks."
},
"compare": {
diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json
index c63b7d7..a63d5df 100644
--- a/src/i18n/locales/fr.json
+++ b/src/i18n/locales/fr.json
@@ -28,6 +28,7 @@
"share": "Partager",
"copyLink": "Copier le lien",
"englishOnly": "Cet article est disponible uniquement en anglais.",
+ "helpTranslate": "Aidez à le traduire",
"historical": "Cet article daté reflète la version de Perry et les mesures disponibles à sa publication. Pour décider aujourd'hui, reportez-vous aux limitations actuelles, au guide des plateformes et aux données de benchmark."
},
"compare": {
diff --git a/src/i18n/locales/id.json b/src/i18n/locales/id.json
index 62004c1..b506607 100644
--- a/src/i18n/locales/id.json
+++ b/src/i18n/locales/id.json
@@ -27,6 +27,7 @@
"share": "Bagikan",
"copyLink": "Salin tautan",
"englishOnly": "Artikel ini hanya tersedia dalam bahasa Inggris.",
+ "helpTranslate": "Bantu terjemahkan",
"historical": "Artikel bertanggal ini mencatat versi Perry dan hasil pengukuran saat diterbitkan. Untuk keputusan hari ini, lihat batasan terkini, panduan platform, dan data benchmark."
},
"compare": {
diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json
index a9708cf..b6cd763 100644
--- a/src/i18n/locales/it.json
+++ b/src/i18n/locales/it.json
@@ -28,6 +28,7 @@
"share": "Condividi",
"copyLink": "Copia link",
"englishOnly": "Questo articolo è disponibile solo in inglese.",
+ "helpTranslate": "Aiuta a tradurlo",
"historical": "Questo articolo datato riporta la versione di Perry e le misurazioni disponibili al momento della pubblicazione. Per le decisioni di oggi, consulta le limitazioni attuali, la guida alle piattaforme e i dati dei benchmark."
},
"compare": {
diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json
index 1b0b49b..45141da 100644
--- a/src/i18n/locales/ja.json
+++ b/src/i18n/locales/ja.json
@@ -27,6 +27,7 @@
"share": "共有",
"copyLink": "リンクをコピー",
"englishOnly": "この記事は英語のみで提供されています。",
+ "helpTranslate": "翻訳に協力する",
"historical": "この記事は、公開時点の Perry のバージョンと計測値を記録したものです。現在の判断には、最新の制限事項、プラットフォームガイド、ベンチマークデータを参照してください。"
},
"compare": {
diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json
index 7d23183..a34446a 100644
--- a/src/i18n/locales/ko.json
+++ b/src/i18n/locales/ko.json
@@ -27,6 +27,7 @@
"share": "공유",
"copyLink": "링크 복사",
"englishOnly": "이 글은 영어로만 제공됩니다.",
+ "helpTranslate": "번역 돕기",
"historical": "이 글은 게시 시점의 Perry 버전과 측정값을 기록합니다. 현재 판단에는 최신 제한 사항, 플랫폼 가이드, 벤치마크 데이터를 참고하세요."
},
"compare": {
diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json
index 4a16260..b90ab6d 100644
--- a/src/i18n/locales/pt.json
+++ b/src/i18n/locales/pt.json
@@ -28,6 +28,7 @@
"share": "Compartilhar",
"copyLink": "Copiar link",
"englishOnly": "Este artigo está disponível apenas em inglês.",
+ "helpTranslate": "Ajude a traduzi-lo",
"historical": "Este artigo datado registra a versão do Perry e as medições disponíveis quando foi publicado. Para decidir hoje, consulte as limitações atuais, o guia de plataformas e os dados de benchmark."
},
"compare": {
diff --git a/src/i18n/locales/th.json b/src/i18n/locales/th.json
index 721d58f..f809116 100644
--- a/src/i18n/locales/th.json
+++ b/src/i18n/locales/th.json
@@ -27,6 +27,7 @@
"share": "แชร์",
"copyLink": "คัดลอกลิงก์",
"englishOnly": "บทความนี้มีเฉพาะภาษาอังกฤษเท่านั้น",
+ "helpTranslate": "ช่วยแปลบทความนี้",
"historical": "บทความนี้บันทึกเวอร์ชันของ Perry และผลการวัด ณ เวลาที่เผยแพร่ หากต้องตัดสินใจในวันนี้ โปรดดูข้อจำกัดปัจจุบัน คู่มือแพลตฟอร์ม และข้อมูลเบนช์มาร์ก"
},
"compare": {
diff --git a/src/i18n/locales/tr.json b/src/i18n/locales/tr.json
index 3b78f2a..846917d 100644
--- a/src/i18n/locales/tr.json
+++ b/src/i18n/locales/tr.json
@@ -27,6 +27,7 @@
"share": "Paylaş",
"copyLink": "Bağlantıyı kopyala",
"englishOnly": "Bu yazı yalnızca İngilizce olarak mevcuttur.",
+ "helpTranslate": "Çevirisine yardım et",
"historical": "Bu tarihli yazı, yayımlandığı andaki Perry sürümünü ve ölçümleri kaydeder. Bugünkü kararlar için güncel sınırlamalara, platform kılavuzuna ve benchmark verilerine bakın."
},
"compare": {
diff --git a/src/i18n/locales/vi.json b/src/i18n/locales/vi.json
index 5515c79..d811f84 100644
--- a/src/i18n/locales/vi.json
+++ b/src/i18n/locales/vi.json
@@ -27,6 +27,7 @@
"share": "Chia sẻ",
"copyLink": "Sao chép liên kết",
"englishOnly": "Bài viết này chỉ có bằng tiếng Anh.",
+ "helpTranslate": "Giúp dịch bài này",
"historical": "Bài viết có ghi ngày này phản ánh phiên bản Perry và số liệu đo tại thời điểm xuất bản. Để ra quyết định hôm nay, hãy xem các giới hạn hiện tại, hướng dẫn nền tảng và dữ liệu benchmark."
},
"compare": {
diff --git a/src/i18n/locales/zh-Hans.json b/src/i18n/locales/zh-Hans.json
index 154e224..8ad4a34 100644
--- a/src/i18n/locales/zh-Hans.json
+++ b/src/i18n/locales/zh-Hans.json
@@ -27,6 +27,7 @@
"share": "分享",
"copyLink": "复制链接",
"englishOnly": "本文仅提供英文版本。",
+ "helpTranslate": "帮助翻译",
"historical": "本文记录的是发布时的 Perry 版本和测量数据。如需做出当前决策,请参阅最新的限制说明、平台指南和基准测试数据。"
},
"compare": {
diff --git a/src/lib/links.ts b/src/lib/links.ts
index 816a5a8..e524084 100644
--- a/src/lib/links.ts
+++ b/src/lib/links.ts
@@ -14,5 +14,6 @@ export const links = {
limitations: "https://perryts.github.io/perry/language/limitations.html",
platforms: "https://perryts.github.io/perry/platforms/overview.html",
geisterhand: "https://geisterhand.io",
+ siteRepo: "https://github.com/PerryTS/perryts.com",
serverSource: "https://github.com/PerryTS/perryts.com/blob/main/native-entry/server.ts",
} as const;
diff --git a/src/pages/[lang]/blog/[slug]/index.astro b/src/pages/[lang]/blog/[slug]/index.astro
index 0abc893..5fc7101 100644
--- a/src/pages/[lang]/blog/[slug]/index.astro
+++ b/src/pages/[lang]/blog/[slug]/index.astro
@@ -1,6 +1,8 @@
---
import { render } from "astro:content";
import Info from "@lucide/astro/icons/info";
+import Languages from "@lucide/astro/icons/languages";
+import GitPullRequest from "@lucide/astro/icons/git-pull-request";
import Calendar from "@lucide/astro/icons/calendar";
import Timer from "@lucide/astro/icons/timer";
import Base from "../../../../layouts/Base.astro";
@@ -14,6 +16,7 @@ import { messages, plural } from "../../../../i18n/messages.ts";
import { locales, localePath, type Locale } from "../../../../i18n/index.ts";
import { formatPostDate, getPosts, type Post } from "../../../../lib/blog.ts";
import { readingMinutes } from "../../../../lib/reading-time.ts";
+import { links } from "../../../../lib/links.ts";
import { DEFAULT_SOCIAL_IMAGE, socialImageUrl } from "../../../../lib/seo.ts";
// Every post exists under every locale, like the previous site; untranslated ones show English with a notice.
@@ -46,6 +49,8 @@ const minutes = readingMinutes(entry.body ?? "", isFallback ? "en" : lang);
const path = `blog/${post.slug}`;
const url = new URL(localePath(lang, path), Astro.site).toString();
const contentLang = isFallback ? "en" : lang;
+// GitHub's new-file editor; non-collaborators get a fork and a pull request automatically.
+const translateUrl = `${links.siteRepo}/new/main/src/content/blog/${post.slug}?filename=${lang}.md`;
const published = entry.data.date.toISOString();
const blogPosting = {
"@context": "https://schema.org",
@@ -74,6 +79,15 @@ const blogPosting = {
publishedTime={published}
>
{t.englishOnly}
+ {t.helpTranslate} +