diff options
22 files changed, 118 insertions, 36 deletions
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 = { </h1> <div class="flex flex-wrap items-center gap-x-3 gap-y-2"> <p class="font-semibold"> - <FormattedDate date={data.publishDate} dateTimeOptions={dateTimeOptions} /> /{" "} + <FormattedDate date={data.publishDate} dateTimeOptions={dateTimeOptions} locale={language} /> /{ + " " + } {readingTime} </p> { data.updatedDate && ( <span class="bg-quote/5 text-quote rounded-lg px-2 py-1"> - Updated: - <FormattedDate class="ms-1" date={data.updatedDate} dateTimeOptions={dateTimeOptions} /> + {t(language, "updated")} + <FormattedDate + class="ms-1" + date={data.updatedDate} + dateTimeOptions={dateTimeOptions} + locale={language} + /> </span> ) } @@ -74,7 +84,7 @@ const dateTimeOptions: Intl.DateTimeFormatOptions = { <> {/* prettier-ignore */} <span class="contents"> - <a class="cactus-link inline-block before:content-['#']" data-pagefind-filter={`tag:${tag}`} href={`/tags/${tag}/`}><span class="sr-only">View more blogs with the tag </span>{tag} + <a class="cactus-link inline-block before:content-['#']" data-pagefind-filter={`tag:${tag}`} href={`/tags/${tag}/`}><span class="sr-only">{t(language, "viewMoreWithTag")} </span>{tag} </a>{i < data.tags.length - 1 && ", "} </span> </> 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 && ( <div> <p class="text-accent-2 mb-0"> - <strong>{comments.length}</strong> Mention{comments.length > 1 ? "s" : ""} + <strong>{comments.length}</strong>{" "} + {comments.length > 1 ? t(language, "mentions") : t(language, "mention")} </p> <ul class="divide-global-text/20 mt-0 divide-y ps-0" role="list"> {comments.map((mention) => ( @@ -65,7 +68,7 @@ const comments = mentions.filter( target="_blank" > <span class="hidden" id="cmt-source"> - Visit the source of this webmention + {t(language, "visitWebmentionSource")} </span> <Icon aria-hidden="true" diff --git a/src/components/blog/webmentions/Likes.astro b/src/components/blog/webmentions/Likes.astro index 7862c43..fce1a96 100644 --- a/src/components/blog/webmentions/Likes.astro +++ b/src/components/blog/webmentions/Likes.astro @@ -1,12 +1,14 @@ --- import { Image } from "astro:assets"; +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 MAX_LIKES = 10; const likes = mentions.filter((mention) => mention["wm-property"] === "like-of"); @@ -19,8 +21,8 @@ const likesToShow = likes !!likes.length && ( <div> <p class="text-accent-2 mb-0"> - <strong>{likes.length}</strong> - {likes.length > 1 ? " People" : " Person"} liked this + <strong>{likes.length}</strong>{" "} + {likes.length > 1 ? t(language, "peopleLiked") : t(language, "personLiked")} </p> {!!likesToShow.length && ( <ul class="flex list-none flex-wrap overflow-hidden ps-2" role="list"> diff --git a/src/components/blog/webmentions/index.astro b/src/components/blog/webmentions/index.astro index 232b4f3..80376f0 100644 --- a/src/components/blog/webmentions/index.astro +++ b/src/components/blog/webmentions/index.astro @@ -1,8 +1,14 @@ --- +import { t } from "@/i18n/translations"; import { getWebmentionsForUrl } from "@/utils/webmentions"; import Comments from "./Comments.astro"; import Likes from "./Likes.astro"; +interface Props { + language?: string | undefined; +} + +const { language } = Astro.props; const url = new URL(Astro.url.pathname, Astro.site); const webMentions = await getWebmentionsForUrl(`${url}`); @@ -12,12 +18,12 @@ if (!webMentions.length) return; --- <hr class="border-solid" /> -<h2 class="mb-8 before:hidden">Webmentions for this post</h2> +<h2 class="mb-8 before:hidden">{t(language, "webmentionsTitle")}</h2> <div class="space-y-10"> - <Likes mentions={webMentions} /> - <Comments mentions={webMentions} /> + <Likes mentions={webMentions} language={language} /> + <Comments mentions={webMentions} language={language} /> </div> <p class="mt-8"> - Responses powered by{" "} + {t(language, "responsesPoweredBy")}{" "} <a href="https://webmention.io" rel="noreferrer" target="_blank">Webmentions</a> </p> diff --git a/src/content/post/devops-mindset.md b/src/content/post/devops-mindset.md index 7761cc3..aba2cfb 100644 --- a/src/content/post/devops-mindset.md +++ b/src/content/post/devops-mindset.md @@ -2,9 +2,10 @@ title: "DevOps Mindset" description: "DevOps - culture, mindset and processes" publishDate: "3 July 2025" -tags: ["devops101", devops] +tags: ["devops101", devops, "en"] draft: false author: "Dawid" +language: "en" --- ## DevOps Mindset diff --git a/src/content/post/fediverse-101.md b/src/content/post/fediverse-101.md index 595606b..f27db52 100644 --- a/src/content/post/fediverse-101.md +++ b/src/content/post/fediverse-101.md @@ -2,9 +2,10 @@ title: "Fediverse 101" description: "A short collection of resources and links for getting started with the Fediverse" publishDate: 19 Dec 2025 -tags: [fediverse, social] +tags: [fediverse, social, "en"] draft: false author: "Dawid" +language: "en" --- ## Fediverse 101 diff --git a/src/content/post/niedziela-11-wrzesnia-2022.md b/src/content/post/niedziela-11-wrzesnia-2022.md index 3f47dec..662a23b 100644 --- a/src/content/post/niedziela-11-wrzesnia-2022.md +++ b/src/content/post/niedziela-11-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Niedziela 11 września 2022" description: "Weekend minął jak z bicza strzelił. Zdecydowanie nie był to jeden z tych leniwych weekendów. W sobotę rano poznaliśmy przemiłą starszą parę z Polski." publishDate: "2022-09-11" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Weekend minął „jak z bicza strzelił". Zdecydowanie nie był to jeden z tych leniwych weekendów. diff --git a/src/content/post/piatek-16-wrzesnia-2022.md b/src/content/post/piatek-16-wrzesnia-2022.md index 104f737..6a7bdf8 100644 --- a/src/content/post/piatek-16-wrzesnia-2022.md +++ b/src/content/post/piatek-16-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Piątek 16 września 2022" description: "Ostatnie dni były wyjątkowo ciepłe. Pogoda sprzyjała plażowaniu, więc po pracy dołączałem do Aleksandry. Mieliśmy swoją miejscówkę koło nadmorskiego baru, który był niestety zamknięty po sezonie." publishDate: "2022-09-16" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Ostatnie dni były wyjątkowo ciepłe. Pogoda sprzyjała plażowaniu, więc po pracy dołączałem do Aleksandry. Mieliśmy swoją miejscówkę koło nadmorskiego baru, który był niestety zamknięty po sezonie. Rumuńskie plaże całe są w muszelkach. Większe i jeszcze ostre muszle są bliżej wody, natomiast mniejsze kawałki – już pokruszone – tworzą specyficzny "piasek". diff --git a/src/content/post/piatek-7-pazdziernika-2022.md b/src/content/post/piatek-7-pazdziernika-2022.md index d278fd3..3b69d64 100644 --- a/src/content/post/piatek-7-pazdziernika-2022.md +++ b/src/content/post/piatek-7-pazdziernika-2022.md @@ -2,8 +2,9 @@ title: "Piątek 7 października 2022" description: "Dotarłem na jedno z najbardziej epickich miejsc, w których zdarzyło nam się spać. Wysokie klify, rozległa polana, ogromne przestrzenie i tylko wypasające się konie, owce i kozy." publishDate: "2022-10-07" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Dotarłem na jedno z najbardziej epickich miejsc, w których zdarzyło nam się spać. Wysokie klify, rozległa polana, ogromne przestrzenie i tylko wypasające się konie, owce i kozy. Nocą na horyzoncie widać światła Ahtopola, ale poza nimi tylko Księżyc i Jowisz rozświetla okolicę. Nad samą przepaścią ktoś wystawił stolik, krzesło i dalej ławkę, na których co kilka godzin ktoś przyjeżdża zrobić sobie zdjęcia. diff --git a/src/content/post/piatek-9-wrzesnia-2022.md b/src/content/post/piatek-9-wrzesnia-2022.md index 2ccd517..61b8fc2 100644 --- a/src/content/post/piatek-9-wrzesnia-2022.md +++ b/src/content/post/piatek-9-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Piątek 9 września 2022" description: "Ostatnie dni miałem bardzo zawalone w pracy. Dużo spotkań, przygotowywania prezentacji, prowadzenie treningów – w sumie poza siedzeniem w laptopie niewiele się wydarzyło." publishDate: "2022-09-09" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Ostatnie dni miałem bardzo zawalone w pracy. Dużo spotkań, przygotowywania prezentacji, prowadzenie treningów – w sumie poza siedzeniem w laptopie niewiele się wydarzyło. Wiatr za to tak zaczął doskwierać, że musieliśmy zwinąć markizę i prawie całe dwa dni spędziłem w kamperze. Przynajmniej Freja przestała nam plątać się we wsporniki i linki 🙂 diff --git a/src/content/post/poniedzialek-3-pazdziernika-2022.md b/src/content/post/poniedzialek-3-pazdziernika-2022.md index f4088ed..1b38f3a 100644 --- a/src/content/post/poniedzialek-3-pazdziernika-2022.md +++ b/src/content/post/poniedzialek-3-pazdziernika-2022.md @@ -2,8 +2,9 @@ title: "Poniedziałek 3 października 2022" description: "W czwartek rano już się upewniłem, że na skarpie zaparkował Groszek – zielony VW T4 który należy do kampermaniaków. Skończyło mi się wolne, więc szybko tylko poszedłem z Freją po banice do ajranu..." publishDate: "2022-10-03" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- W czwartek rano już się upewniłem, że na skarpie zaparkował Groszek – zielony VW T4 który należy do [kampermaniaków](https://kampermaniak.pl). Skończyło mi się wolne, więc szybko tylko poszedłem z Freją po banice do ajranu, rozłożyłem "biuro" i zacząłem normalny dzień pracy. Jak to ja – nawet na popołudniowym spacerze nie zebrałem się, żeby zagadać, a wieczorem już widziałem, że wszyscy siedzieli i nie chciałem przeszkadzać. diff --git a/src/content/post/poniedzialek-5-wrzesnia-2022.md b/src/content/post/poniedzialek-5-wrzesnia-2022.md index 369f091..de3d3a4 100644 --- a/src/content/post/poniedzialek-5-wrzesnia-2022.md +++ b/src/content/post/poniedzialek-5-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Poniedziałek 5 września 2022" description: "Postanowiliśmy zostać tutaj na dłużej. Miejsce do którego dojechaliśmy okazało się być plażą pełną przyczep kempingowych i kamperów. Mamy widok z okna na morze, szybki internet, dużo słońca (prądu) oraz proste podłoże." publishDate: "2022-09-05" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Postanowiliśmy zostać tutaj na dłużej. Miejsce do którego dojechaliśmy okazało się być plażą pełną przyczep kempingowych i kamperów. Mamy widok z okna na morze, szybki internet, dużo słońca (prądu) oraz proste podłoże. Chyba gdzieś w okolicy jest źródło wody (przynajmniej na to wygląda sądząc po ludziach noszących butelki). diff --git a/src/content/post/sobota-3-wrzesnia-2022.md b/src/content/post/sobota-3-wrzesnia-2022.md index 0aeb464..018263f 100644 --- a/src/content/post/sobota-3-wrzesnia-2022.md +++ b/src/content/post/sobota-3-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Sobota 3 września 2022" description: "Dzień wyjazdu z Bukaresztu i ogarniania auta po tygodniu w wynajętym mieszkaniu. Wodę pozwolili nam nalać na stacji po tankowaniu auta, kasete zlaliśmy na parkingu dla kamperów, a po drodze kupiliśmy jeszcze karmę dla Freji." publishDate: "2022-09-03" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Dzień wyjazdu z Bukaresztu i ogarniania auta po tygodniu w wynajętym mieszkaniu. Wodę pozwolili nam nalać na stacji po tankowaniu auta, kasete zlaliśmy na parkingu dla kamperów, a po drodze kupiliśmy jeszcze karmę dla Freji. diff --git a/src/content/post/sroda-21-wrzesnia-2022.md b/src/content/post/sroda-21-wrzesnia-2022.md index 1ff94b5..53ed48d 100644 --- a/src/content/post/sroda-21-wrzesnia-2022.md +++ b/src/content/post/sroda-21-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Środa 21 września 2022" description: "W pierwszych dniach pobytu w Bułgarii mieliśmy nieco szczęścia. Warna przywitała nas burzą i oberwaniem chmury. W trakcie spaceru po mieście zerwał się deszcz i przemokliśmy do suchej nitki w przeciągu kilku minut." publishDate: "2022-09-21" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- W pierwszych dniach pobytu w Bułgarii mieliśmy nieco szczęścia. Warna przywitała nas burzą i oberwaniem chmury. W trakcie spaceru po mieście zerwał się deszcz i przemokliśmy do suchej nitki w przeciągu kilku minut. W tym samym czasie, kilkadziesiąt kilometrów na południe, przez Brugas przeszedł huragan który zrywał dachy i łamał drzewa. Dobrze, że zamarudziliśmy trochę i zwiedziliśmy jeszcze po drodze kamienny las. diff --git a/src/content/post/sroda-28-wrzesnia-2022.md b/src/content/post/sroda-28-wrzesnia-2022.md index e0a456b..a2cbf6c 100644 --- a/src/content/post/sroda-28-wrzesnia-2022.md +++ b/src/content/post/sroda-28-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Środa 28 września 2022" description: "Wziąłem parę dni wolnego, abyśmy mogli spokojnie pozwiedzać okolicę. Zaczęliśmy od oddania rzeczy do pralni. Niestety w Bułgarii pralki na monety nie są popularne." publishDate: "2022-09-28" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- ## Nesebar diff --git a/src/content/post/sroda-7-wrzesnia-2022.md b/src/content/post/sroda-7-wrzesnia-2022.md index 50b2e13..353279e 100644 --- a/src/content/post/sroda-7-wrzesnia-2022.md +++ b/src/content/post/sroda-7-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Środa 7 września 2022" description: "Musieliśmy się dzisiaj ruszyć po wodę. Źródełko płynące z rury koło domku rybaka okazało się na tyle brudne, że nie ryzykowaliśmy zalewać nim zbiornika w kamperze." publishDate: "2022-09-07" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Musieliśmy się dzisiaj ruszyć po wodę. Źródełko płynące z rury koło domku rybaka okazało się na tyle brudne, że nie ryzykowaliśmy zalewać nim zbiornika w kamperze. Może i dało by się w nim wykąpać, ale bez wstępnej filtracji tylko by zasyfiło pompę, przewody i krany. Przy okazji zrobiliśmy zakupy w lokalnym Lidlu i umyliśmy auto (było całe od błota po sobotnich "przygodach"). diff --git a/src/content/post/wtorek-13-wrzesnia-2022.md b/src/content/post/wtorek-13-wrzesnia-2022.md index 09dacc1..96656a4 100644 --- a/src/content/post/wtorek-13-wrzesnia-2022.md +++ b/src/content/post/wtorek-13-wrzesnia-2022.md @@ -2,8 +2,9 @@ title: "Wtorek 13 września 2022" description: "Przez jeden dzień mieliśmy nowe zwierzątko – konkretnie nietoperza. W poniedziałek nad ranem coś wpadło pomiędzy moskitierę, a okno dachowe i strasznie hałasowało." publishDate: "2022-09-13" -tags: ["archived"] +tags: ["archived", "pl"] author: "Dawid" +language: "pl" --- Przez jeden dzień mieliśmy nowe zwierzątko – konkretnie nietoperza. W poniedziałek nad ranem coś wpadło pomiędzy moskitierę, a okno dachowe i strasznie hałasowało. Na początku myśleliśmy, że to mały ptak lub ćma, ale kiedy próbowałem uchylić trochę bardziej okno, to "coś" zatrzymało się na moskitierze. Nietoperz wcisnął się w szczelinę pomiędzy dachem Sprintera, a drewnianym sufitem i poszedł spać na cały dzień. Swoją drogą tak dowiedzieliśmy się, że jest tam przejście znad moskitiery pod dach i trzeba się tym zająć. diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts new file mode 100644 index 0000000..7631ad7 --- /dev/null +++ b/src/i18n/translations.ts @@ -0,0 +1,36 @@ +export const translations = { + en: { + viewOriginalPost: "View original post on Pleroma →", + backToTop: "Back to top", + updated: "Updated:", + viewMoreWithTag: "View more blogs with the tag", + webmentionsTitle: "Webmentions for this post", + responsesPoweredBy: "Responses powered by", + mention: "Mention", + mentions: "Mentions", + visitWebmentionSource: "Visit the source of this webmention", + personLiked: "Person liked this", + peopleLiked: "People liked this", + }, + pl: { + viewOriginalPost: "Zobacz oryginalny wpis na Pleroma →", + backToTop: "Powrót na górę", + updated: "Zaktualizowano:", + viewMoreWithTag: "Zobacz więcej wpisów z tagiem", + webmentionsTitle: "Webmentions dla tego wpisu", + responsesPoweredBy: "Odpowiedzi dzięki", + mention: "Wzmianka", + mentions: "Wzmianki", + visitWebmentionSource: "Odwiedź źródło tej wzmianki", + personLiked: "osoba polubiła", + peopleLiked: "osób polubiło", + }, +} as const; + +export type Language = keyof typeof translations; +export type TranslationKey = keyof typeof translations.en; + +export function t(lang: string | undefined, key: TranslationKey): string { + const language = (lang === "pl" ? "pl" : "en") as Language; + return translations[language][key]; +} diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 59f7282..02253f5 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -3,6 +3,7 @@ import { type CollectionEntry, render } from "astro:content"; import Masthead from "@/components/blog/Masthead.astro"; import WebMentions from "@/components/blog/webmentions/index.astro"; +import { t } from "@/i18n/translations"; import BaseLayout from "./Base.astro"; @@ -11,7 +12,7 @@ interface Props { } const { post } = Astro.props; -const { ogImage, title, description, updatedDate, publishDate } = post.data; +const { ogImage, title, description, updatedDate, publishDate, language } = post.data; const socialImage = ogImage ?? `/og-image/${post.id}.png`; const articleDate = updatedDate?.toISOString() ?? publishDate.toISOString(); const { remarkPluginFrontmatter } = await render(post); @@ -27,12 +28,14 @@ const readingTime: string = remarkPluginFrontmatter.readingTime; }} > <article class="grow break-words" data-pagefind-body> - <div id="blog-hero" class="mb-12"><Masthead content={post} readingTime={readingTime} /></div> + <div id="blog-hero" class="mb-12"> + <Masthead content={post} readingTime={readingTime} language={language} /> + </div> <div class="prose prose-sm prose-cactus prose-headings:font-semibold prose-headings:text-accent-2 prose-headings:before:absolute prose-headings:before:-ms-4 prose-headings:before:text-gray-600 prose-headings:hover:before:text-accent sm:prose-headings:before:content-['#'] sm:prose-th:before:content-none max-w-none" > <slot /> - <WebMentions /> + <WebMentions language={language} /> { post.data.sourceUrl && ( <p class="mt-8 border-t border-gray-200 pt-6 text-sm dark:border-gray-700"> @@ -42,7 +45,7 @@ const readingTime: string = remarkPluginFrontmatter.readingTime; target="_blank" rel="noopener noreferrer" > - View original post on Pleroma → + {t(language, "viewOriginalPost")} </a> </p> ) @@ -54,7 +57,7 @@ const readingTime: string = remarkPluginFrontmatter.readingTime; data-show="false" id="to-top-btn" > - <span class="sr-only">Back to top</span> + <span class="sr-only">{t(language, "backToTop")}</span> <svg aria-hidden="true" class="h-6 w-6" diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts index b3fa8ff..36ea4d6 100644 --- a/src/loaders/pleroma.ts +++ b/src/loaders/pleroma.ts @@ -730,6 +730,12 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { const title = extractTitle(cleanedContent); + // Add language code as a tag + // Default to Polish since most Pleroma posts are in Polish when language is not specified + const langTag = status.language || "pl"; + const postLanguage = status.language || "pl"; + tags = tags.includes(langTag) ? tags : [...tags, langTag]; + // Create note entry store.set({ id: `pleroma-${postId}`, @@ -739,7 +745,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { cleanedContent.substring(0, 160) + (cleanedContent.length > 160 ? "..." : ""), publishDate: new Date(status.created_at), sourceUrl, - language: status.language || undefined, + language: postLanguage, tags, draft: false, author: "Dawid", diff --git a/src/utils/date.ts b/src/utils/date.ts index 314a837..035d157 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -4,12 +4,14 @@ import { siteConfig } from "@/site.config"; export function getFormattedDate( date: Date | undefined, options?: Intl.DateTimeFormatOptions, + locale?: string, ): string { if (date === undefined) { return "Invalid Date"; } - return new Intl.DateTimeFormat(siteConfig.date.locale, { + const effectiveLocale = locale === "pl" ? "pl-PL" : siteConfig.date.locale; + return new Intl.DateTimeFormat(effectiveLocale, { ...(siteConfig.date.options as Intl.DateTimeFormatOptions), ...options, }).format(date); |
