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 the login page
Kilyn18d33d3b6b9b
diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.cssindex c73aafd0..2a015208 100644--- a/apps/web/src/app/globals.css+++ b/apps/web/src/app/globals.css@@ -128,6 +128,11 @@:root[data-han-font="sc"] {--app-font-han: "PingFang SC", "Noto Sans SC Variable";+ /* No Chinese slab face pairs with Roboto Slab, and Songti reads as a+ different voice next to the sans interface, so Han text in slab headings+ uses the same sans Han font as the rest of the interface. */+ --app-font-slab:+ "Roboto Slab Variable", Georgia, var(--app-font-han), sans-serif;}:root {diff --git a/apps/web/src/features/auth/auth-illustration.tsx b/apps/web/src/features/auth/auth-illustration.tsxindex c803792a..23c385c4 100644--- a/apps/web/src/features/auth/auth-illustration.tsx+++ b/apps/web/src/features/auth/auth-illustration.tsx@@ -1,12 +1,15 @@import { useEffect, useState } from "react";import { AgentAvatarPortrait } from "@/features/rooms/members/agent-avatar-portrait";+import { useT } from "@/i18n/use-translation";++import { authMessages as m } from "./auth.messages";/** What Linger says first, one nudge at a time, across a working day. */const NUDGES = [- { time: "9:00 AM", text: "Demo is tomorrow. I drafted the brief." },- { time: "1:30 PM", text: "I reviewed the code. Two notes." },- { time: "5:00 PM", text: "Before you go: the deck is ready." },+ { key: "morning", time: m.nudgeMorningTime, text: m.nudgeMorning },+ { key: "midday", time: m.nudgeMiddayTime, text: m.nudgeMidday },+ { key: "evening", time: m.nudgeEveningTime, text: m.nudgeEvening },] as const;const LINGER_AVATAR = "figure:red_panda:79524A";@@ -28,6 +31,7 @@ export function AuthIllustration() {// Reduced motion keeps the first nudge lit and never starts the loop.const [landed, setLanded] = useState(() => (prefersReducedMotion() ? 1 : 0));const [awake, setAwake] = useState(false);+ const t = useT();useEffect(() => {if (prefersReducedMotion()) return;@@ -56,13 +60,10 @@ export function AuthIllustration() {<div className="auth-art"><div className="auth-art-copy"><h2 className="auth-art-title">- <span>Your personal AI.</span>- <span>A step ahead.</span>+ <span>{t(m.artTitleFirst)}</span>+ <span>{t(m.artTitleSecond)}</span></h2>- <p className="auth-art-lede">- Linger runs on your own computer, keeps track of your work, and- reaches out before anything slips.- </p>+ <p className="auth-art-lede">{t(m.artLede)}</p></div><div className="auth-art-day">@@ -83,10 +84,10 @@ export function AuthIllustration() {<liclassName="auth-art-moment"data-state={momentState(index, current)}- key={nudge.time}+ key={nudge.key}>- <span className="auth-art-moment-time">{nudge.time}</span>- <span className="auth-art-moment-text">{nudge.text}</span>+ <span className="auth-art-moment-time">{t(nudge.time)}</span>+ <span className="auth-art-moment-text">{t(nudge.text)}</span></li>))}</ol>diff --git a/apps/web/src/features/auth/auth.messages.ts b/apps/web/src/features/auth/auth.messages.tsnew file mode 100644index 00000000..a0d257fd--- /dev/null+++ b/apps/web/src/features/auth/auth.messages.ts@@ -0,0 +1,37 @@+import { defineMessages } from "@/i18n/messages";++export const authMessages = defineMessages("auth", {+ loginTitle: "Log in",+ loginSubtitle: "Welcome back to Linger.",+ sessionExpired: "Your session has expired. Sign in again to continue.",+ localAccountSignIn: "Sign in with this computer's account",+ or: "or",+ email: "Email",+ password: "Password",+ showPassword: "Show password",+ hidePassword: "Hide password",+ signIn: "Sign in",+ logIn: "Log in",+ working: "Working...",+ artTitleFirst: "Your personal AI.",+ artTitleSecond: "A step ahead.",+ artLede:+ "Linger runs on your own computer, keeps track of your work, and reaches out before anything slips.",+ nudgeMorningTime: "9:00 AM",+ nudgeMorning: "Demo is tomorrow. I drafted the brief.",+ nudgeMiddayTime: "1:30 PM",+ nudgeMidday: "I reviewed the code. Two notes.",+ nudgeEveningTime: "5:00 PM",+ nudgeEvening: "Before you go: the deck is ready.",+ timedOut:+ "This step timed out. Try again. Your previous request may have completed.",+ sessionNotEstablished:+ "Linger could not establish a browser session. Use the secure workspace address or contact your workspace administrator.",+ invalidEmail: "Enter a valid email address.",+ desktopAccountUnavailable:+ "This computer's account could not be used. Log in with your email and password.",+ teamHubUnreachable: "TeamHub could not be reached. Try again.",+ logoutUnconfirmed: "Could not confirm logout. Please retry.",+ logoutUnsavedDocuments:+ "Some Document edits are not saved yet. Log out and discard them?",+});diff --git a/apps/web/src/features/auth/authentication-operation.ts b/apps/web/src/features/auth/authentication-operation.tsindex 76c47e3f..15eb5c99 100644--- a/apps/web/src/features/auth/authentication-operation.ts+++ b/apps/web/src/features/auth/authentication-operation.ts@@ -1,4 +1,7 @@import { TeamHubError } from "@/features/teamhub/teamhub-error";+import { translate } from "@/i18n/language";++import { authMessages as m } from "./auth.messages";// The race also bounds adapters that ignore AbortSignal (including response-body reads).export async function authenticationOperation<T>(@@ -14,8 +17,7 @@ export async function authenticationOperation<T>(controller.abort(new TeamHubError({code: "AUTHENTICATION_TIMEOUT",- message:- "This step timed out. Try again. Your previous request may have completed.",+ message: translate(m.timedOut),status: 408,}),),diff --git a/apps/web/src/features/auth/teamhub-authentication.ts b/apps/web/src/features/auth/teamhub-authentication.tsindex ea499518..b7029633 100644--- a/apps/web/src/features/auth/teamhub-authentication.ts+++ b/apps/web/src/features/auth/teamhub-authentication.ts@@ -12,7 +12,9 @@ import { announceTeamHubAuthenticated } from "@/features/teamhub/teamhub-authentimport { TeamHubError } from "@/features/teamhub/teamhub-client";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubSession } from "@/features/teamhub/teamhub-types";+import { translate } from "@/i18n/language";+import { authMessages as m } from "./auth.messages";import { authenticationOperation } from "./authentication-operation";import type { DesktopLocalAccount } from "./desktop-local-account";@@ -87,8 +89,7 @@ export function useTeamHubAuthentication(input: {if (error instanceof TeamHubError && error.status === 401) {throw new TeamHubError({code: "SESSION_NOT_ESTABLISHED",- message:- "Linger could not establish a browser session. Use the secure workspace address or contact your workspace administrator.",+ message: translate(m.sessionNotEstablished),status: 401,});}@@ -120,7 +121,7 @@ export function useTeamHubAuthentication(input: {const email = state.email.trim().toLowerCase();if (!email) {dispatch({- error: "Enter a valid email address.",+ error: translate(m.invalidEmail),type: "operation-error",});return;@@ -144,7 +145,7 @@ export function useTeamHubAuthentication(input: {await runAttempt(async (signal) => {const result = await authenticationOperation(signal, () =>account.signIn().catch(() => ({- message: DESKTOP_ACCOUNT_UNAVAILABLE,+ message: translate(m.desktopAccountUnavailable),ok: false as const,})),);@@ -186,10 +187,7 @@ export function useTeamHubAuthentication(input: {};}-const DESKTOP_ACCOUNT_UNAVAILABLE =- "This computer's account could not be used. Log in with your email and password.";-function readAuthenticationError(error: unknown) {if (error instanceof TeamHubError) return error.message;- return "TeamHub could not be reached. Try again.";+ return translate(m.teamHubUnreachable);}diff --git a/apps/web/src/features/auth/teamhub-login-page.tsx b/apps/web/src/features/auth/teamhub-login-page.tsxindex 3de5e91a..4eb1a919 100644--- a/apps/web/src/features/auth/teamhub-login-page.tsx+++ b/apps/web/src/features/auth/teamhub-login-page.tsx@@ -11,7 +11,9 @@ import { Button } from "@/components/ui/button";import { Field } from "@/components/ui/field";import { FormFeedback } from "@/components/ui/form-feedback";import { Icon } from "@/components/ui/icon";+import { useT } from "@/i18n/use-translation";+import { authMessages as m } from "./auth.messages";import { AuthShell } from "./auth-shell";import { safeAuthenticationReturnTo } from "./authentication-return-to";import {@@ -37,13 +39,14 @@ export function TeamHubLoginPage({returnTo,});const localAccount = useDesktopLocalAccount();+ const t = useT();const authenticationNotice =searchParams.get("reason") === "session-expired"- ? "Your session has expired. Sign in again to continue."+ ? t(m.sessionExpired): null;return (- <AuthShell subtitle="Welcome back to Linger." title="Log in">+ <AuthShell subtitle={t(m.loginSubtitle)} title={t(m.loginTitle)}>{authenticationNotice ? (<div className="mb-4"><FormFeedback tone="danger">{authenticationNotice}</FormFeedback>@@ -67,6 +70,7 @@ function LocalAccountSignIn({account: DesktopLocalAccount;authentication: AuthenticationController;}) {+ const t = useT();return (<div className="auth-local-account"><Button@@ -80,11 +84,11 @@ function LocalAccountSignIn({type="button"><Icon icon={ComputerIcon} size={16} />- <span>Sign in with this computer's account</span>+ <span>{t(m.localAccountSignIn)}</span></Button><div className="auth-divider"><span />- <span>or</span>+ <span>{t(m.or)}</span><span /></div></div>@@ -98,6 +102,7 @@ function AuthenticationForm({}) {const { email, error, isSubmitting, password } = authentication.state;const { changeField, handleSubmit } = authentication;+ const t = useT();return (<form@@ -109,7 +114,7 @@ function AuthenticationForm({><FieldautoComplete="email"- label="Email"+ label={t(m.email)}onChange={(event) => changeField("email", event.target.value)}placeholder="[email protected]"type="email"@@ -117,20 +122,20 @@ function AuthenticationForm({/><PasswordFieldautoComplete="current-password"- label="Password"+ label={t(m.password)}onChange={(value) => changeField("password", value)}value={password}/>{error ? <FormFeedback tone="danger">{error}</FormFeedback> : null}<Button- aria-label="Sign in"+ aria-label={t(m.signIn)}className="auth-submit w-full"disabled={isSubmitting}size="large"type="submit"tone="primary">- <span>{isSubmitting ? "Working..." : "Log in"}</span>+ <span>{t(isSubmitting ? m.working : m.logIn)}</span>{!isSubmitting ? <Icon icon={ArrowRight02Icon} size={16} /> : null}</Button></form>@@ -149,6 +154,7 @@ function PasswordField({value: string;}) {const [visible, setVisible] = useState(false);+ const t = useT();return (<Field@@ -157,7 +163,7 @@ function PasswordField({onChange={(event) => onChange(event.target.value)}suffix={<button- aria-label={`${visible ? "Hide" : "Show"} ${label.toLowerCase()}`}+ aria-label={t(visible ? m.hidePassword : m.showPassword)}className="grid size-7 place-items-center rounded-md text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"onClick={() => setVisible((current) => !current)}type="button"diff --git a/apps/web/src/features/auth/use-logout.ts b/apps/web/src/features/auth/use-logout.tsindex a8a33748..619c9e00 100644--- a/apps/web/src/features/auth/use-logout.ts+++ b/apps/web/src/features/auth/use-logout.ts@@ -11,13 +11,15 @@ import { teamHubIdentityQueryOptions } from "@/features/rooms/room-queries";import { teamHubDone } from "@/features/teamhub/teamhub-api";import { announceTeamHubAuthenticationRequired } from "@/features/teamhub/teamhub-authentication";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";+import { translate } from "@/i18n/language";+import { authMessages } from "./auth.messages";import { safeAuthenticationReturnTo } from "./authentication-return-to";import { clearLocalAuthenticatedState } from "./local-authenticated-state";-export const LOGOUT_ERROR_MESSAGE = "Could not confirm logout. Please retry.";+/** The English source; the confirmation itself follows the language on screen. */export const LOGOUT_UNSAVED_DOCUMENT_MESSAGE =- "Some Document edits are not saved yet. Log out and discard them?";+ authMessages.logoutUnsavedDocuments.source;export function useLogout({ returnTo }: { returnTo?: string } = {}) {const { client } = useTeamHubRuntime();@@ -62,7 +64,7 @@ export function useLogout({ returnTo }: { returnTo?: string } = {}) {if (pending.current) return;if (hasUnsavedRoomDocumentChanges() &&- !window.confirm(LOGOUT_UNSAVED_DOCUMENT_MESSAGE)+ !window.confirm(translate(authMessages.logoutUnsavedDocuments)))return;pending.current = true;diff --git a/apps/web/src/features/local-computer/connect-computer-page.tsx b/apps/web/src/features/local-computer/connect-computer-page.tsxindex 123c7afd..018600c6 100644--- a/apps/web/src/features/local-computer/connect-computer-page.tsx+++ b/apps/web/src/features/local-computer/connect-computer-page.tsx@@ -11,7 +11,8 @@ import { useLocation, useSearchParams } from "react-router";import { Button } from "@/components/ui/button";import { Select, SelectItem } from "@/components/ui/select";-import { LOGOUT_ERROR_MESSAGE, useLogout } from "@/features/auth/use-logout";+import { authMessages } from "@/features/auth/auth.messages";+import { useLogout } from "@/features/auth/use-logout";import {teamHubSessionQueryOptions,teamHubTenantsQueryOptions,@@ -255,7 +256,7 @@ export function ConnectComputerPage({{switchAccount.error ? (<p className="text-sm text-app-danger" role="alert">- {LOGOUT_ERROR_MESSAGE}+ {t(authMessages.logoutUnconfirmed)}</p>) : null}</div>diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.tsindex cca71517..a6b39f9b 100644--- a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts@@ -33,6 +33,8 @@ for (const exports of Object.values(messageModules))* `file: namespace.name`, with the reason.*/const notActions: Record<string, string> = {+ "/src/features/auth/teamhub-login-page.tsx: auth.hidePassword":+ "shows or hides the password in place; it closes nothing","/src/features/rooms/chat/room-notice-row.tsx: chat.hideChanges":"folds the change list in place; it closes nothing","/src/features/rooms/room-secondary-navigation.tsx: roomList.deletedChat":diff --git a/apps/web/src/features/rooms/room-shell.tsx b/apps/web/src/features/rooms/room-shell.tsxindex 209904f0..802d0298 100644--- a/apps/web/src/features/rooms/room-shell.tsx+++ b/apps/web/src/features/rooms/room-shell.tsx@@ -20,7 +20,8 @@ import {import { DesktopBarSlot } from "@/app/desktop-frame";import { isDesktopShell } from "@/app/desktop-shell";import { AccountMenu } from "@/features/auth/account-menu";-import { LOGOUT_ERROR_MESSAGE, useLogout } from "@/features/auth/use-logout";+import { authMessages } from "@/features/auth/auth.messages";+import { useLogout } from "@/features/auth/use-logout";import { Button } from "@/components/ui/button";import { useGlobalSearchShortcut } from "@/features/search/search-shortcut";@@ -391,7 +392,7 @@ function RoomShellContent({className="flex shrink-0 items-center gap-3 border-b border-border/60 px-4 py-3 text-sm text-app-danger"role="alert">- <span>{LOGOUT_ERROR_MESSAGE}</span>+ <span>{t(authMessages.logoutUnconfirmed)}</span><Buttondata-voice-risk="never"loading={logout.isPending}diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.mdindex 8db8ff34..9371bc59 100644--- a/apps/web/src/i18n/locales/zh-CN.glossary.md+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md@@ -164,6 +164,7 @@ elsewhere.| Highlights / Next | 要点 / 接下来 | Sections of a report card. || Email (an address) | 邮箱 | `邮件` is a message that is sent. || Keep (a Wiki page) | 保留 | The opposite of Delete in the Wiki directory. |+| Session (a sign-in) | 登录 / 浏览器会话 | `会话` only for the browser session. |## Stylediff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex e2986f4e..93e54b38 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -2091,5 +2091,35 @@"generating": "生成中","linkNotWikiPage": "这个链接指向的不是可用的 Wiki 页面。","linkCouldNotOpen": "无法打开链接的这个 Wiki 页面。它可能已不可用,或者你已失去访问权限。请重试。"+ },+ "auth": {+ "loginTitle": "登录",+ "loginSubtitle": "欢迎回到 Linger。",+ "sessionExpired": "登录已过期,请重新登录后继续。",+ "localAccountSignIn": "用这台电脑的账号登录",+ "or": "或",+ "email": "邮箱",+ "password": "密码",+ "showPassword": "显示密码",+ "hidePassword": "隐藏密码",+ "signIn": "登录",+ "logIn": "登录",+ "working": "正在处理…",+ "artTitleFirst": "你的个人 AI,",+ "artTitleSecond": "总是先你一步。",+ "artLede": "Linger 运行在你自己的电脑上,记着你手头的工作,在事情被落下之前主动提醒你。",+ "nudgeMorningTime": "上午 9:00",+ "nudgeMorning": "明天要演示,我把简报草拟好了。",+ "nudgeMiddayTime": "下午 1:30",+ "nudgeMidday": "代码我看过了,有两点建议。",+ "nudgeEveningTime": "下午 5:00",+ "nudgeEvening": "下班前说一声:演示文稿准备好了。",+ "timedOut": "这一步超时了,请重试。你上一次的请求可能已经完成。",+ "sessionNotEstablished": "Linger 无法建立浏览器会话。请使用安全的工作区地址,或联系工作区管理员。",+ "invalidEmail": "请输入有效的邮箱地址。",+ "desktopAccountUnavailable": "无法使用这台电脑的账号。请用邮箱和密码登录。",+ "teamHubUnreachable": "无法连接 TeamHub,请重试。",+ "logoutUnconfirmed": "无法确认是否已退出登录,请重试。",+ "logoutUnsavedDocuments": "有些文档的修改还没有保存。要退出登录并放弃这些修改吗?"}}