Translate Project Management and add its tests and guide
- Every interface string of Project Management goes through the catalog: 539 new rows with fr, ja, and zh-CN. - Storage and model messages use a local message() marker and stay free of host imports. The interface translates them. - A board renders again when the language changes. Dates use the interface language. - Fix: the ribbon button waits for the feature switches at startup, and the settings code loads no feature module. - Add six smoke tests: board state, cards, menus, drag and drop, views, and language. - Add docs/guides/project-management.md and UI-060. Update the user, plugin, SDK, host, development, and interface docs and CLAUDE.md. - Name the fake board view of tree/renameUndo "Board fixture", because the native Project Management button is now in the ribbon.
This commit is contained in:
@@ -8,6 +8,7 @@ import type { FeatureContext, FeatureInstance } from "../types.ts";
|
||||
import { boardKey, isManagedBoard, readCatalog } from "./storage/catalog.ts";
|
||||
import { findLegacy, hasLegacy, type LegacyContent } from "./storage/legacy.ts";
|
||||
import { isHiddenCard } from "./storage/persistence.ts";
|
||||
import { message } from "./storage/message.ts";
|
||||
import type { BoardReference } from "./storage/board.ts";
|
||||
import { TaskStore } from "./model/store.ts";
|
||||
import { hostMenus } from "./ui/host.ts";
|
||||
@@ -45,7 +46,7 @@ export function start(context: FeatureContext): FeatureInstance {
|
||||
if (fresh) legacy.delete(key);
|
||||
let pending = legacy.get(key);
|
||||
if (!pending) {
|
||||
pending = findLegacy(workspace, () => { if (disposed) throw new Error("Project Management is off."); });
|
||||
pending = findLegacy(workspace, () => { if (disposed) throw new Error(message("Project Management is off.")); });
|
||||
pending.catch(() => legacy.delete(key));
|
||||
legacy.set(key, pending);
|
||||
}
|
||||
@@ -67,7 +68,7 @@ export function start(context: FeatureContext): FeatureInstance {
|
||||
const openBoard = async (path: string, from?: string) => {
|
||||
const snapshot = await readCatalog(workspace);
|
||||
const board = isManagedBoard(path) ? snapshot.value.boards.find(item => boardKey(item.value.id) === path) : undefined;
|
||||
if (!board) throw new Error("This board is unavailable. Refresh Project Management.");
|
||||
if (!board) throw new Error(message("This board is unavailable. Refresh Project Management."));
|
||||
const id = boardViewId(board.value.id);
|
||||
context.setViewTitle(id, board.name);
|
||||
if (from) context.replaceView(from, id); else context.openView(id);
|
||||
@@ -75,7 +76,7 @@ export function start(context: FeatureContext): FeatureInstance {
|
||||
|
||||
function mountView(view: string, element: HTMLElement) {
|
||||
const boardId = view === PLANNING ? null : boardOfView(view);
|
||||
if (view !== PLANNING && !boardId) throw new Error("This view is unavailable.");
|
||||
if (view !== PLANNING && !boardId) throw new Error(message("This view is unavailable."));
|
||||
const reference: BoardReference | undefined = boardId ? { id: boardId, path: boardKey(boardId) } : undefined;
|
||||
if (!states.has(view)) states.set(view, {});
|
||||
const store = new TaskStore(workspace, reference, { legacy: false });
|
||||
@@ -117,7 +118,7 @@ export function start(context: FeatureContext): FeatureInstance {
|
||||
},
|
||||
saveTabState: view => structuredClone(states.get(view) ?? {}),
|
||||
restoreTabState(view, value) {
|
||||
if (view !== PLANNING && !boardOfView(view)) throw new Error("This view is unavailable.");
|
||||
if (view !== PLANNING && !boardOfView(view)) throw new Error(message("This view is unavailable."));
|
||||
states.set(view, parseViewState(value));
|
||||
persist(view);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user