This commit is contained in:
Zzzz
2026-04-28 10:53:09 +08:00
parent 5dc91a4e8e
commit ff044e6aab
58 changed files with 793 additions and 635 deletions
+7
View File
@@ -52,3 +52,10 @@ DAOs report database failures without leaking SQL details to JSP pages.
Use concise messages suitable for JSP rendering. For protected operations,
prefer generic denial messages over exposing permission internals.
For this application, messages rendered into JSP pages should be Simplified
Chinese. This includes `ServiceResult.message`, field-level validation errors,
flash messages set by Servlet controllers, and display names returned by entity
helpers. Keep log-only diagnostics, exception types, stored enum codes, request
parameter names, and database values unchanged unless a separate contract change
requires it.
@@ -23,6 +23,19 @@ the reusable UI units.
---
## Interface Copy
- Render user-visible JSP copy in Simplified Chinese, including navigation,
headings, form labels, buttons, table headers, empty states, and accessible
labels.
- Keep machine-readable values unchanged: URLs, request parameter names, CSS
classes, Java identifiers, enum codes, database values, and servlet names stay
in their existing code form.
- Translate display helper output and controller/service messages when they are
rendered into JSP pages.
---
## Forms
- Forms should post to Servlet controller endpoints, not directly to DAOs or
@@ -0,0 +1,6 @@
{"file": ".trellis/spec/frontend/index.md", "reason": "Check translated UI against frontend conventions."}
{"file": ".trellis/spec/frontend/component-guidelines.md", "reason": "Verify forms, tables, fragments, and UI copy remain presentation-focused."}
{"file": ".trellis/spec/frontend/type-safety.md", "reason": "Verify JSP/Servlet display contracts and escaping were preserved."}
{"file": ".trellis/spec/frontend/quality-guidelines.md", "reason": "Verify accessibility labels, layout preservation, and JSP/CSS quality."}
{"file": ".trellis/spec/backend/error-handling.md", "reason": "Review translated backend messages displayed in the UI."}
{"file": ".trellis/spec/backend/quality-guidelines.md", "reason": "Review backend layer boundaries for message-only changes."}
@@ -0,0 +1,7 @@
{"file": ".trellis/spec/frontend/index.md", "reason": "Frontend JSP/CSS conventions and pre-development checklist for UI changes."}
{"file": ".trellis/spec/frontend/directory-structure.md", "reason": "Confirms JSP/static asset layout and forbidden SPA conventions."}
{"file": ".trellis/spec/frontend/component-guidelines.md", "reason": "JSP fragments, forms, tables, and reusable UI conventions affected by translation."}
{"file": ".trellis/spec/frontend/type-safety.md", "reason": "JSP/Servlet display contracts and safe rendering guidance while changing visible text."}
{"file": ".trellis/spec/frontend/quality-guidelines.md", "reason": "Frontend quality bar for preserving JSP/CSS behavior and accessibility basics."}
{"file": ".trellis/spec/backend/error-handling.md", "reason": "Server-generated UI messages must remain safe and user-facing."}
{"file": ".trellis/spec/backend/quality-guidelines.md", "reason": "Layer boundary constraints for any controller/service message changes."}
@@ -0,0 +1,61 @@
# brainstorm: Frontend Chinese UI
## Goal
Make the existing JSP/Servlet frontend interface display in Simplified Chinese so users see Chinese page titles, navigation, labels, action buttons, empty states, accessibility labels, and server-rendered feedback messages.
## What I already know
* The user requested: "前端界面需要中文".
* The project uses JSP/CSS rendered by Servlet/Tomcat, not a SPA framework.
* Visible English text is concentrated in `src/main/webapp/WEB-INF/jsp/**`.
* Some user-facing messages are set by Java controllers/services and rendered by JSP pages.
* The application already uses UTF-8 JSP page encoding and a UTF-8 character encoding filter.
## Assumptions
* Use Simplified Chinese for all user-visible frontend copy.
* Keep URLs, form field names, Java identifiers, enum codes, database values, CSS class names, and servlet names unchanged.
* Translate dynamic display names exposed by Java enums/role helpers where they are shown in the UI.
* Do not add a full i18n framework in this task.
## Open Questions
* None blocking; proceed with the Simplified Chinese assumption.
## Requirements
* Translate all hardcoded visible English text in JSP pages to Simplified Chinese.
* Change HTML language attributes from English to Simplified Chinese where applicable.
* Translate visible document titles and the web app display name.
* Translate server-generated messages that are displayed to users on the frontend.
* Preserve existing page structure, routing, permissions, form submission behavior, JSTL/EL bindings, and backend workflows.
* Leave stored data and machine-readable codes unchanged.
## Acceptance Criteria
* [x] Navigation, page headings, labels, buttons, table headers, empty states, option labels, and accessible labels appear in Simplified Chinese.
* [x] Login, unauthorized, dashboard, role home, catalog, management, reader, borrowing, report, system log, and admin user pages no longer show English UI copy except product/brand names and technical/user data.
* [x] Server-rendered success/error messages shown in the UI are Simplified Chinese.
* [x] Maven build succeeds.
## Definition of Done
* Tests or build verification run where practical.
* Lint/typecheck/build green for the Java webapp.
* Spec update considered after implementation.
## Out of Scope
* Runtime language switching.
* Browser locale detection.
* New translation resource bundles.
* Database data migration.
* Visual redesign beyond any minor layout-preserving text fit adjustments.
## Technical Notes
* Relevant spec index: `.trellis/spec/frontend/index.md`.
* Backend messages may require `.trellis/spec/backend/error-handling.md` and `.trellis/spec/backend/quality-guidelines.md`.
* Likely affected frontend files include `src/main/webapp/WEB-INF/jsp/**`, `src/main/webapp/WEB-INF/web.xml`, and possibly `src/main/webapp/static/images/library-login.svg` for accessible text.
* Likely affected Java files include controllers/services/entities that expose user-facing display names or request messages.
@@ -0,0 +1,26 @@
{
"id": "frontend-chinese-ui",
"name": "frontend-chinese-ui",
"title": "brainstorm: 前端界面中文化",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "Zzzz",
"assignee": "Zzzz",
"createdAt": "2026-04-28",
"completedAt": null,
"branch": null,
"base_branch": "master",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}