diff --git a/www/js/diary/diaryHelper.ts b/www/js/diary/diaryHelper.ts index 616974b7b..66ea67f0f 100644 --- a/www/js/diary/diaryHelper.ts +++ b/www/js/diary/diaryHelper.ts @@ -2,6 +2,7 @@ // these functions are being gradually migrated out of services.js import moment from 'moment'; +import i18next from 'i18next'; import { DateTime } from 'luxon'; import { LabelOptions, readableLabelToKey } from '../survey/multilabel/confirmHelper'; import { CompositeTrip } from '../types/diaryTypes'; @@ -118,6 +119,7 @@ export function getFormattedDate(beginFmtTime: string, endFmtTime?: string) { // We use ddd LL to get Wed, May 3, 2023 or equivalent // LL only has the date, month and year // LLLL has the day of the week, but also the time + t.locale(i18next.language); return t.format('ddd LL'); } diff --git a/www/js/metrics/WeeklyActiveMinutesCard.tsx b/www/js/metrics/WeeklyActiveMinutesCard.tsx index 387ebc79d..9a25d48c5 100644 --- a/www/js/metrics/WeeklyActiveMinutesCard.tsx +++ b/www/js/metrics/WeeklyActiveMinutesCard.tsx @@ -23,12 +23,13 @@ const WeeklyActiveMinutesCard = ({ userMetrics }: Props) => { ACTIVE_MODES.forEach((mode) => { const prevSum = prevWeek?.reduce((acc, day) => acc + (day[`label_${mode}`] || 0), 0); if (prevSum) { - const xLabel = `Previous Week\n(${formatDateRangeOfDays(prevWeek)})`; // TODO: i18n + // `${t('main-metrics.prev-week')}\n(${formatDateRangeOfDays(lastWeekDistance)})` + const xLabel = `${t('main-metrics.prev-week')}\n(${formatDateRangeOfDays(prevWeek)})`; records.push({ label: labelKeyToRichMode(mode), x: xLabel, y: prevSum / 60 }); } const recentSum = recentWeek?.reduce((acc, day) => acc + (day[`label_${mode}`] || 0), 0); if (recentSum) { - const xLabel = `Past Week\n(${formatDateRangeOfDays(recentWeek)})`; // TODO: i18n + const xLabel = `${t('main-metrics.past-week')}\n(${formatDateRangeOfDays(recentWeek)})`; records.push({ label: labelKeyToRichMode(mode), x: xLabel, y: recentSum / 60 }); } });