diff --git a/.agents/docs/playbooks/add-blog-post.md b/.agents/docs/playbooks/add-blog-post.md index 9ec79e5c9e..2bc3c1810a 100644 --- a/.agents/docs/playbooks/add-blog-post.md +++ b/.agents/docs/playbooks/add-blog-post.md @@ -16,6 +16,12 @@ that directory as a post. 3. **To add a new `type` value**, extend the enum in `config.ts` _and_ add the matching key to `apps/outreach/src/i18n/translations/blog.json`. The badge renders `t('blog.')`, so without the key it shows the raw key. +4. **To translate a post, give the translation its own filename in its language and set + `translationOf` to the original's filename without `.md`.** Set it on the translation only: + `getPublishedAltPost()` in `apps/outreach/src/lib/blog.ts` pairs the two from that one field and + fails the build if it names no post, if a post would pair with more than one other, or if both + are in the same language. Without it, the language toggle on either post goes to the other + language's blog index instead of the translation. ## Traps diff --git a/apps/outreach/src/components/blog/PostInfoCard.astro b/apps/outreach/src/components/blog/PostInfoCard.astro index bf314f2195..373fea7711 100644 --- a/apps/outreach/src/components/blog/PostInfoCard.astro +++ b/apps/outreach/src/components/blog/PostInfoCard.astro @@ -13,7 +13,7 @@ type Props = { }; const { author, datePublished, readingTime, className } = Astro.props; -const { resolvedLanguage } = useTranslations(Astro.url); +const { resolvedLanguage, t } = useTranslations(Astro.url); ---
@@ -33,7 +33,7 @@ const { resolvedLanguage } = useTranslations(Astro.url); } - {Math.round(readingTime)} min read + {`${Math.round(readingTime)} ${t('blog.minRead')}`}
diff --git a/apps/outreach/src/components/layout/Footer.astro b/apps/outreach/src/components/layout/Footer.astro index cd8aa1beb8..14c96d584c 100644 --- a/apps/outreach/src/components/layout/Footer.astro +++ b/apps/outreach/src/components/layout/Footer.astro @@ -1,3 +1,9 @@ +--- +import { useTranslations } from '@/i18n'; + +const { t } = useTranslations(Astro.url); +--- +