fix(i18n): restore ASSISTANT_PLACEHOLDERS export and translate formatDate fallback

- Re-export ASSISTANT_PLACEHOLDERS as translated strings computed from keys
  so getAssistantPlaceholder() returns from the array (restores test contract)
- formatDate() now returns i18n.t("memory.never") instead of "" for the
  empty-date fallback
This commit is contained in:
RamGopalSrikar
2026-05-29 11:25:43 -04:00
parent 886d8bb287
commit 5e8df45982
2 changed files with 10 additions and 6 deletions

View File

@ -14,12 +14,14 @@ const ASSISTANT_PLACEHOLDER_KEYS = [
"assistant.placeholder.4",
];
export const ASSISTANT_PLACEHOLDERS: string[] = ASSISTANT_PLACEHOLDER_KEYS.map(
(key) => i18n.t(key),
);
export function getAssistantPlaceholder(): string {
const key =
ASSISTANT_PLACEHOLDER_KEYS[
Math.floor(Math.random() * ASSISTANT_PLACEHOLDER_KEYS.length)
];
return i18n.t(key);
return ASSISTANT_PLACEHOLDERS[
Math.floor(Math.random() * ASSISTANT_PLACEHOLDERS.length)
];
}
export const ASSISTANT_SESSIONS_STORAGE_KEY = "langflow-assistant-sessions";

View File

@ -1,5 +1,7 @@
import i18n from "@/i18n";
export const formatDate = (dateStr?: string) => {
if (!dateStr) return "";
if (!dateStr) return i18n.t("memory.never");
const d = new Date(dateStr);
if (Number.isNaN(d.getTime())) return dateStr;
return d.toLocaleString(undefined, {