feat(frontend): service messages speak russian and english

This commit is contained in:
hh committed 2026-10-19 05:32:34 +00:00
1 parent 7baa32f400
commit 543e6eaa50
3 files changed
+75 -16

No files matched your search

@@ -2,6 +2,7 @@
import type { MessageView } from "#lib/api/types.js";
import Icon from "#lib/components/ui/Icon.svelte";
import { accountName, peerName } from "#lib/format/peer.js";
import { t } from "#lib/i18n/locale.svelte.js";
import { accounts } from "#lib/stores/accounts.svelte.js";
import { peers } from "#lib/stores/peers.svelte.js";
@@ -16,10 +17,12 @@
function nameOf(id: number | null): string {
if (id === null) {
return "Someone";
return t("service.someone");
}
if (id === ownId) {
return accounts.selected ? accountName(accounts.selected) : "You";
return accounts.selected
? accountName(accounts.selected)
: t("service.you");
}
const peer = peers.get(id);
return peer ? peerName(peer) : String(id);
@@ -44,35 +47,39 @@
const selfJoin =
members.length === 1 && members[0] === message.sender_id;
if (selfJoin) {
return `${actor} joined the group`;
return t("service.joined", { actor });
}
const names = members.map(nameOf).join(", ");
return names ? `${actor} added ${names}` : `${actor} joined the group`;
return names
? t("service.added", { actor, names })
: t("service.joined", { actor });
}
case "left_chat_members":
return `${actor} left the group`;
return t("service.left", { actor });
case "pinned_message":
return `${actor} pinned a message`;
return t("service.pinned", { actor });
case "group_chat_created":
return `${actor} created the group`;
return t("service.groupCreated", { actor });
case "channel_chat_created":
return "Channel created";
return t("service.channelCreated");
case "phone_call_ended":
return service.duration === null
? "Call ended"
: `Call ended · ${durationOf(service.duration)}`;
? t("service.callEnded")
: t("service.callEndedAfter", {
duration: durationOf(service.duration),
});
case "phone_call_started":
return "Call started";
return t("service.callStarted");
case "poll_option_added":
return `${actor} added a poll option`;
return t("service.pollOption", { actor });
case "new_chat_title":
return `${actor} changed the group name`;
return t("service.titleChanged", { actor });
case "new_chat_photo":
return `${actor} changed the group photo`;
return t("service.photoChanged", { actor });
case "delete_chat_photo":
return `${actor} removed the group photo`;
return t("service.photoRemoved", { actor });
default:
return service.kind.replace(/_/g, " ") || "Service message";
return t("service.unknown");
}
});