feat(webui): add i18n text keys and translate one static text element per page for verification

This commit is contained in:
yiling
2026-06-26 11:24:32 +08:00
parent 6e2e5bdbc2
commit 4fd27ab147
14 changed files with 47 additions and 14 deletions
@@ -1,6 +1,7 @@
'use client' 'use client'
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import type { InferRequestType, InferResponseType } from 'hono/client' import type { InferRequestType, InferResponseType } from 'hono/client'
import { m } from '@/ui/src/paraglide/messages.js'
import { usePermissions } from '@/ui/hooks/use-permissions' import { usePermissions } from '@/ui/hooks/use-permissions'
import { getAllFilesFromEntries } from '@/ui/lib/dnd-utils' import { getAllFilesFromEntries } from '@/ui/lib/dnd-utils'
@@ -972,7 +973,7 @@ export function FileBrowser({
<div className="flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0 animate-in fade-in slide-in-from-top-2 duration-300"> <div className="flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0 animate-in fade-in slide-in-from-top-2 duration-300">
<div className="flex items-center gap-2 text-muted-foreground"> <div className="flex items-center gap-2 text-muted-foreground">
<AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" /> <AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" />
<span>Items are automatically deleted after 30 days.</span> <span>{m.recently_deleted_notice()}</span>
</div> </div>
{canAdmin && ( {canAdmin && (
<Button <Button
@@ -6,6 +6,7 @@ import { client } from '@/ui/api/client'
import { usePermissions } from '@/ui/hooks/use-permissions' import { usePermissions } from '@/ui/hooks/use-permissions'
import { useMutation } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query'
import { InferRequestType, InferResponseType } from 'hono/client' import { InferRequestType, InferResponseType } from 'hono/client'
import { m } from '@/ui/src/paraglide/messages.js'
import { useFieldStore } from '@/ui/stores/fields' import { useFieldStore } from '@/ui/stores/fields'
import { useMemberStore } from '@/ui/stores/members' import { useMemberStore } from '@/ui/stores/members'
@@ -519,7 +520,7 @@ export default function FileSystemManager({
/> />
) : ( ) : (
<div className="flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground"> <div className="flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground">
Select an asset to view details {m.select_asset_to_view_details()}
</div> </div>
)} )}
</div> </div>
@@ -2,6 +2,7 @@
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import { useTopNavStore } from '@/ui/stores/top-nav' import { useTopNavStore } from '@/ui/stores/top-nav'
import { m } from '@/ui/src/paraglide/messages.js'
import { useInfiniteQuery, useQuery } from '@tanstack/react-query' import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
import { useEffect, useState, useMemo, useRef } from 'react' import { useEffect, useState, useMemo, useRef } from 'react'
import { TopNav } from './top-nav' import { TopNav } from './top-nav'
@@ -386,7 +387,7 @@ export function PublicShareManager({
<div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10"> <div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10">
<Lock className="h-6 w-6 text-primary" /> <Lock className="h-6 w-6 text-primary" />
</div> </div>
<CardTitle>Password Protected</CardTitle> <CardTitle>{m.password_protected()}</CardTitle>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<form onSubmit={handlePasswordSubmit} className="space-y-4"> <form onSubmit={handlePasswordSubmit} className="space-y-4">
@@ -1,5 +1,6 @@
import { ShareLinkInfo, UpdateShareLinkRequest } from '@shumai/dtos' import { ShareLinkInfo, UpdateShareLinkRequest } from '@shumai/dtos'
import { type FieldInfo as MetadataFieldInfo } from '@shumai/dtos' import { type FieldInfo as MetadataFieldInfo } from '@shumai/dtos'
import { m } from '@/ui/src/paraglide/messages.js'
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import { Button } from '@/ui/components/ui/button' import { Button } from '@/ui/components/ui/button'
import { Input } from '@/ui/components/ui/input' import { Input } from '@/ui/components/ui/input'
@@ -113,7 +114,7 @@ export function ShareSettingsSidebar({
<div className="p-4 space-y-6"> <div className="p-4 space-y-6">
<div className="space-y-4"> <div className="space-y-4">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h3 className="text-sm font-medium">Link Visibility</h3> <h3 className="text-sm font-medium">{m.link_visibility()}</h3>
<Switch <Switch
checked={!shareLink.isDisabled} checked={!shareLink.isDisabled}
onCheckedChange={(checked) => updateShare({ isDisabled: !checked })} onCheckedChange={(checked) => updateShare({ isDisabled: !checked })}
+2 -1
View File
@@ -8,6 +8,7 @@ import {
} from '@/ui/components/ui/dialog' } from '@/ui/components/ui/dialog'
import { useQuery } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router' import { useNavigate } from '@tanstack/react-router'
import { m } from '@/ui/src/paraglide/messages.js'
export function TeamSelector() { export function TeamSelector() {
const navigate = useNavigate() const navigate = useNavigate()
@@ -37,7 +38,7 @@ export function TeamSelector() {
<Dialog open={true}> <Dialog open={true}>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>Select a Team</DialogTitle> <DialogTitle>{m.select_a_team()}</DialogTitle>
<DialogDescription> <DialogDescription>
You are a member of multiple teams. Please select one to continue. You are a member of multiple teams. Please select one to continue.
</DialogDescription> </DialogDescription>
+12 -1
View File
@@ -7,5 +7,16 @@
"personal_info": "Personal Info", "personal_info": "Personal Info",
"language_settings": "Language Settings", "language_settings": "Language Settings",
"select_preferred_language": "Select your preferred display language.", "select_preferred_language": "Select your preferred display language.",
"settings": "Settings" "settings": "Settings",
"welcome_back": "Welcome Back",
"create_account": "Create Account",
"select_a_team": "Select a Team",
"projects": "Projects",
"select_asset_to_view_details": "Select an asset to view details",
"all_collections": "All Collections",
"file_not_found": "File not found.",
"recently_deleted_notice": "Items are automatically deleted after 30 days.",
"all_share_links": "All Share Links",
"link_visibility": "Link Visibility",
"password_protected": "Password Protected"
} }
+12 -1
View File
@@ -7,5 +7,16 @@
"personal_info": "个人信息", "personal_info": "个人信息",
"language_settings": "语言设置", "language_settings": "语言设置",
"select_preferred_language": "选择您首选的显示语言。", "select_preferred_language": "选择您首选的显示语言。",
"settings": "设置" "settings": "设置",
"welcome_back": "欢迎回来",
"create_account": "创建账户",
"select_a_team": "选择团队",
"projects": "项目",
"select_asset_to_view_details": "选择资产查看详情",
"all_collections": "所有收藏",
"file_not_found": "文件未找到。",
"recently_deleted_notice": "项目将在 30 天后自动删除。",
"all_share_links": "所有分享链接",
"link_visibility": "链接可见性",
"password_protected": "密码保护"
} }
+2 -1
View File
@@ -13,6 +13,7 @@ import { ArrowRight, Loader2, Lock, LogIn, Mail } from 'lucide-react'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form' import { useForm } from 'react-hook-form'
import { z } from 'zod' import { z } from 'zod'
import { m } from '@/ui/src/paraglide/messages.js'
const loginSchema = z.object({ const loginSchema = z.object({
email: z.string().email('Invalid email address'), email: z.string().email('Invalid email address'),
@@ -83,7 +84,7 @@ function LoginPage() {
<AuthLayout> <AuthLayout>
<div className="mb-8"> <div className="mb-8">
<h1 className="text-2xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50"> <h1 className="text-2xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50">
Welcome Back {m.welcome_back()}
</h1> </h1>
<p className="text-zinc-500 dark:text-zinc-400 text-sm mt-1"> <p className="text-zinc-500 dark:text-zinc-400 text-sm mt-1">
Enter your credentials to access your account. Enter your credentials to access your account.
@@ -1,6 +1,7 @@
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import { FolderTree } from '@/ui/components/folder-tree' import { FolderTree } from '@/ui/components/folder-tree'
import { ResizeHandle } from '@/ui/components/resize-handle' import { ResizeHandle } from '@/ui/components/resize-handle'
import { m } from '@/ui/src/paraglide/messages.js'
import { import {
Table, Table,
TableBody, TableBody,
@@ -135,7 +136,7 @@ function CollectionsPage() {
<header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10"> <header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Bookmark className="h-5 w-5 text-primary" /> <Bookmark className="h-5 w-5 text-primary" />
<h1 className="font-bold text-lg text-foreground">All Collections</h1> <h1 className="font-bold text-lg text-foreground">{m.all_collections()}</h1>
</div> </div>
</header> </header>
@@ -1,6 +1,7 @@
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import { FileViewer } from '@/ui/components/file-viewer' import { FileViewer } from '@/ui/components/file-viewer'
import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar' import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar'
import { m } from '@/ui/src/paraglide/messages.js'
import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar' import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar'
import { ResizeHandle } from '@/ui/components/resize-handle' import { ResizeHandle } from '@/ui/components/resize-handle'
import { FileDetailSkeleton } from '@/ui/components/loading-skeletons' import { FileDetailSkeleton } from '@/ui/components/loading-skeletons'
@@ -268,7 +269,7 @@ function FileViewPage() {
} }
if (isError || !fileData || !projectInfo || !teamId) { if (isError || !fileData || !projectInfo || !teamId) {
return <div>File not found.</div> return <div>{m.file_not_found()}</div>
} }
const handleSaveField = (fieldId: string, value: unknown) => { const handleSaveField = (fieldId: string, value: unknown) => {
@@ -1,6 +1,7 @@
import { client } from '@/ui/api/client' import { client } from '@/ui/api/client'
import { FolderTree } from '@/ui/components/folder-tree' import { FolderTree } from '@/ui/components/folder-tree'
import { ResizeHandle } from '@/ui/components/resize-handle' import { ResizeHandle } from '@/ui/components/resize-handle'
import { m } from '@/ui/src/paraglide/messages.js'
import { Switch } from '@/ui/components/ui/switch' import { Switch } from '@/ui/components/ui/switch'
import { Button } from '@/ui/components/ui/button' import { Button } from '@/ui/components/ui/button'
import { import {
@@ -165,7 +166,7 @@ function SharesPage() {
<header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10"> <header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Share2 className="h-5 w-5 text-primary" /> <Share2 className="h-5 w-5 text-primary" />
<h1 className="font-bold text-lg text-foreground">All Share Links</h1> <h1 className="font-bold text-lg text-foreground">{m.all_share_links()}</h1>
</div> </div>
</header> </header>
+2 -1
View File
@@ -14,6 +14,7 @@ import { signUp } from '@/ui/lib/auth-client'
import { useState } from 'react' import { useState } from 'react'
import { ShumaiLogo } from '@/ui/components/ui/icons' import { ShumaiLogo } from '@/ui/components/ui/icons'
import { AuthLayout } from '@/ui/components/auth-layout' import { AuthLayout } from '@/ui/components/auth-layout'
import { m } from '@/ui/src/paraglide/messages.js'
const signupSchema = z.object({ const signupSchema = z.object({
email: z.string().email('Invalid email address'), email: z.string().email('Invalid email address'),
@@ -139,7 +140,7 @@ function SignupPage() {
<AuthLayout> <AuthLayout>
<div className="mb-8"> <div className="mb-8">
<h1 className="text-2xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50"> <h1 className="text-2xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50">
Create Account {m.create_account()}
</h1> </h1>
<p className="text-zinc-500 dark:text-zinc-400 text-sm mt-1 mb-4"> <p className="text-zinc-500 dark:text-zinc-400 text-sm mt-1 mb-4">
Start building and organizing your space. Start building and organizing your space.
@@ -4,6 +4,7 @@ import { client } from '@/ui/api/client'
import { MembersDialog } from '@/ui/components/members-dialog' import { MembersDialog } from '@/ui/components/members-dialog'
import { ProjectDialog } from '@/ui/components/project-dialog' import { ProjectDialog } from '@/ui/components/project-dialog'
import { SortDropdown } from '@/ui/components/sort-dropdown' import { SortDropdown } from '@/ui/components/sort-dropdown'
import { m } from '@/ui/src/paraglide/messages.js'
import { import {
AlertDialog, AlertDialog,
AlertDialogAction, AlertDialogAction,
@@ -256,7 +257,7 @@ function TeamPage() {
return ( return (
<div className="flex-1 overflow-y-auto p-4"> <div className="flex-1 overflow-y-auto p-4">
<div className="flex flex-wrap items-center justify-between mb-4 gap-4"> <div className="flex flex-wrap items-center justify-between mb-4 gap-4">
<h1 className="text-2xl font-bold">Projects</h1> <h1 className="text-2xl font-bold">{m.projects()}</h1>
<div className="flex flex-wrap items-center gap-4"> <div className="flex flex-wrap items-center gap-4">
<div <div
className="flex items-center -space-x-2 cursor-pointer hover:opacity-90" className="flex items-center -space-x-2 cursor-pointer hover:opacity-90"
@@ -242,7 +242,7 @@ function TeamSettingsPage() {
<div className="w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300"> <div className="w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300">
<nav className="p-4 space-y-1 mt-4"> <nav className="p-4 space-y-1 mt-4">
<div className="mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider"> <div className="mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider">
Settings {m.settings()}
</div> </div>
<button <button