From a1d3fb8df0e00faa3920d7f5085a52002e58574e Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 13 Jan 2026 18:42:05 +0100 Subject: Add polish language support --- src/components/FormattedDate.astro | 5 +++-- src/components/blog/Masthead.astro | 18 ++++++++++++++---- src/components/blog/webmentions/Comments.astro | 9 ++++++--- src/components/blog/webmentions/Likes.astro | 8 +++++--- src/components/blog/webmentions/index.astro | 14 ++++++++++---- 5 files changed, 38 insertions(+), 16 deletions(-) (limited to 'src/components') diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro index 45de273..0c7b2d7 100644 --- a/src/components/FormattedDate.astro +++ b/src/components/FormattedDate.astro @@ -5,11 +5,12 @@ import { getFormattedDate } from "@/utils/date"; type Props = HTMLAttributes<"time"> & { date: Date; dateTimeOptions?: Intl.DateTimeFormatOptions; + locale?: string | undefined; }; -const { date, dateTimeOptions, ...attrs } = Astro.props; +const { date, dateTimeOptions, locale, ...attrs } = Astro.props; -const postDate = getFormattedDate(date, dateTimeOptions); +const postDate = getFormattedDate(date, dateTimeOptions, locale); const ISO = date.toISOString(); --- diff --git a/src/components/blog/Masthead.astro b/src/components/blog/Masthead.astro index 1f52383..e7b3ea9 100644 --- a/src/components/blog/Masthead.astro +++ b/src/components/blog/Masthead.astro @@ -2,15 +2,18 @@ import { Image } from "astro:assets"; import type { CollectionEntry } from "astro:content"; import FormattedDate from "@/components/FormattedDate.astro"; +import { t } from "@/i18n/translations"; interface Props { content: CollectionEntry<"post">; readingTime: string; + language?: string | undefined; } const { content: { data }, readingTime, + language, } = Astro.props; const dateTimeOptions: Intl.DateTimeFormatOptions = { @@ -38,14 +41,21 @@ const dateTimeOptions: Intl.DateTimeFormatOptions = {

- /{" "} + /{ + " " + } {readingTime}

{ data.updatedDate && ( - Updated: - + {t(language, "updated")} + ) } @@ -74,7 +84,7 @@ const dateTimeOptions: Intl.DateTimeFormatOptions = { <> {/* prettier-ignore */} - View more blogs with the tag {tag} + {t(language, "viewMoreWithTag")} {tag} {i < data.tags.length - 1 && ", "} diff --git a/src/components/blog/webmentions/Comments.astro b/src/components/blog/webmentions/Comments.astro index af14bd0..9d274f9 100644 --- a/src/components/blog/webmentions/Comments.astro +++ b/src/components/blog/webmentions/Comments.astro @@ -1,13 +1,15 @@ --- import { Image } from "astro:assets"; import { Icon } from "astro-icon/components"; +import { t } from "@/i18n/translations"; import type { WebmentionsChildren } from "@/types"; interface Props { mentions: WebmentionsChildren[]; + language?: string | undefined; } -const { mentions } = Astro.props; +const { mentions, language } = Astro.props; const validComments = ["mention-of", "in-reply-to"]; @@ -20,7 +22,8 @@ const comments = mentions.filter( !!comments.length && (

- {comments.length} Mention{comments.length > 1 ? "s" : ""} + {comments.length}{" "} + {comments.length > 1 ? t(language, "mentions") : t(language, "mention")}

    {comments.map((mention) => ( @@ -65,7 +68,7 @@ const comments = mentions.filter( target="_blank" >