From 5206e1472e5570181e533e8ef7deb160bedb54ac Mon Sep 17 00:00:00 2001 From: yuanzoo Date: Sat, 16 May 2026 22:44:50 +0800 Subject: [PATCH] Localize annotation controls --- src/components/AnnotationModal.tsx | 30 +++++----- src/components/FloatingActionBar.tsx | 2 +- .../__tests__/FloatingActionBar.test.tsx | 4 +- src/i18n/index.tsx | 56 +++++++++++++++++++ 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/src/components/AnnotationModal.tsx b/src/components/AnnotationModal.tsx index 90cdf5c3..df7b20f2 100644 --- a/src/components/AnnotationModal.tsx +++ b/src/components/AnnotationModal.tsx @@ -4,6 +4,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { Stage, Layer, Image as KonvaImage, Rect, Ellipse, Arrow, Line, Text, Transformer } from "react-konva"; import { useAnnotationStore } from "@/store/annotationStore"; import { useWorkflowStore } from "@/store/workflowStore"; +import { useI18n } from "@/i18n"; import { AnnotationShape, RectangleShape, @@ -29,6 +30,7 @@ const COLORS = [ const STROKE_WIDTHS = [2, 4, 8]; export function AnnotationModal() { + const { t } = useI18n(); const { isModalOpen, sourceNodeId, @@ -400,12 +402,12 @@ export function AnnotationModal() { if (!isModalOpen) return null; const tools: { type: ToolType; label: string }[] = [ - { type: "select", label: "Select" }, - { type: "rectangle", label: "Rect" }, - { type: "circle", label: "Circle" }, - { type: "arrow", label: "Arrow" }, - { type: "freehand", label: "Draw" }, - { type: "text", label: "Text" }, + { type: "select", label: t("annotation.tool.select") }, + { type: "rectangle", label: t("annotation.tool.rectangle") }, + { type: "circle", label: t("annotation.tool.circle") }, + { type: "arrow", label: t("annotation.tool.arrow") }, + { type: "freehand", label: t("annotation.tool.draw") }, + { type: "text", label: t("annotation.tool.text") }, ]; return ( @@ -429,20 +431,20 @@ export function AnnotationModal() {
- - + +
- +
@@ -478,7 +480,7 @@ export function AnnotationModal() {
{/* Colors */}
- Color + {t("annotation.color")} {COLORS.map((color) => ( {/* Zoom */} diff --git a/src/components/FloatingActionBar.tsx b/src/components/FloatingActionBar.tsx index 60bc39c7..166aa1e1 100644 --- a/src/components/FloatingActionBar.tsx +++ b/src/components/FloatingActionBar.tsx @@ -556,7 +556,7 @@ export function FloatingActionBar() {