Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(web): translate avatar labels and the sidebar resize tooltip

Kilync25af546d980
diff --git a/apps/web/src/components/ui/use-sidebar-width.ts b/apps/web/src/components/ui/use-sidebar-width.ts
index beb775ea..7db8793e 100644
--- a/apps/web/src/components/ui/use-sidebar-width.ts
+++ b/apps/web/src/components/ui/use-sidebar-width.ts
@@ -7,6 +7,8 @@ import {
} from "react";
import { isDesktopShell } from "@/app/desktop-shell";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
const SECONDARY_NAVIGATION_DEFAULT_WIDTH = 240;
@@ -45,6 +47,7 @@ export function useSidebarWidth(
edge = "right",
}: { min?: number; max?: number; edge?: "left" | "right" } = {},
) {
+ const t = useT();
const direction = edge === "right" ? 1 : -1;
const [preference, setPreference] = useState(() => ({
storageKey,
@@ -156,7 +159,7 @@ export function useSidebarWidth(
onPointerCancel: finishResize,
role: "separator",
tabIndex: 0,
- title: "Drag to resize; double-click to reset",
+ title: t(commonMessages.resizeHint),
};
return {
diff --git a/apps/web/src/features/rooms/members/actor-avatar.tsx b/apps/web/src/features/rooms/members/actor-avatar.tsx
index 5de90c0c..23c488bb 100644
--- a/apps/web/src/features/rooms/members/actor-avatar.tsx
+++ b/apps/web/src/features/rooms/members/actor-avatar.tsx
@@ -1,5 +1,8 @@
import { useState } from "react";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+
import {
useActorAvatarImage,
useAgentAvatarRecord,
@@ -85,6 +88,7 @@ export function ActorAvatar({
}[size];
const displayName = name.trim() || "Unknown Actor";
const title = showTitle ? displayName : undefined;
+ const label = useT()(commonMessages.avatar, { name: displayName });
const uploadedImage = useActorAvatarImage(actorId);
const agentRecord = useAgentAvatarRecord(
kind === "agent" ? actorId : undefined,
@@ -98,7 +102,7 @@ export function ActorAvatar({
if (uploadedImage && kind === "human") {
return (
<img
- alt={`${displayName} avatar`}
+ alt={label}
className={`shrink-0 object-cover ${shapeClass} ${sizeClass}`}
onLoad={() => setLoadedSrc(uploadedImage)}
src={uploadedImage}
@@ -120,7 +124,7 @@ export function ActorAvatar({
});
return (
<span
- aria-label={`${displayName} avatar`}
+ aria-label={label}
className={`block shrink-0 overflow-hidden ${shapeClass} ${sizeClass}`}
role="img"
title={title}
@@ -137,7 +141,7 @@ export function ActorAvatar({
return (
<span
- aria-label={`${displayName} avatar`}
+ aria-label={label}
className={`flex shrink-0 items-center justify-center font-semibold tracking-[0.02em] ${shapeClass} ${humanAvatarTint(actorId ?? displayName)} ${sizeClass} ${textSizeClass}`}
role="img"
title={title}
diff --git a/apps/web/src/i18n/common.messages.ts b/apps/web/src/i18n/common.messages.ts
index 6028805c..d6217b7c 100644
--- a/apps/web/src/i18n/common.messages.ts
+++ b/apps/web/src/i18n/common.messages.ts
@@ -8,4 +8,6 @@ export const commonMessages = defineMessages("common", {
unavailableTitle: "Web client unavailable",
unavailableBody: "The application could not finish loading.",
tryAgain: "Try again",
+ avatar: "{name} avatar",
+ resizeHint: "Drag to resize; double-click to reset",
});
diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.json
index 3b9c2d94..31f64254 100644
--- a/apps/web/src/i18n/locales/zh-CN.json
+++ b/apps/web/src/i18n/locales/zh-CN.json
@@ -5,7 +5,9 @@
"loadingRoom": "正在加载 Room…",
"unavailableTitle": "Web 客户端暂不可用",
"unavailableBody": "应用未能完成加载。",
- "tryAgain": "重试"
+ "tryAgain": "重试",
+ "avatar": "{name} 的头像",
+ "resizeHint": "拖动调整宽度,双击恢复默认"
},
"settings": {
"navigation": "设置导航",