11---
22import type { Post } from ' ../lib/posts'
33import { formatDate , getPostSlug , getReadingTime } from ' ../lib/posts'
4+ import { useTranslations } from ' ../i18n/utils'
45
56interface Props {
67 posts: Post []
8+ locale? : string
79}
810
9- const { posts } = Astro .props
11+ const { posts, locale = ' en' } = Astro .props
12+ const t = useTranslations (locale )
1013const [first, second, third] = posts
1114---
1215
@@ -35,9 +38,9 @@ const [first, second, third] = posts
3538 <h2 class = " text-2xl font-bold group-hover:text-primary transition-colors" >{ first .data .title } </h2 >
3639 <p class = " text-muted-foreground mt-2" >{ first .data .description } </p >
3740 <div class = " flex items-center gap-1.5 text-xs text-muted-foreground mt-3" >
38- <time datetime = { first .data .date .toISOString ()} >{ formatDate (first .data .date )} </time >
41+ <time datetime = { first .data .date .toISOString ()} >{ formatDate (first .data .date , locale )} </time >
3942 <span >·</span >
40- <span >{ getReadingTime (first .body ?? ' ' )} min read </span >
43+ <span >{ getReadingTime (first .body ?? ' ' )} { t ( ' hero.minRead ' ) } </span >
4144 </div >
4245 </div >
4346 </a >
@@ -67,9 +70,9 @@ const [first, second, third] = posts
6770 <h2 class = " text-2xl font-bold group-hover:text-primary transition-colors" >{ post .data .title } </h2 >
6871 <p class = " text-muted-foreground mt-2" >{ post .data .description } </p >
6972 <div class = " flex items-center gap-1.5 text-xs text-muted-foreground mt-3" >
70- <time datetime = { post .data .date .toISOString ()} >{ formatDate (post .data .date )} </time >
73+ <time datetime = { post .data .date .toISOString ()} >{ formatDate (post .data .date , locale )} </time >
7174 <span >·</span >
72- <span >{ getReadingTime (post .body ?? ' ' )} min read </span >
75+ <span >{ getReadingTime (post .body ?? ' ' )} { t ( ' hero.minRead ' ) } </span >
7376 </div >
7477 </div >
7578 </a >
@@ -100,9 +103,9 @@ const [first, second, third] = posts
100103 <h2 class = " text-2xl font-bold group-hover:text-primary transition-colors" >{ first .data .title } </h2 >
101104 <p class = " text-muted-foreground mt-2" >{ first .data .description } </p >
102105 <div class = " flex items-center gap-1.5 text-xs text-muted-foreground mt-3" >
103- <time datetime = { first .data .date .toISOString ()} >{ formatDate (first .data .date )} </time >
106+ <time datetime = { first .data .date .toISOString ()} >{ formatDate (first .data .date , locale )} </time >
104107 <span >·</span >
105- <span >{ getReadingTime (first .body ?? ' ' )} min read </span >
108+ <span >{ getReadingTime (first .body ?? ' ' )} { t ( ' hero.minRead ' ) } </span >
106109 </div >
107110 </div >
108111 </a >
@@ -120,9 +123,9 @@ const [first, second, third] = posts
120123 <h2 class = " text-xl font-bold group-hover:text-primary transition-colors" >{ post .data .title } </h2 >
121124 <p class = " text-muted-foreground text-sm mt-2" >{ post .data .description } </p >
122125 <div class = " flex items-center gap-1.5 text-xs text-muted-foreground mt-3" >
123- <time datetime = { post .data .date .toISOString ()} >{ formatDate (post .data .date )} </time >
126+ <time datetime = { post .data .date .toISOString ()} >{ formatDate (post .data .date , locale )} </time >
124127 <span >·</span >
125- <span >{ getReadingTime (post .body ?? ' ' )} min read </span >
128+ <span >{ getReadingTime (post .body ?? ' ' )} { t ( ' hero.minRead ' ) } </span >
126129 </div >
127130 </a >
128131 </article >
0 commit comments