Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(i18n): add bengali relative time strings

Steven Enamakel33e54384ffb1
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index eb739e4fae..db6dc4a006 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -1524,6 +1524,21 @@ const messages: TranslationMap = {
'chat.failedToLoadMessages': 'বার্তা লোড করতে ব্যর্থ',
'chat.thinkingIteration': 'ভাবছে... ({n})',
'chat.thinkingDots': 'ভাবছে...',
+ 'chat.status.thinkingElapsed': 'ভাবছে · {elapsed}',
+ 'chat.status.waitingApproval': 'আপনার অনুমোদনের অপেক্ষায়',
+ 'chat.status.waitingReview': 'আপনার পর্যালোচনার অপেক্ষায়',
+ 'chat.status.waitingAnswer': 'আপনার উত্তরের অপেক্ষায়',
+ 'chat.status.waitingOnSubagent': '{name}-এর অপেক্ষায়',
+ 'chat.status.waitingOnSubagents': '{count}টি সাব-এজেন্টের অপেক্ষায়',
+ 'chat.status.quietFor': '{duration} ধরে নিষ্ক্রিয়।',
+ 'chat.status.stop': 'থামান',
+ 'chat.tools.callOne': '{count}টি টুল কল',
+ 'chat.tools.callOther': '{count}টি টুল কল',
+ 'chat.tools.reasoningWithCalls': 'যুক্তি · {calls}',
+ 'chat.tools.reasoning': 'যুক্তি',
+ 'chat.tools.activity': 'কার্যকলাপ',
+ 'chat.tools.workedFor': '{duration} কাজ করেছে · {calls}',
+ 'chat.elicitation.declineReply': 'আমি এর উত্তর দিতে চাই না। এটি ছাড়াই চালিয়ে যান।',
'chat.upgrade': 'আপগ্রেড করুন',
'chat.weeklyLimitHit': 'আপনি আপনার সাপ্তাহিক সীমায় পৌঁছেছেন।',
'chat.resets': 'রিসেট হবে',
diff --git a/app/src/utils/relativeTime.test.ts b/app/src/utils/relativeTime.test.ts
new file mode 100644
index 0000000000..920ce8572a
--- /dev/null
+++ b/app/src/utils/relativeTime.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from 'vitest';
+
+import { fullTimestamp, relativeTime } from './relativeTime';
+
+const NOW = new Date(2026, 9, 7, 15, 0, 0);
+
+function ago(ms: number) {
+ return new Date(NOW.getTime() - ms);
+}
+
+describe('relativeTime', () => {
+ it('reads the last minute, and a slightly-ahead clock, as just now', () => {
+ expect(relativeTime(ago(30_000), NOW)).toEqual({ kind: 'justNow' });
+ expect(relativeTime(ago(-60_000), NOW)).toEqual({ kind: 'justNow' });
+ });
+
+ it('counts minutes then hours within a day', () => {
+ expect(relativeTime(ago(5 * 60_000), NOW)).toEqual({ kind: 'minutes', count: 5 });
+ expect(relativeTime(ago(3 * 3_600_000 + 10), NOW)).toEqual({ kind: 'hours', count: 3 });
+ });
+
+ it('falls back to a short date, adding the year only when it differs', () => {
+ const lastWeek = relativeTime(new Date(2026, 9, 1, 9), NOW, 'en-US');
+ expect(lastWeek).toEqual({ kind: 'date', label: 'Oct 1' });
+ const lastYear = relativeTime(new Date(2025, 9, 1, 9), NOW, 'en-US');
+ expect(lastYear).toEqual({ kind: 'date', label: 'Oct 1, 2025' });
+ });
+
+ it('rejects an invalid date', () => {
+ expect(relativeTime(new Date('nope'), NOW)).toBeNull();
+ expect(fullTimestamp(new Date('nope'))).toBe('');
+ });
+
+ it('formats a full timestamp with the date', () => {
+ expect(fullTimestamp(new Date(2026, 9, 1, 9, 5), 'en-US')).toContain('Oct 1, 2026');
+ });
+});
diff --git a/app/src/utils/relativeTime.ts b/app/src/utils/relativeTime.ts
new file mode 100644
index 0000000000..58a929602d
--- /dev/null
+++ b/app/src/utils/relativeTime.ts
@@ -0,0 +1,45 @@
+/**
+ * Compact message timestamps, after OpenClaw's `chat-message-timestamp`:
+ * "just now" under a minute (and for a clock a little ahead of ours),
+ * "{n}m ago" / "{n}h ago" within the day, then a short date ("Oct 6", with
+ * the year only when it differs from now). The full local date, time and zone
+ * belong in the element's `title`.
+ */
+
+export type RelativeTime =
+ | { kind: 'justNow' }
+ | { kind: 'minutes'; count: number }
+ | { kind: 'hours'; count: number }
+ | { kind: 'date'; label: string };
+
+const MINUTE_MS = 60_000;
+const HOUR_MS = 60 * MINUTE_MS;
+const DAY_MS = 24 * HOUR_MS;
+/** Clock skew tolerated before a future time stops reading as "just now". */
+const FUTURE_SKEW_MS = 2 * MINUTE_MS;
+
+export function relativeTime(at: Date, now: Date, locale?: string): RelativeTime | null {
+ const time = at.getTime();
+ if (Number.isNaN(time)) return null;
+ const delta = now.getTime() - time;
+ if (delta < MINUTE_MS && delta > -FUTURE_SKEW_MS) return { kind: 'justNow' };
+ if (delta >= MINUTE_MS && delta < HOUR_MS) {
+ return { kind: 'minutes', count: Math.floor(delta / MINUTE_MS) };
+ }
+ if (delta >= HOUR_MS && delta < DAY_MS) {
+ return { kind: 'hours', count: Math.floor(delta / HOUR_MS) };
+ }
+ const options: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric' };
+ if (at.getFullYear() !== now.getFullYear()) options.year = 'numeric';
+ return { kind: 'date', label: new Intl.DateTimeFormat(locale, options).format(at) };
+}
+
+/** Full local date and time with the zone, for a tooltip. */
+export function fullTimestamp(at: Date, locale?: string): string {
+ if (Number.isNaN(at.getTime())) return '';
+ return new Intl.DateTimeFormat(locale, {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+ timeZoneName: 'short',
+ } as Intl.DateTimeFormatOptions).format(at);
+}