Skip to content

Commit 23bdd8c

Browse files
committed
add: translate github calendar
1 parent 38c4d42 commit 23bdd8c

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

components/github-calendar.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from "@/components/ui/tooltip"
1010
import { useSettingsContext } from '@/contexts/SettingsContext'
1111
import { getColorByAmountAndBaseColor } from '@/utils/styling'
12+
import { useTranslations, useLocale } from 'next-intl'
1213

1314

1415
interface TaskActivity {
@@ -24,6 +25,8 @@ interface GitHubCalendarProps {
2425
}
2526

2627
export function GitHubCalendar({ data, theme, color }: GitHubCalendarProps) {
28+
const t = useTranslations("githubCalendar");
29+
const locale = useLocale();
2730
const {date} = useSettingsContext()
2831
const weeks = useMemo(() => {
2932
const startOfYear = new Date(date.getFullYear(), 0, 1)
@@ -75,14 +78,14 @@ export function GitHubCalendar({ data, theme, color }: GitHubCalendarProps) {
7578
</TooltipTrigger>
7679
<TooltipContent>
7780
<p>
78-
{day.date.toLocaleDateString('es-ES', {
79-
weekday: 'long',
80-
year: 'numeric',
81-
month: 'long',
82-
day: 'numeric'
81+
{day.date.toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
82+
weekday: 'long',
83+
year: 'numeric',
84+
month: 'long',
85+
day: 'numeric'
8386
})}
8487
</p>
85-
<p>{day.count} tasks completed</p>
88+
<p>{t("tasksCompleted", { count: day.count })}</p>
8689
</TooltipContent>
8790
</Tooltip>
8891
))}

messages/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,9 @@
882882
"thisWeek": "+{change}% this week"
883883
}
884884
},
885+
"githubCalendar": {
886+
"tasksCompleted": "{count} tasks completed"
887+
},
885888
"dailySummary": {
886889
"pendingTasks": {
887890
"title": "Pending Tasks",

messages/es.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,9 @@
882882
"thisWeek": "+{change}% esta semana"
883883
}
884884
},
885+
"githubCalendar": {
886+
"tasksCompleted": "{count} tareas completadas"
887+
},
885888
"dailySummary": {
886889
"pendingTasks": {
887890
"title": "Tareas Pendientes",

0 commit comments

Comments
 (0)