Skip to content

A lightweight Clip Studio Paint alternative with real-time multiplayer collaborative drawing. Built with Tauri and React.

pre1.2.3

sora7f35cb59e82f
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 49e49cc..e2a60e5 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2044,6 +2044,8 @@ dependencies = [
"tauri-plugin-updater",
"tokio",
"tower-http 0.5.2",
+ "webview2-com",
+ "windows-core 0.62.2",
"windows-sys 0.59.0",
]
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 82046c9..0dd84b0 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -40,6 +40,8 @@ flate2 = "1.0"
rusqlite = { version = "0.32", features = ["bundled", "serialize"] }
[target.'cfg(target_os = "windows")'.dependencies]
+webview2-com = "0.39"
+windows-core = "0.62"
windows-sys = { version = "0.59", features = [
"Win32_Foundation",
"Win32_Graphics_Gdi",
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 88710fd..f214e60 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1325,6 +1325,24 @@ pub fn run() {
.plugin(tauri_plugin_updater::Builder::new().build())?;
if let Some(main_window) = app.get_webview_window("main") {
let _ = main_window.maximize();
+ #[cfg(target_os = "windows")]
+ let _ = main_window.with_webview(|webview| {
+ use webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2Settings3;
+ use windows_core::Interface;
+ unsafe {
+ if let Ok(core) = webview.controller().CoreWebView2() {
+ if let Ok(settings) = core.Settings() {
+ // Disable built-in browser accelerator keys (Ctrl+R, F5, Ctrl+Shift+R,
+ // Alt+Left/Right, Ctrl+P, Ctrl+F, etc.) at the WebView2 layer so accidental
+ // refreshes can never wipe unsaved artwork. Standard editing keys and DOM
+ // keydown events (including Ink Studio shortcuts) continue to work normally.
+ if let Ok(settings3) = settings.cast::<ICoreWebView2Settings3>() {
+ let _ = settings3.SetAreBrowserAcceleratorKeysEnabled(false);
+ }
+ }
+ }
+ }
+ });
}
}
Ok(())
diff --git a/src-tauri/src/tablet_input.rs b/src-tauri/src/tablet_input.rs
index 4616d0d..c873d6c 100644
--- a/src-tauri/src/tablet_input.rs
+++ b/src-tauri/src/tablet_input.rs
@@ -58,6 +58,22 @@ impl InkStateMachine {
self.pointers.clear();
}
+ /// Force-ends all currently in-contact pointers (e.g. on window deactivation / focus loss).
+ /// Returns `true` if at least one pointer was actively in contact.
+ pub fn force_end_all_active(&mut self) -> bool {
+ let mut had_active = false;
+ for st in self.pointers.values_mut() {
+ if st.in_contact {
+ had_active = true;
+ st.in_contact = false;
+ st.consecutive_no_contact = 0;
+ st.last_phase = 3;
+ st.last_perf_count = 0;
+ }
+ }
+ had_active
+ }
+
pub fn process_message(
&mut self,
hwnd: isize,
@@ -141,17 +157,12 @@ impl InkStateMachine {
if hwnd != main_hwnd {
return None;
}
- st.consecutive_no_contact = st.consecutive_no_contact.saturating_add(1);
- if st.consecutive_no_contact >= 2 {
- st.in_contact = false;
- st.consecutive_no_contact = 0;
- 3
- } else {
- if newest_frame_id != 0 {
- st.last_frame_id = newest_frame_id;
- }
- return None;
- }
+ // Main top-level window received WM_POINTERLEAVE while not in contact:
+ // Windows only sends one leave when the stylus exits the window, so end contact
+ // immediately instead of waiting for a second leave frame that never arrives.
+ st.in_contact = false;
+ st.consecutive_no_contact = 0;
+ 3
} else {
4
}
@@ -460,6 +471,7 @@ mod win_impl {
};
const WM_APP_WINTAB_FOCUS: u32 = WM_APP + 1;
+ const WM_APP_WINTAB_BLUR: u32 = WM_APP + 2;
const WINTAB_FOCUS_SUBCLASS_ID: usize = 0x494E_4B57; // "INKW"
// --- WinTab ABI constants & types ---
@@ -793,6 +805,32 @@ mod win_impl {
dw_ref_data: usize,
) -> LRESULT {
let _ = std::panic::catch_unwind(|| {
+ let main_hwnd = dw_ref_data as HWND;
+ if hwnd == main_hwnd
+ && ((msg == WM_ACTIVATE && (wparam & 0xFFFF) == 0)
+ || (msg == WM_ACTIVATEAPP && wparam == 0))
+ {
+ let had_active = INK_DEDUP
+ .lock()
+ .map(|mut dedup| dedup.force_end_all_active())
+ .unwrap_or(false);
+ if had_active {
+ send_samples(&[TabletSample {
+ client_x: 0.0,
+ client_y: 0.0,
+ pressure: 0.0,
+ tilt_x: 0.0,
+ tilt_y: 0.0,
+ twist: 0.0,
+ timestamp_ms: qpc_now_ms(),
+ buttons: 0,
+ phase: 3,
+ backend: 2,
+ }]);
+ }
+ return;
+ }
+
let phase = match msg {
WM_POINTERDOWN => Some(1u8),
WM_POINTERUPDATE => Some(2u8),
@@ -1074,10 +1112,20 @@ mod win_impl {
WM_SETFOCUS => true,
_ => false,
};
- if should_raise {
+ let should_blur = match msg {
+ WM_ACTIVATE => (wparam & 0xFFFF) == 0,
+ WM_ACTIVATEAPP => wparam == 0,
+ _ => false,
+ };
+ if should_raise || should_blur {
let wt_hwnd = WINTAB_MSG_HWND.load(Ordering::Acquire);
if wt_hwnd != 0 {
- PostMessageW(wt_hwnd as HWND, WM_APP_WINTAB_FOCUS, 0, 0);
+ let app_msg = if should_raise {
+ WM_APP_WINTAB_FOCUS
+ } else {
+ WM_APP_WINTAB_BLUR
+ };
+ PostMessageW(wt_hwnd as HWND, app_msg, 0, 0);
}
}
DefSubclassProc(hwnd, msg, wparam, lparam)
@@ -1130,6 +1178,27 @@ mod win_impl {
}
rt.was_foreground = true;
});
+ } else if msg == WM_APP_WINTAB_BLUR {
+ WT_RT.with(|cell| {
+ let mut borrow = cell.borrow_mut();
+ let Some(rt) = borrow.as_mut() else { return };
+ rt.was_foreground = false;
+ if rt.contact.was_down {
+ rt.contact.reset();
+ send_samples(&[TabletSample {
+ client_x: 0.0,
+ client_y: 0.0,
+ pressure: 0.0,
+ tilt_x: 0.0,
+ tilt_y: 0.0,
+ twist: 0.0,
+ timestamp_ms: qpc_now_ms(),
+ buttons: 0,
+ phase: 3,
+ backend: 1,
+ }]);
+ }
+ });
} else if msg == WT_PACKET {
WT_RT.with(|cell| {
let mut borrow = cell.borrow_mut();
@@ -1863,6 +1932,42 @@ mod tests {
assert_eq!(d7.emit_phase, 3);
}
+ #[test]
+ fn test_ink_state_machine_ends_stroke_on_main_hwnd_leave_and_window_deactivation() {
+ let mut sm = InkStateMachine::default();
+ let main_hwnd: isize = 1000;
+ let child_hwnd: isize = 2000;
+ let pid: u32 = 77;
+
+ // 1. Start stroke on child HWND
+ let d1 = sm
+ .process_message(child_hwnd, main_hwnd, pid, 1, 10, true)
+ .expect("pen down should emit");
+ assert_eq!(d1.emit_phase, 1);
+
+ // 2. Single WM_POINTERLEAVE on main_hwnd while !in_contact MUST end stroke immediately
+ // (Windows only delivers one leave when stylus exits the app window).
+ let leave_end = sm
+ .process_message(main_hwnd, main_hwnd, pid, 4, 11, false)
+ .expect("main HWND leave with !in_contact must emit phase=3 immediately");
+ assert_eq!(leave_end.emit_phase, 3);
+
+ // 3. Subsequent pen down starts a brand-new stroke cleanly (phase=1, not stuck as phase=2)
+ let d2 = sm
+ .process_message(main_hwnd, main_hwnd, pid, 1, 20, true)
+ .expect("next pen down should emit phase=1");
+ assert_eq!(d2.emit_phase, 1);
+
+ // 4. Window deactivation force_end_all_active clears stuck contact so next down emits phase=1
+ assert!(sm.force_end_all_active());
+ assert!(!sm.force_end_all_active());
+
+ let d3 = sm
+ .process_message(main_hwnd, main_hwnd, pid, 1, 25, true)
+ .expect("pen down after deactivation reset must emit phase=1");
+ assert_eq!(d3.emit_phase, 1);
+ }
+
#[test]
fn test_wintab_contact_debounces_single_packet_pressure_dip() {
let mut wt = WintabContactState::default();
diff --git a/src/App.tsx b/src/App.tsx
index 60d1b81..e68f616 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,14 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
-import { AnimationTimeline, BlendMode, ExpressionColor, FilterType, LayerColorLabel, LayerItem, LayerTreeDelta } from './types/editor';
+import {
+ AnimationTimeline,
+ BlendMode,
+ DocumentStateDelta,
+ ExpressionColor,
+ FilterType,
+ LayerColorLabel,
+ LayerItem,
+ LayerTreeDelta,
+} from './types/editor';
import {
createDefaultAnimationTimeline,
removeFrameCel,
@@ -49,6 +58,46 @@ import {
import { GlobalShortcutListener } from './components/GlobalShortcutListener';
import { ModalHost } from './components/ModalHost';
import { AppShell } from './components/AppShell';
+import { t, tc } from './i18n';
+
+function cloneAnimationTimelineForHistory(
+ timeline: AnimationTimeline | null | undefined
+): AnimationTimeline | null {
+ if (!timeline) return null;
+ return {
+ ...timeline,
+ cels: { ...timeline.cels },
+ onionSkin: { ...timeline.onionSkin },
+ isPlaying: false,
+ };
+}
+
+function analyzeAnimationTimelineDiff(
+ before: AnimationTimeline | null,
+ after: AnimationTimeline | null
+): { changed: boolean; label: string; coalesceKey?: string } {
+ if (!before && !after) return { changed: false, label: '' };
+ if (!before && after) return { changed: true, label: t('Enable Animation Timeline') };
+ if (before && !after) return { changed: true, label: t('Disable Animation Timeline') };
+ if (!before || !after) return { changed: false, label: '' };
+
+ if (JSON.stringify(before.cels) !== JSON.stringify(after.cels)) {
+ return { changed: true, label: t('Update Animation Cels') };
+ }
+ if (
+ before.fps !== after.fps ||
+ before.totalFrames !== after.totalFrames ||
+ Boolean(before.loop) !== Boolean(after.loop) ||
+ JSON.stringify(before.onionSkin) !== JSON.stringify(after.onionSkin)
+ ) {
+ return {
+ changed: true,
+ label: t('Update Animation Timeline'),
+ coalesceKey: 'animation-timeline-settings',
+ };
+ }
+ return { changed: false, label: '' };
+}
export function App() {
const dimensions = useDocumentStore((s) => s.dimensions);
@@ -100,28 +149,62 @@ export function App() {
const activeAnimationTimeline =
activeDoc?.animation !== undefined ? activeDoc.animation : animationTimeline;
- const handleUpdateAnimationTimeline = useCallback(
- (timeline: AnimationTimeline | null) => {
+ const applyAnimationTimelineState = useCallback(
+ (timeline: AnimationTimeline | null, markDirty = true) => {
documentStoreActions.setAnimationTimeline(timeline);
- if (activeDocumentId) {
+ const docId = useDocumentStore.getState().activeDocumentId;
+ if (docId) {
documentStoreActions.setDocuments((docs) =>
docs.map((d) =>
- d.id === activeDocumentId ? { ...d, animation: timeline, isDirty: true } : d
+ d.id === docId
+ ? { ...d, animation: timeline, ...(markDirty ? { isDirty: true } : {}) }
+ : d
)
);
}
},
- [activeDocumentId]
+ []
+ );
+
+ const handleUpdateAnimationTimeline = useCallback(
+ (timeline: AnimationTimeline | null) => {
+ const beforeTl = activeAnimationTimeline ?? null;
+ const diff = analyzeAnimationTimelineDiff(beforeTl, timeline);
+ applyAnimationTimelineState(timeline, diff.changed);
+ if (diff.changed) {
+ pushHistoryStepRef.current?.(
+ 'animation',
+ diff.label,
+ null,
+ null,
+ layerMgr.activeLayerId || '',
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeAnimationTimeline: cloneAnimationTimelineForHistory(beforeTl),
+ afterAnimationTimeline: cloneAnimationTimelineForHistory(timeline),
+ ...(diff.coalesceKey ? { coalesceKey: diff.coalesceKey } : {}),
+ }
+ );
+ }
+ },
+ [activeAnimationTimeline, applyAnimationTimelineState, layerMgr.activeLayerId]
);
const handleAddAnimationCel = useCallback(
(frameIndex: number) => {
const beforeLayers = layerMgr.layers;
const beforeActiveLayerId = layerMgr.activeLayerId;
+ const beforeTl = activeAnimationTimeline ?? null;
const newLayerId = `layer-cel-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
const newCelLayer: LayerItem = {
id: newLayerId,
- name: `Cel Frame ${frameIndex + 1}`,
+ name: t('Cel Frame {n}', { n: frameIndex + 1 }),
type: 'raster',
visible: true,
opacity: 1,
@@ -136,9 +219,14 @@ export function App() {
const nextLayers = [newCelLayer, ...beforeLayers];
layerMgr.setLayers(nextLayers);
layerMgr.setActiveLayerId(newLayerId);
+
+ const currentTl = beforeTl || createDefaultAnimationTimeline(beforeLayers);
+ const nextTl = setFrameCel(currentTl, frameIndex, newLayerId);
+ applyAnimationTimelineState(nextTl, true);
+
pushHistoryStepRef.current?.(
- 'layer',
- `Add Cel Frame ${frameIndex + 1}`,
+ 'animation',
+ t('Add Cel Frame {n}', { n: frameIndex + 1 }),
null,
null,
newLayerId,
@@ -148,23 +236,45 @@ export function App() {
undefined,
undefined,
false,
- createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActiveLayerId, newLayerId)
+ createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActiveLayerId, newLayerId),
+ {
+ beforeAnimationTimeline: cloneAnimationTimelineForHistory(beforeTl),
+ afterAnimationTimeline: cloneAnimationTimelineForHistory(nextTl),
+ }
);
- const currentTl = activeAnimationTimeline || createDefaultAnimationTimeline(layerMgr.layers);
- handleUpdateAnimationTimeline(setFrameCel(currentTl, frameIndex, newLayerId));
- showToast(`Cel added for frame ${frameIndex + 1}`);
+ showToast(t('Cel added for frame {n}', { n: frameIndex + 1 }));
},
- [activeAnimationTimeline, activeTileGrid, handleUpdateAnimationTimeline, layerMgr, showToast]
+ [activeAnimationTimeline, activeTileGrid, applyAnimationTimelineState, layerMgr, showToast]
);
const handleDeleteAnimationCel = useCallback(
(frameIndex: number) => {
if (!activeAnimationTimeline) return;
- handleUpdateAnimationTimeline(removeFrameCel(activeAnimationTimeline, frameIndex));
- showToast(`Cel removed from frame ${frameIndex + 1}`);
+ const beforeTl = activeAnimationTimeline;
+ const nextTl = removeFrameCel(beforeTl, frameIndex);
+ applyAnimationTimelineState(nextTl, true);
+ pushHistoryStepRef.current?.(
+ 'animation',
+ t('Remove Cel Frame {n}', { n: frameIndex + 1 }),
+ null,
+ null,
+ layerMgr.activeLayerId || '',
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeAnimationTimeline: cloneAnimationTimelineForHistory(beforeTl),
+ afterAnimationTimeline: cloneAnimationTimelineForHistory(nextTl),
+ }
+ );
+ showToast(t('Cel removed from frame {n}', { n: frameIndex + 1 }));
},
- [activeAnimationTimeline, handleUpdateAnimationTimeline, showToast]
+ [activeAnimationTimeline, applyAnimationTimelineState, layerMgr.activeLayerId, showToast]
);
// Canvas Navigation
@@ -293,6 +403,103 @@ export function App() {
[]
);
+ // Auto-reset mask edit mode if active layer no longer has a mask (e.g. after creating/deleting
+ // layers or removing a mask) so drawing never silently no-ops waiting for a missing maskCanvas.
+ const effectiveIsMaskMode = activeEditTarget === 'mask' && Boolean(layerMgr.activeLayer?.maskCanvas);
+ useEffect(() => {
+ if (activeEditTarget === 'mask' && !layerMgr.activeLayer?.maskCanvas) {
+ documentStoreActions.setActiveEditTarget('layer');
+ }
+ }, [activeEditTarget, layerMgr.activeLayer]);
+
+ // Cancel transform session if all of its target layers were deleted.
+ useEffect(() => {
+ const ts = selectionTools.transformSession;
+ if (!ts?.active) return;
+ const targetIds = ts.layerIds && ts.layerIds.length > 0 ? ts.layerIds : [ts.layerId];
+ const hasAnyTarget = targetIds.some((id) => layerMgr.layers.some((l) => l.id === id));
+ if (!hasAnyTarget) {
+ selectionTools.handleCancelTransform();
+ }
+ }, [selectionTools.transformSession, selectionTools.handleCancelTransform, layerMgr.layers]);
+
+ const activeLayerIdForHistoryRef = useRef(layerMgr.activeLayerId);
+ activeLayerIdForHistoryRef.current = layerMgr.activeLayerId;
+
+ // Register ruler history recorder so perspective & straight ruler edits are undoable with Ctrl+Z
+ useEffect(() => {
+ documentStoreActions.setRulerHistoryRecorder((label, delta) => {
+ const docId = useDocumentStore.getState().activeDocumentId;
+ if (!docId) return;
+ pushHistoryStepRef.current?.(
+ 'ruler',
+ label,
+ null,
+ null,
+ activeLayerIdForHistoryRef.current || '',
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ delta
+ );
+ documentStoreActions.markDocumentDirty(docId, true);
+ });
+ return () => {
+ documentStoreActions.setRulerHistoryRecorder(null);
+ };
+ }, []);
+
+ const handleApplyDocumentStateDelta = useCallback(
+ (delta: DocumentStateDelta, direction: 'undo' | 'redo') => {
+ const activeId = useDocumentStore.getState().activeDocumentId;
+ if (delta.beforeDimensions !== undefined || delta.afterDimensions !== undefined) {
+ const targetDims = direction === 'undo' ? delta.beforeDimensions : delta.afterDimensions;
+ if (targetDims) {
+ documentStoreActions.setDimensions({ ...targetDims }, activeId);
+ nav.resetZoomAndCenter(targetDims);
+ }
+ }
+ if (delta.beforePerspectiveRuler !== undefined || delta.afterPerspectiveRuler !== undefined) {
+ const targetPersp =
+ direction === 'undo' ? delta.beforePerspectiveRuler : delta.afterPerspectiveRuler;
+ documentStoreActions.setPerspectiveRuler(
+ targetPersp
+ ? {
+ ...targetPersp,
+ grid: { ...targetPersp.grid },
+ vps: targetPersp.vps.map((vp) => ({ ...vp })),
+ }
+ : null,
+ { recordHistory: false }
+ );
+ }
+ if (delta.beforeStraightRuler !== undefined || delta.afterStraightRuler !== undefined) {
+ const targetStraight =
+ direction === 'undo' ? delta.beforeStraightRuler : delta.afterStraightRuler;
+ documentStoreActions.setStraightRuler(targetStraight ? { ...targetStraight } : null, {
+ recordHistory: false,
+ });
+ }
+ if (
+ delta.beforeAnimationTimeline !== undefined ||
+ delta.afterAnimationTimeline !== undefined
+ ) {
+ const targetTl =
+ direction === 'undo' ? delta.beforeAnimationTimeline : delta.afterAnimationTimeline;
+ applyAnimationTimelineState(cloneAnimationTimelineForHistory(targetTl ?? null), false);
+ }
+ if (delta.beforeSelection !== undefined || delta.afterSelection !== undefined) {
+ const targetSel = direction === 'undo' ? delta.beforeSelection : delta.afterSelection;
+ selectionTools.restoreSelectionFromHistory(targetSel ?? null);
+ }
+ },
+ [applyAnimationTimelineState, nav.resetZoomAndCenter, selectionTools.restoreSelectionFromHistory]
+ );
+
// Thin Canvas Drawing Dispatcher (reads tool & brushSettings from useToolStore without subscribing!)
const drawing = useCanvasDrawing({
dimensions,
@@ -303,6 +510,7 @@ export function App() {
nav.isPanning ||
nav.isRotating ||
nav.isZoomDragging ||
+ Boolean(selectionTools.transformSession?.active) ||
((collab.isConnected || collab.isReconnecting) && collab.myRole === 'viewer'),
viewportRef: nav.viewportRef,
pan: nav.pan,
@@ -323,7 +531,8 @@ export function App() {
layers: hasOpenDocument ? layerMgr.layers : [],
onUpdateLayerThumbnail: layerMgr.updateLayerThumbnail,
onApplyLayerTreeDelta: layerMgr.applyLayerTreeDelta,
- isMaskMode: activeEditTarget === 'mask',
+ onApplyDocumentStateDelta: handleApplyDocumentStateDelta,
+ isMaskMode: effectiveIsMaskMode,
onUpdateMaskThumbnail: layerMgr.updateMaskThumbnail,
draftCanvasRef,
strokeCanvasRef,
@@ -342,9 +551,23 @@ export function App() {
resetHistoryRef.current = drawing.resetHistory;
flushPendingHistoryTasksRef.current = drawing.flushPendingHistoryTasks;
+ // If the active layer switches mid-stroke (e.g. via shortcut or layer create/delete),
+ // cleanly abort the in-progress stroke so it cannot stall or commit to the wrong layer.
+ const prevStrokeLayerIdRef = useRef(layerMgr.activeLayerId);
+ const abortActiveBrushStroke = drawing.abortActiveStroke;
+ const brushIsDrawingRef = drawing.isDrawingRef;
+ useEffect(() => {
+ if (prevStrokeLayerIdRef.current !== layerMgr.activeLayerId) {
+ prevStrokeLayerIdRef.current = layerMgr.activeLayerId;
+ if (brushIsDrawingRef.current) {
+ abortActiveBrushStroke();
+ }
+ }
+ }, [layerMgr.activeLayerId, abortActiveBrushStroke, brushIsDrawingRef]);
+
const handleUndo = useCallback(() => {
if ((collab.isConnected || collab.isReconnecting) && collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
if (
@@ -381,7 +604,7 @@ export function App() {
const handleRedo = useCallback(() => {
if ((collab.isConnected || collab.isReconnecting) && collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
if (
@@ -540,6 +763,15 @@ export function App() {
showToast,
});
+ const clearSelectionWithoutHistory = useCallback(
+ () => selectionTools.handleDeselect(false),
+ [selectionTools.handleDeselect]
+ );
+ const getCurrentSelection = useCallback(
+ () => selectionTools.selection,
+ [selectionTools.selection]
+ );
+
// Document Lifecycle Operations
const docLifecycle = useDocumentLifecycle({
layers: layerMgr.layers,
@@ -556,7 +788,10 @@ export function App() {
resizeCanvas: layerMgr.resizeCanvas,
copyLayer: layerMgr.copyLayer,
pasteLayer: layerMgr.pasteLayer,
- onDeselectAfterPaste: selectionTools.handleDeselect,
+ onDeselectAfterPaste: clearSelectionWithoutHistory,
+ getSelection: getCurrentSelection,
+ clearSelectionWithoutHistory,
+ flushPendingHistoryTasks: drawing.flushPendingHistoryTasks,
deleteLayer: collab.handleDeleteLayer,
pasteLayerFromFile: layerMgr.pasteLayerFromFile,
resetZoomAndCenter: nav.resetZoomAndCenter,
@@ -574,7 +809,7 @@ export function App() {
layerMgr.setLayers(nextLayers);
pushHistoryStepRef.current?.(
'layer',
- 'Toggle Reference Layer',
+ t('Toggle Reference Layer'),
null,
null,
layerId,
@@ -605,12 +840,12 @@ export function App() {
(layerId: string): boolean => {
if (!collab.isConnected && !collab.isReconnecting) return true;
if (collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return false;
}
const perm = collab.canEditLayerById(layerId);
if (!perm.allowed) {
- showToast(perm.reason || 'Layer is locked by its owner');
+ showToast(perm.reason || t('Layer is locked by its owner'));
return false;
}
return true;
@@ -621,12 +856,12 @@ export function App() {
const handleMergeDown = useCallback(() => {
if (collab.isConnected || collab.isReconnecting) {
if (collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
const delPerm = collab.canDeleteLayerById(layerMgr.activeLayerId);
if (!delPerm.allowed) {
- showToast(delPerm.reason || 'Cannot merge a protected layer');
+ showToast(delPerm.reason || t('Cannot merge a protected layer'));
return;
}
const activeIdx = layerMgr.layers.findIndex((l) => l.id === layerMgr.activeLayerId);
@@ -634,7 +869,7 @@ export function App() {
if (belowLayer) {
const belowPerm = collab.canEditLayerById(belowLayer.id);
if (!belowPerm.allowed) {
- showToast(belowPerm.reason || 'Target layer below is locked by its owner');
+ showToast(belowPerm.reason || t('Target layer below is locked by its owner'));
return;
}
}
@@ -642,10 +877,10 @@ export function App() {
const res = layerMgr.mergeDown();
if (res) {
documentStoreActions.markDocumentDirty(activeDocumentId, true);
- autoActionStoreActions.recordStep('merge-down', 'Merge Down');
- showToast('Merged layer down');
+ autoActionStoreActions.recordStep('merge-down', t('Merge Down'));
+ showToast(t('Merged layer down'));
} else {
- showToast('Cannot merge down: need an unlocked raster layer below');
+ showToast(t('Cannot merge down: need an unlocked raster layer below'));
}
}, [
collab.isConnected,
@@ -671,10 +906,10 @@ export function App() {
const res = layerMgr.mergeFolder(folderId);
if (res) {
documentStoreActions.markDocumentDirty(activeDocumentId, true);
- autoActionStoreActions.recordStep('merge-folder', 'Merge Folder');
- showToast('Merged folder into layer');
+ autoActionStoreActions.recordStep('merge-folder', t('Merge Folder'));
+ showToast(t('Merged folder into layer'));
} else {
- showToast('Cannot merge folder: select an unlocked folder');
+ showToast(t('Cannot merge folder: select an unlocked folder'));
}
},
[layerMgr.mergeFolder, activeDocumentId, selectionTools, showToast]
@@ -687,7 +922,7 @@ export function App() {
const { folder, layerTreeDelta } = layerMgr.createFrameFolder([defaultFrame], undefined, true);
drawing.pushHistoryStep(
'frame',
- 'New Frame Border Folder',
+ t('New Frame Border Folder'),
null,
null,
folder.id,
@@ -699,18 +934,18 @@ export function App() {
undefined,
layerTreeDelta
);
- autoActionStoreActions.recordStep('create-frame-folder', 'New Frame Border Folder');
- showToast('Created Frame Border Folder');
+ autoActionStoreActions.recordStep('create-frame-folder', t('New Frame Border Folder'));
+ showToast(t('Created Frame Border Folder'));
}, [dimensions, layerMgr.createFrameFolder, drawing.flushPendingHistoryTasks, drawing.pushHistoryStep, showToast]);
const handleRasterizeLayer = useCallback(
(layerId: string) => {
const ok = layerMgr.rasterizeLayer(layerId);
if (ok) {
- autoActionStoreActions.recordStep('rasterize-layer', 'Rasterize Layer');
- showToast('Layer rasterized');
+ autoActionStoreActions.recordStep('rasterize-layer', t('Rasterize Layer'));
+ showToast(t('Layer rasterized'));
} else {
- showToast('Only Text, Speech Balloon, or Vector layers can be rasterized');
+ showToast(t('Only Text, Speech Balloon, or Vector layers can be rasterized'));
}
},
[layerMgr.rasterizeLayer, showToast]
@@ -722,7 +957,7 @@ export function App() {
collab.handleAddLayer(type);
autoActionStoreActions.recordStep(
type === 'folder' ? 'create-folder' : 'create-layer',
- type === 'folder' ? 'Create Folder' : 'Create Layer'
+ type === 'folder' ? t('Create Folder') : t('Create Layer')
);
},
[collab.handleAddLayer]
@@ -731,11 +966,11 @@ export function App() {
const handleRecordedDuplicateLayer = useCallback(
(id: string) => {
if ((collab.isConnected || collab.isReconnecting) && collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
layerMgr.duplicateLayer(id);
- autoActionStoreActions.recordStep('duplicate-layer', 'Duplicate Layer');
+ autoActionStoreActions.recordStep('duplicate-layer', t('Duplicate Layer'));
},
[collab.isConnected, collab.isReconnecting, collab.myRole, layerMgr.duplicateLayer, showToast]
);
@@ -744,7 +979,11 @@ export function App() {
(id: string, blendMode: BlendMode) => {
if (!checkCollabLayerEdit(id)) return;
layerMgr.setBlendMode(id, blendMode);
- autoActionStoreActions.recordStep('set-blend-mode', `Blend Mode: ${blendMode}`, { blendMode });
+ autoActionStoreActions.recordStep(
+ 'set-blend-mode',
+ t('Blend Mode: {mode}', { mode: tc('blendModeId', blendMode) }),
+ { blendMode }
+ );
},
[checkCollabLayerEdit, layerMgr.setBlendMode]
);
@@ -752,9 +991,13 @@ export function App() {
const handleRecordedSetOpacity = useCallback(
(id: string, opacity: number) => {
collab.handleSetOpacity(id, opacity);
- autoActionStoreActions.recordStep('set-opacity', `Opacity: ${Math.round(opacity * 100)}%`, {
- opacity,
- });
+ autoActionStoreActions.recordStep(
+ 'set-opacity',
+ t('Opacity: {percent}%', { percent: Math.round(opacity * 100) }),
+ {
+ opacity,
+ }
+ );
},
[collab.handleSetOpacity]
);
@@ -763,7 +1006,7 @@ export function App() {
(id: string) => {
if (!checkCollabLayerEdit(id)) return;
layerMgr.toggleClipping(id);
- autoActionStoreActions.recordStep('toggle-clipping', 'Toggle Clipping Mask');
+ autoActionStoreActions.recordStep('toggle-clipping', t('Toggle Clipping Mask'));
},
[checkCollabLayerEdit, layerMgr.toggleClipping]
);
@@ -859,10 +1102,14 @@ export function App() {
const handleRecordedApplyFilter = useCallback(
(type: FilterType, params?: import('./hooks/useTonalAndFilterActions').AnyFilterParams) => {
tonalActions.handleApplyFilter(type, params);
- autoActionStoreActions.recordStep('apply-filter', `Filter: ${type}`, {
- filterType: type,
- ...(params || {}),
- });
+ autoActionStoreActions.recordStep(
+ 'apply-filter',
+ t('Filter: {type}', { type: tc('filterId', type) }),
+ {
+ filterType: type,
+ ...(params || {}),
+ }
+ );
},
[tonalActions.handleApplyFilter]
);
@@ -870,7 +1117,11 @@ export function App() {
const handleRecordedSetExpressionColor = useCallback(
(id: string, mode: ExpressionColor) => {
layerMgr.setLayerExpressionColor(id, mode);
- autoActionStoreActions.recordStep('set-expression-color', `Expression Color: ${mode}`, { mode });
+ autoActionStoreActions.recordStep(
+ 'set-expression-color',
+ t('Expression Color: {mode}', { mode: tc('expressionColorId', mode) }),
+ { mode }
+ );
},
[layerMgr.setLayerExpressionColor]
);
@@ -1038,9 +1289,19 @@ export function App() {
try {
const res = await executeAutoAction(action, ctx);
if (res.errors.length > 0) {
- showToast(`Auto Action "${action.name}" finished with ${res.errors.length} error(s)`);
+ showToast(
+ t('Auto Action "{name}" finished with {count} error(s)', {
+ name: action.name,
+ count: res.errors.length,
+ })
+ );
} else {
- showToast(`Played "${action.name}" (${res.executedSteps} steps)`);
+ showToast(
+ t('Played "{name}" ({count} steps)', {
+ name: action.name,
+ count: res.executedSteps,
+ })
+ );
}
} finally {
autoActionStoreActions.setIsPlaying(false);
@@ -1112,9 +1373,9 @@ export function App() {
getTimelapseCaptureContext()
)
.catch(() => {});
- showToast('Time-lapse recording started (saved locally)');
+ showToast(t('Time-lapse recording started (saved locally)'));
} else {
- showToast('Time-lapse recording paused');
+ showToast(t('Time-lapse recording paused'));
}
}, [
activeDocumentId,
@@ -1139,7 +1400,8 @@ export function App() {
prev.docId === activeDocumentId &&
currentItemId &&
currentItemId !== prev.itemId &&
- drawing.historyIndex > 0
+ drawing.historyIndex > 0 &&
+ currentItem?.type !== 'selection'
) {
documentStoreActions.markDocumentDirty(activeDocumentId, true);
if (globalTimelapseManager.isRecording(activeDocumentId)) {
@@ -1170,18 +1432,23 @@ export function App() {
const handlePointerDown = useCallback(
(e: React.PointerEvent<HTMLElement>, coalescedEvents?: PointerEvent[]) => {
if (!hasOpenDocument || e.button !== 0) return;
- if (selectionTools.transformSession?.active) return;
const tool = useToolStore.getState().tool;
+ if (selectionTools.transformSession?.active) {
+ if (tool === 'brush' || tool === 'decoration' || tool === 'eraser') {
+ showToast(t('Transform active — press Enter to apply or Esc / Ctrl+Z to cancel'));
+ }
+ return;
+ }
// Collaborative role & owner-lock guard on canvas mutations
if ((collab.isConnected || collab.isReconnecting) && tool !== 'pipette') {
if (collab.myRole === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
const editPerm = collab.canEditLayerById(layerMgr.activeLayerId);
if (!editPerm.allowed) {
- showToast(editPerm.reason || 'Layer is locked by its owner');
+ showToast(editPerm.reason || t('Layer is locked by its owner'));
return;
}
}
@@ -1189,11 +1456,11 @@ export function App() {
if (tool === 'brush' || tool === 'decoration' || tool === 'eraser') {
const curLayer = layerMgr.activeLayer;
if (curLayer?.type === 'text' || curLayer?.type === 'balloon') {
- showToast('Use Text/Object tool to edit, or Rasterize Layer to paint directly');
+ showToast(t('Use Text/Object tool to edit, or Rasterize Layer to paint directly'));
return;
}
if (curLayer?.type === 'frame-folder') {
- showToast('Select a child layer inside the Frame Border Folder to draw');
+ showToast(t('Select a child layer inside the Frame Border Folder to draw'));
return;
}
if (selectionTools.selection?.floating) {
@@ -1255,6 +1522,10 @@ export function App() {
coalescedEvents?: PointerEvent[],
predictedEvents?: PointerEvent[]
) => {
+ if (drawing.isDrawingRef.current) {
+ drawing.handlePointerMove(e, coalescedEvents, predictedEvents);
+ return;
+ }
const tool = useToolStore.getState().tool;
if (tool === 'brush' || tool === 'decoration' || tool === 'eraser') {
drawing.handlePointerMove(e, coalescedEvents, predictedEvents);
@@ -1284,6 +1555,12 @@ export function App() {
const handlePointerUp = useCallback(
(e: React.PointerEvent<HTMLElement>) => {
+ // Always finalize an active brush stroke even if tool changed mid-stroke (e.g. modifier/shortcut)
+ // so drawing.isDrawingRef can never be left stranded true.
+ if (drawing.isDrawingRef.current) {
+ drawing.handlePointerUp(e);
+ return;
+ }
const tool = useToolStore.getState().tool;
if (tool === 'brush' || tool === 'decoration' || tool === 'eraser') {
drawing.handlePointerUp(e);
@@ -1621,7 +1898,7 @@ export function App() {
} else {
uiStoreActions.set3DLayerOpen(true, file);
}
- showToast(`Imported 3D model "${file.name}"`);
+ showToast(t('Imported 3D model "{name}"', { name: file.name }));
},
[showToast]
);
diff --git a/src/components/AboutModal.tsx b/src/components/AboutModal.tsx
index 731b533..234a545 100644
--- a/src/components/AboutModal.tsx
+++ b/src/components/AboutModal.tsx
@@ -22,6 +22,7 @@ import {
import { getChangelogForVersion } from '../utils/changelog';
import { ChangelogBox } from './ChangelogBox';
import { COMMUNITY_LINKS } from './SocialIcons';
+import { isImeComposing, useI18n } from '../i18n';
export interface AboutModalProps {
isOpen: boolean;
@@ -34,6 +35,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
onClose,
showToast,
}) => {
+ const { t, td } = useI18n();
const isDesktopTauri = isTauriEnvironment();
const runtimeAppVersion = useUpdaterStore((s) => s.currentVersion);
const chromeStyle: ChromeStyle = useUiStore(
@@ -54,6 +56,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
}
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
onClose();
@@ -76,16 +79,17 @@ export const AboutModal: React.FC<AboutModalProps> = ({
const version = runtimeAppVersion || APP_VERSION;
const changelogEntry = getChangelogForVersion(version) ?? getChangelogForVersion();
- const envLabel = isDesktopTauri ? 'Desktop' : 'Web';
- const buildInfo = `Ink Studio v${version} (${envLabel})`;
+ const rawEnvLabel = isDesktopTauri ? 'Desktop' : 'Web';
+ const envLabel = t(rawEnvLabel);
+ const buildInfo = `Ink Studio v${version} (${rawEnvLabel})`;
const handleCopyVersion = async () => {
try {
await navigator.clipboard.writeText(buildInfo);
setCopied(true);
- showToast?.('Copied version info');
+ showToast?.(t('Copied version info'));
} catch {
- showToast?.('Failed to copy version info');
+ showToast?.(t('Failed to copy version info'));
}
};
@@ -124,15 +128,15 @@ export const AboutModal: React.FC<AboutModalProps> = ({
<div className="flex items-center gap-2">
<Info className="w-3.5 h-3.5 text-ui-accent" />
<span id="about-modal-title" className="text-xs font-medium text-ui-primary">
- About Ink Studio
+ {t('About Ink Studio')}
</span>
</div>
<button
type="button"
onClick={onClose}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Close (Esc)"
- aria-label="Close about dialog"
+ title={t('Close (Esc)')}
+ aria-label={t('Close about dialog')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -157,7 +161,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
</span>
</div>
<p className="text-[11px] text-ui-muted mt-0.5">
- Drawing software that doesn&apos;t charge you rent.
+ {t("Drawing software that doesn't charge you rent.")}
</p>
</div>
</div>
@@ -165,20 +169,17 @@ export const AboutModal: React.FC<AboutModalProps> = ({
{/* Description */}
<div className="space-y-2 text-[11px] text-ui-secondary leading-relaxed select-text">
<p>
- Built by Sora because paying a monthly subscription just to draw lines on a screen
- got old. It opens PSD and CSP files, loads .sut brushes, handles layers, manga tools,
- and multiplayer, and mostly behaves itself when you aren&apos;t looking.
+ {t("Built by Sora because paying a monthly subscription just to draw lines on a screen got old. It opens PSD and CSP files, loads .sut brushes, handles layers, manga tools, and multiplayer, and mostly behaves itself when you aren't looking.")}
</p>
<p className="text-ui-muted">
- No accounts, no telemetry, no forced AI slop, no cloud launcher eating your RAM. Hit
- Ctrl+S anyway. All software is held together by spite and duct tape.
+ {t('No accounts, no telemetry, no forced AI slop, no cloud launcher eating your RAM. Hit Ctrl+S anyway. All software is held together by spite and duct tape.')}
</p>
</div>
{/* Build metadata */}
<div className="bg-ui-header rounded-ui-md border border-ui-subtle divide-y divide-ui-subtle text-[11px]">
<div className="px-3 py-2 flex items-center justify-between gap-2">
- <span className="text-ui-muted">Build</span>
+ <span className="text-ui-muted">{t('Build')}</span>
<div className="flex items-center gap-2">
<span className="font-ui-mono tabular-nums text-ui-primary select-text">
v{version} · {envLabel}
@@ -187,17 +188,17 @@ export const AboutModal: React.FC<AboutModalProps> = ({
type="button"
onClick={() => void handleCopyVersion()}
className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
- title="Copy version info"
+ title={t('Copy version info')}
>
{copied ? (
<>
<Check className="w-3 h-3 text-ui-success" />
- <span className="text-ui-success">Copied</span>
+ <span className="text-ui-success">{t('Copied')}</span>
</>
) : (
<>
<Copy className="w-3 h-3" />
- <span>Copy</span>
+ <span>{t('Copy')}</span>
</>
)}
</button>
@@ -205,7 +206,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
</div>
<div className="px-3 py-2 flex items-center justify-between gap-2">
- <span className="text-ui-muted">License</span>
+ <span className="text-ui-muted">{t('License')}</span>
<button
type="button"
onClick={() => void openExternalUrl(GITHUB_LICENSE_URL)}
@@ -217,7 +218,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
</div>
<div className="px-3 py-2 flex items-center justify-between gap-2">
- <span className="text-ui-muted">Stack</span>
+ <span className="text-ui-muted">{t('Stack')}</span>
<span className="font-ui-mono text-ui-secondary">
{isDesktopTauri ? 'Tauri · Rust · React · WebGL' : 'React · TypeScript · WebGL'}
</span>
@@ -229,7 +230,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<span className="text-[11px] font-medium text-ui-primary tabular-nums">
- What&apos;s New in v{changelogEntry.version}
+ {t("What's New in v{version}", { version: changelogEntry.version })}
</span>
</div>
<ChangelogBox entry={changelogEntry} maxHeightClass="max-h-40" />
@@ -248,7 +249,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
target="_blank"
rel="noopener noreferrer"
data-testid={`about-link-${link.id}`}
- title={link.title}
+ title={td(link.title)}
onClick={(e) => {
e.preventDefault();
void openExternalUrl(link.url);
@@ -256,7 +257,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
className={linkButtonChrome}
>
{link.renderIcon('w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors shrink-0')}
- <span>{link.label}</span>
+ <span>{td(link.label)}</span>
</a>
))}
@@ -265,7 +266,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
target="_blank"
rel="noopener noreferrer"
data-testid="about-link-issues"
- title="Report a bug or request a feature on GitHub"
+ title={t('Report a bug or request a feature on GitHub')}
onClick={(e) => {
e.preventDefault();
void openExternalUrl(GITHUB_ISSUES_URL);
@@ -273,7 +274,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
className={linkButtonChrome}
>
<Bug className="w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors shrink-0" />
- <span>Report a Bug</span>
+ <span>{t('Report a Bug')}</span>
</a>
{isDesktopTauri && (
@@ -283,7 +284,7 @@ export const AboutModal: React.FC<AboutModalProps> = ({
className={linkButtonChrome}
>
<RefreshCw className="w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors shrink-0" />
- <span>Updates</span>
+ <span>{t('Updates')}</span>
</button>
)}
</div>
@@ -292,14 +293,14 @@ export const AboutModal: React.FC<AboutModalProps> = ({
{/* Footer */}
<div className="px-4 py-2.5 bg-ui-header flex items-center justify-between gap-3 border-t border-ui-subtle">
<span className="text-[10px] text-ui-muted">
- © 2026 Sora · Provided as-is, no warranty.
+ {t('© 2026 Sora · Provided as-is, no warranty.')}
</span>
<button
type="button"
onClick={onClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium transition-opacity cursor-pointer"
>
- Close
+ {t('Close')}
</button>
</div>
</div>
diff --git a/src/components/AdjustmentModal.tsx b/src/components/AdjustmentModal.tsx
index 8fc0b1b..b8be4fc 100644
--- a/src/components/AdjustmentModal.tsx
+++ b/src/components/AdjustmentModal.tsx
@@ -14,6 +14,7 @@ import {
computeHistogram,
buildGradientMapLut,
} from '../utils/tonalEngine';
+import { isImeComposing, useI18n } from '../i18n';
export interface AdjustmentModalProps {
isOpen: boolean;
@@ -108,6 +109,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
onPreviewChange,
histogramImageData,
}) => {
+ const { t, tc, td } = useI18n();
const [activeTab, setActiveTab] = useState<'curves' | 'gradient-map' | 'levels' | 'color-balance'>(initialType);
const [previewEnabled, setPreviewEnabled] = useState(true);
@@ -438,6 +440,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -468,13 +471,13 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Header */}
<div className="h-10 flex items-center justify-between px-4 border-b border-ui-subtle bg-ui-header">
<span id="adjustment-modal-title" className="font-medium text-ui-primary text-xs">
- {editingLayerId ? 'Edit Adjustment Layer' : 'New Adjustment Layer'}
+ {editingLayerId ? t('Edit Adjustment Layer') : t('New Adjustment Layer')}
</span>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={tc('action', 'Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 flex items-center justify-center text-ui-muted hover:text-ui-primary rounded-ui-sm hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -492,7 +495,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- Tone Curves
+ {t('Tone Curves')}
</button>
<button
type="button"
@@ -503,7 +506,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- Gradient Map
+ {t('Gradient Map')}
</button>
<button
type="button"
@@ -514,7 +517,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- Levels
+ {t('Levels')}
</button>
<button
type="button"
@@ -525,7 +528,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- Color Balance
+ {t('Color Balance')}
</button>
</div>
@@ -536,7 +539,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
<div className="space-y-3">
{/* Channel Selector */}
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-muted">Channel:</span>
+ <span className="text-xs text-ui-muted">{t('Channel:')}</span>
<div className="flex bg-ui-input rounded-ui-sm p-0.5 border border-ui-subtle gap-0.5">
{(['rgb', 'r', 'g', 'b'] as const).map((ch) => (
<button
@@ -637,8 +640,11 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
<div className="flex items-center space-x-2">
<span className="text-ui-muted font-ui-mono tabular-nums">
{selectedPointIdx !== null
- ? `In: ${currentPts[selectedPointIdx][0]} Out: ${currentPts[selectedPointIdx][1]}`
- : 'Click curve to add points'}
+ ? t('In: {inVal} Out: {outVal}', {
+ inVal: currentPts[selectedPointIdx][0],
+ outVal: currentPts[selectedPointIdx][1],
+ })
+ : t('Click curve to add points')}
</span>
</div>
{selectedPointIdx !== null && selectedPointIdx > 0 && selectedPointIdx < currentPts.length - 1 && (
@@ -648,7 +654,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
className="flex items-center space-x-1 px-2 py-0.5 bg-ui-danger/15 text-ui-danger hover:bg-ui-danger/25 rounded-ui-xs border border-ui-danger/40 cursor-pointer transition-colors"
>
<Trash2 className="w-3 h-3" />
- <span>Delete Point</span>
+ <span>{t('Delete Point')}</span>
</button>
)}
</div>
@@ -661,9 +667,9 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Gradient Preview Bar */}
<div className="space-y-1.5">
<div className="flex items-center justify-between text-xs">
- <span className="text-ui-muted">Color Ramp (Click to add stop):</span>
+ <span className="text-ui-muted">{t('Color Ramp (Click to add stop):')}</span>
<div className="flex items-center space-x-1 text-[11px]">
- <span className="text-ui-muted">Blend:</span>
+ <span className="text-ui-muted">{t('Blend:')}</span>
<button
type="button"
onClick={() => setGradientInterpolation('linear')}
@@ -673,7 +679,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Linear
+ {t('Linear')}
</button>
<button
type="button"
@@ -684,7 +690,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Smooth
+ {t('Smooth')}
</button>
</div>
</div>
@@ -710,7 +716,11 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
onPointerUp={handleStopPointerUp}
style={{ left: `${stop.position * 100}%` }}
className="absolute -bottom-3.5 -translate-x-1/2 w-4 h-5 flex flex-col items-center cursor-ew-resize z-20 group"
- title={`Stop ${idx + 1}: ${stop.color} (${Math.round(stop.position * 100)}%)`}
+ title={t('Stop {index}: {color} ({percent}%)', {
+ index: idx + 1,
+ color: stop.color,
+ percent: Math.round(stop.position * 100),
+ })}
>
<div
className={`w-0 h-0 border-l-[4px] border-l-transparent border-r-[4px] border-r-transparent border-b-[5px] ${
@@ -733,7 +743,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
<div className="flex items-center justify-between p-2.5 bg-ui-header rounded-ui-md border border-ui-subtle mt-4">
<div className="flex items-center space-x-3">
<div className="flex items-center space-x-1.5">
- <span className="text-ui-muted">Color:</span>
+ <span className="text-ui-muted">{t('Color:')}</span>
<input
type="color"
value={gradientStops[selectedStopIdx]?.color || '#ffffff'}
@@ -762,7 +772,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
/>
</div>
<div className="flex items-center space-x-1">
- <span className="text-ui-muted">Pos:</span>
+ <span className="text-ui-muted">{t('Pos:')}</span>
<span className="text-ui-primary font-ui-mono tabular-nums">
{Math.round((gradientStops[selectedStopIdx]?.position || 0) * 100)}%
</span>
@@ -774,7 +784,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
type="button"
onClick={deleteSelectedStop}
className="p-1 text-ui-muted hover:text-ui-danger hover:bg-ui-danger/15 rounded-ui-xs cursor-pointer transition-colors"
- title="Delete Stop"
+ title={t('Delete Stop')}
>
<Trash2 className="w-3.5 h-3.5" />
</button>
@@ -783,7 +793,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Preset Ramps */}
<div className="space-y-1.5">
- <span className="text-ui-muted text-[11px]">Presets:</span>
+ <span className="text-ui-muted text-[11px]">{t('Presets:')}</span>
<div className="grid grid-cols-3 gap-1.5">
{GRADIENT_PRESETS.map((p) => (
<button
@@ -804,7 +814,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
.join(', ')})`,
}}
/>
- <span className="text-[11px] text-ui-primary truncate">{p.name}</span>
+ <span className="text-[11px] text-ui-primary truncate">{td(p.name)}</span>
</button>
))}
</div>
@@ -816,7 +826,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{activeTab === 'levels' && (
<div className="space-y-3.5">
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-muted">Channel:</span>
+ <span className="text-xs text-ui-muted">{t('Channel:')}</span>
<div className="flex bg-ui-input rounded-ui-sm p-0.5 border border-ui-subtle gap-0.5">
{(['rgb', 'r', 'g', 'b'] as const).map((ch) => (
<button
@@ -838,7 +848,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Input Black Point Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-ui-muted">Shadows (Black Point):</span>
+ <span className="text-ui-muted">{t('Shadows (Black Point):')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{levels.blackPoint}</span>
</div>
<input
@@ -854,7 +864,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Gamma Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-ui-muted">Midtones (Gamma):</span>
+ <span className="text-ui-muted">{t('Midtones (Gamma):')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{levels.gamma.toFixed(2)}</span>
</div>
<input
@@ -871,7 +881,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Input White Point Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-ui-muted">Highlights (White Point):</span>
+ <span className="text-ui-muted">{t('Highlights (White Point):')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{levels.whitePoint}</span>
</div>
<input
@@ -888,7 +898,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
<div className="grid grid-cols-2 gap-3 pt-2 border-t border-ui-subtle">
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-ui-muted">Out Min:</span>
+ <span className="text-ui-muted">{t('Out Min:')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{levels.outputMin}</span>
</div>
<input
@@ -902,7 +912,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
</div>
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-ui-muted">Out Max:</span>
+ <span className="text-ui-muted">{t('Out Max:')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{levels.outputMax}</span>
</div>
<input
@@ -934,7 +944,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {r}
+ {tc('tonalRange', r)}
</button>
))}
</div>
@@ -942,9 +952,9 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Cyan - Red Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-cyan-500">Cyan</span>
+ <span className="text-cyan-500">{t('Cyan')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{colorBalance[cbRange][0]}</span>
- <span className="text-red-500">Red</span>
+ <span className="text-red-500">{t('Red')}</span>
</div>
<input
type="range"
@@ -966,9 +976,9 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Magenta - Green Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-fuchsia-500">Magenta</span>
+ <span className="text-fuchsia-500">{t('Magenta')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{colorBalance[cbRange][1]}</span>
- <span className="text-green-500">Green</span>
+ <span className="text-green-500">{t('Green')}</span>
</div>
<input
type="range"
@@ -990,9 +1000,9 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
{/* Yellow - Blue Slider */}
<div className="space-y-1">
<div className="flex justify-between text-xs">
- <span className="text-amber-500">Yellow</span>
+ <span className="text-amber-500">{t('Yellow')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{colorBalance[cbRange][2]}</span>
- <span className="text-blue-500">Blue</span>
+ <span className="text-blue-500">{t('Blue')}</span>
</div>
<input
type="range"
@@ -1018,7 +1028,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
checked={colorBalance.preserveLuminosity}
onChange={(e) => setColorBalance((prev) => ({ ...prev, preserveLuminosity: e.target.checked }))}
/>
- <span>Preserve Luminosity</span>
+ <span>{t('Preserve Luminosity')}</span>
</label>
</div>
)}
@@ -1032,7 +1042,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
onClick={handleResetCurrent}
className="px-2.5 py-1 text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-sm transition-colors cursor-pointer"
>
- Reset
+ {t('Reset')}
</button>
<label className="flex items-center space-x-1.5 text-xs text-ui-secondary cursor-pointer">
<input
@@ -1040,7 +1050,7 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
checked={previewEnabled}
onChange={(e) => setPreviewEnabled(e.target.checked)}
/>
- <span>Preview</span>
+ <span>{t('Preview')}</span>
</label>
</div>
@@ -1050,14 +1060,14 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 text-xs font-medium text-ui-primary bg-ui-control hover:bg-ui-control-hover border border-ui-default rounded-ui-sm transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
onClick={handleApply}
className="px-4 py-1.5 text-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium rounded-ui-sm transition-opacity cursor-pointer"
>
- {editingLayerId ? 'Update' : 'Create Layer'}
+ {editingLayerId ? t('Update') : t('Create Layer')}
</button>
</div>
</div>
diff --git a/src/components/AnimationTimeline.tsx b/src/components/AnimationTimeline.tsx
index fb43c2a..144da42 100644
--- a/src/components/AnimationTimeline.tsx
+++ b/src/components/AnimationTimeline.tsx
@@ -18,6 +18,7 @@ import {
exportAnimationToPngZip,
saveAnimationBlob,
} from '../utils/animationEngine';
+import { isImeComposing, useI18n } from '../i18n';
export interface AnimationTimelineProps {
timeline: TimelineData;
@@ -42,6 +43,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
onSelectCelLayer,
onClose,
}) => {
+ const { t } = useI18n();
const [isPlaying, setIsPlaying] = useState<boolean>(false);
const [showOnionSettings, setShowOnionSettings] = useState<boolean>(false);
const [showExportModal, setShowExportModal] = useState<boolean>(false);
@@ -137,6 +139,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
// Keyboard navigation shortcuts (Alt+Space anywhere, or Space when timeline has focus, avoiding canvas Space-pan collision)
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
const target = e.target as HTMLElement | null;
if (
target instanceof HTMLInputElement ||
@@ -184,11 +187,11 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
// Export Action
const handleExport = async () => {
setIsExporting(true);
- setExportProgress('Encoding frames...');
+ setExportProgress(t('Encoding frames...'));
try {
const onProgress = (current: number, total: number) => {
- setExportProgress(`Rendering ${current}/${total}...`);
+ setExportProgress(t('Rendering {current}/{total}...', { current, total }));
};
let blob: Blob;
@@ -240,7 +243,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
type="button"
onClick={() => onChangeTimeline({ ...timeline, currentFrame: 0 })}
className="p-1 hover:bg-ui-control-hover rounded-ui-xs text-ui-icon-muted hover:text-ui-primary transition-colors cursor-pointer"
- title="First Frame (Home)"
+ title={t('First Frame (Home)')}
>
<RotateCcw className="w-3.5 h-3.5" />
</button>
@@ -253,7 +256,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
})
}
className="p-1 hover:bg-ui-control-hover rounded-ui-xs text-ui-icon-muted hover:text-ui-primary transition-colors cursor-pointer"
- title="Previous Frame (Left Arrow)"
+ title={t('Previous Frame (Left Arrow)')}
>
<ChevronLeft className="w-4 h-4" />
</button>
@@ -265,10 +268,10 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
? 'bg-ui-control-active text-ui-accent ring-1 ring-ui-accent-border'
: 'bg-ui-accent text-ui-accent-contrast hover:opacity-90'
}`}
- title="Play / Pause (Alt+Space)"
+ title={t('Play / Pause (Alt+Space)')}
>
{isPlaying ? <Pause className="w-3.5 h-3.5" /> : <Play className="w-3.5 h-3.5" />}
- <span className="text-[11px] font-medium">{isPlaying ? 'Pause' : 'Play'}</span>
+ <span className="text-[11px] font-medium">{isPlaying ? t('Pause') : t('Play')}</span>
</button>
<button
type="button"
@@ -279,7 +282,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
})
}
className="p-1 hover:bg-ui-control-hover rounded-ui-xs text-ui-icon-muted hover:text-ui-primary transition-colors cursor-pointer"
- title="Next Frame (Right Arrow)"
+ title={t('Next Frame (Right Arrow)')}
>
<ChevronRight className="w-4 h-4" />
</button>
@@ -293,9 +296,9 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-ui-accent-border'
: 'bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
- title="Loop Playback"
+ title={t('Loop Playback')}
>
- Loop
+ {t('Loop')}
</button>
{/* Frame Rate FPS Selector */}
@@ -332,9 +335,9 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
type="button"
onClick={() => onAddCel(timeline.currentFrame)}
className="px-2.5 py-1 bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary rounded-ui-sm text-[11px] font-medium transition-colors cursor-pointer"
- title="Add Cel for Current Frame"
+ title={t('Add Cel for Current Frame')}
>
- + Add Cel
+ {t('+ Add Cel')}
</button>
{/* Delete Cel Button */}
@@ -343,7 +346,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
type="button"
onClick={() => onDeleteCel(timeline.currentFrame)}
className="p-1 hover:bg-ui-danger/15 text-ui-icon-muted hover:text-ui-danger rounded-ui-xs transition-colors cursor-pointer"
- title="Delete Cel from Current Frame"
+ title={t('Delete Cel from Current Frame')}
>
<Trash2 className="w-3.5 h-3.5" />
</button>
@@ -359,15 +362,15 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-ui-accent-border'
: 'bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
- title="Configure Colored Onion Skinning"
+ title={t('Configure Colored Onion Skinning')}
>
- Onion Skin
+ {t('Onion Skin')}
</button>
{showOnionSettings && (
<div className="absolute bottom-full mb-2 right-0 bg-ui-elevated border border-ui-default rounded-ui-md p-3 shadow-ui-popover z-50 flex flex-col space-y-2.5 w-64">
<div className="flex items-center justify-between">
- <span className="font-medium text-ui-primary text-xs">Onion Skin</span>
+ <span className="font-medium text-ui-primary text-xs">{t('Onion Skin')}</span>
<label className="flex items-center space-x-1.5 cursor-pointer">
<input
type="checkbox"
@@ -382,13 +385,15 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
})
}
/>
- <span className="text-[10px] text-ui-muted">Enabled</span>
+ <span className="text-[10px] text-ui-muted">{t('Enabled')}</span>
</label>
</div>
{/* Prior Frames Settings */}
<div className="flex items-center justify-between text-[11px] text-ui-secondary">
- <span className="tabular-nums">Prior Frames ({timeline.onionSkin.prevFrames})</span>
+ <span className="tabular-nums">
+ {t('Prior Frames ({count})', { count: timeline.onionSkin.prevFrames })}
+ </span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -425,7 +430,9 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
{/* Next Frames Settings */}
<div className="flex items-center justify-between text-[11px] text-ui-secondary">
- <span className="tabular-nums">Next Frames ({timeline.onionSkin.nextFrames})</span>
+ <span className="tabular-nums">
+ {t('Next Frames ({count})', { count: timeline.onionSkin.nextFrames })}
+ </span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -462,7 +469,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
{/* Base Opacity */}
<div className="flex items-center justify-between text-[11px] text-ui-secondary">
- <span>Opacity</span>
+ <span>{t('Opacity')}</span>
<div className="flex items-center space-x-2">
<input
type="range"
@@ -492,7 +499,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
{/* Total Frames Adjuster */}
<div className="flex items-center space-x-1 bg-ui-input rounded-ui-sm px-1.5 py-0.5 border border-ui-subtle">
- <span className="text-[10px] text-ui-muted">Total</span>
+ <span className="text-[10px] text-ui-muted">{t('Total')}</span>
<input
type="number"
min="2"
@@ -504,6 +511,10 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
totalFrames: Math.max(2, Math.min(240, parseInt(e.target.value, 10) || 24)),
})
}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
className="w-10 bg-transparent font-ui-mono tabular-nums text-ui-primary text-center text-[11px] outline-none"
/>
</div>
@@ -513,9 +524,9 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
type="button"
onClick={() => setShowExportModal(true)}
className="px-2.5 py-1 bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary rounded-ui-sm text-[11px] font-medium transition-colors cursor-pointer"
- title="Export Animation"
+ title={t('Export Animation')}
>
- Export
+ {t('Export')}
</button>
{/* Close Timeline */}
@@ -524,7 +535,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
type="button"
onClick={onClose}
className="p-1 text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
- title="Close Timeline Dock"
+ title={t('Close Timeline Dock')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -580,7 +591,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
? 'bg-ui-accent text-ui-accent-contrast font-semibold'
: 'bg-ui-control text-ui-secondary hover:bg-ui-control-hover border border-ui-subtle'
}`}
- title={`Frame ${f + 1}: Cel Assigned`}
+ title={t('Frame {frame}: Cel Assigned', { frame: f + 1 })}
>
<span className="w-1.5 h-1.5 rounded-full bg-current" />
</div>
@@ -609,33 +620,47 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<div className="flex items-center justify-between text-[10px] text-ui-muted px-1">
<div className="flex items-center space-x-2">
<span>
- Active Cel:{' '}
+ {t('Active Cel:')}{' '}
{currentCelLayer ? (
<span className="text-ui-accent font-medium font-ui-mono">{currentCelLayer.name}</span>
) : (
- <span className="text-ui-muted italic">None (Drawing creates new frame cel)</span>
+ <span className="text-ui-muted italic">
+ {t('None (Drawing creates new frame cel)')}
+ </span>
)}
</span>
</div>
<div className="flex items-center space-x-3 text-ui-muted">
- <span>Drag scrubber to navigate</span>
+ <span>{t('Drag scrubber to navigate')}</span>
<span>·</span>
- <span>Alt+Space: Play/Pause</span>
+ <span>{t('Alt+Space: Play/Pause')}</span>
<span>·</span>
- <span>← / →: Step frame</span>
+ <span>{t('← / →: Step frame')}</span>
</div>
</div>
</div>
{/* 3. Export Modal */}
{showExportModal && (
- <div className="fixed inset-0 z-50 bg-ui-overlay flex items-center justify-center">
+ <div
+ role="dialog"
+ aria-modal="true"
+ className="fixed inset-0 z-50 bg-ui-overlay flex items-center justify-center"
+ onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
+ if (e.key === 'Escape' && !isExporting) {
+ e.preventDefault();
+ setShowExportModal(false);
+ }
+ }}
+ >
<div className="bg-ui-elevated border border-ui-default rounded-ui-lg p-4 shadow-ui-popover w-80 flex flex-col space-y-3.5">
<div className="flex items-center justify-between">
- <span className="text-xs font-medium text-ui-primary">Export Animation</span>
+ <span className="text-xs font-medium text-ui-primary">{t('Export Animation')}</span>
<button
type="button"
onClick={() => setShowExportModal(false)}
+ aria-label={t('Close')}
className="p-1 text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -643,7 +668,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
</div>
<div className="flex flex-col space-y-1.5">
- <label className="text-[11px] text-ui-muted">Format</label>
+ <label className="text-[11px] text-ui-muted">{t('Format')}</label>
<div className="grid grid-cols-2 gap-1.5 text-[11px]">
{(
[
@@ -663,16 +688,21 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {label}
+ {t(label)}
</button>
))}
</div>
</div>
<div className="text-[11px] text-ui-secondary space-y-1 bg-ui-input p-2.5 rounded-ui-sm border border-ui-subtle font-ui-mono tabular-nums">
- <div>Resolution: {dimensions.width} × {dimensions.height} px</div>
- <div>Frame Rate: {timeline.fps} FPS</div>
- <div>Total Frames: {timeline.totalFrames}</div>
+ <div>
+ {t('Resolution: {width} × {height} px', {
+ width: dimensions.width,
+ height: dimensions.height,
+ })}
+ </div>
+ <div>{t('Frame Rate: {fps} FPS', { fps: timeline.fps })}</div>
+ <div>{t('Total Frames: {count}', { count: timeline.totalFrames })}</div>
</div>
<button
@@ -681,7 +711,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
disabled={isExporting}
className="w-full py-1.5 bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium rounded-ui-sm text-xs transition-opacity disabled:opacity-50 cursor-pointer"
>
- {isExporting ? exportProgress || 'Exporting...' : 'Start Export'}
+ {isExporting ? exportProgress || t('Exporting...') : t('Start Export')}
</button>
</div>
</div>
diff --git a/src/components/AppShell.tsx b/src/components/AppShell.tsx
index 8e719ad..3934277 100644
--- a/src/components/AppShell.tsx
+++ b/src/components/AppShell.tsx
@@ -62,6 +62,7 @@ import { WorkspaceCommandHandlers } from './CommandBar';
import { CollabRoomOverlay, CollabRoomOverlayProps } from './CollabRoomOverlay';
import { AppearanceStudioDrawer } from './AppearanceStudioDrawer';
import { ToolOptionsBar } from './ToolOptionsBar';
+import { useI18n } from '../i18n';
/**
* Isolated root CSS-token synchronizer so 60fps appearance slider scrubbing
@@ -677,6 +678,7 @@ export const AppShell: React.FC<AppShellProps> = React.memo(
externalFileDropTarget = null,
children,
}) => {
+ const { t } = useI18n();
const dimensions = useDocumentStore((s) => s.dimensions);
const colorMode = useDocumentStore((s) => s.colorMode);
const documents = useDocumentStore((s) => s.documents);
@@ -742,8 +744,8 @@ export const AppShell: React.FC<AppShellProps> = React.memo(
const handleToggleTransparentColor = useCallback(() => {
const next = toolStoreActions.toggleTransparentColor();
- showToast(next ? 'Transparent ink mode active' : 'Color ink mode active');
- }, [showToast]);
+ showToast(next ? t('Transparent ink mode active') : t('Color ink mode active'));
+ }, [showToast, t]);
const handleSwapColors = useCallback(() => {
toolStoreActions.swapColors(colorMode);
diff --git a/src/components/AppearanceStudioDrawer.tsx b/src/components/AppearanceStudioDrawer.tsx
index e4de356..51fe56a 100644
--- a/src/components/AppearanceStudioDrawer.tsx
+++ b/src/components/AppearanceStudioDrawer.tsx
@@ -73,6 +73,7 @@ import {
SegmentedControl,
} from './ui';
import { WorkspaceAndBarsTab } from './WorkspaceAndBarsTab';
+import { isImeComposing, useI18n } from '../i18n';
type StudioAxisTab = 'surface' | 'chrome' | 'density' | 'controls' | 'workspace';
@@ -244,8 +245,9 @@ export const LookPresetCard: React.FC<LookPresetCardProps> = React.memo(
compact = false,
'data-testid': dataTestId,
}) => {
+ const { td } = useI18n();
const def = LOOK_PRESETS[presetId];
- const displayLabel = LOOK_PRESET_SHORT_LABELS[presetId] ?? def.label;
+ const displayLabel = td(LOOK_PRESET_SHORT_LABELS[presetId] ?? def.label);
const previewTokens = useMemo(() => {
const cfg = createAppearanceFromPreset(presetId, {
@@ -261,7 +263,7 @@ export const LookPresetCard: React.FC<LookPresetCardProps> = React.memo(
data-testid={dataTestId ?? `look-preset-${presetId}`}
data-active={active ? 'true' : 'false'}
aria-pressed={active}
- title={`${displayLabel} — ${def.description}`}
+ title={`${displayLabel} — ${td(def.description)}`}
onClick={() => onSelect(presetId)}
className={`group flex flex-col text-left rounded-ui-sm border transition-colors cursor-pointer overflow-hidden focus:outline-none focus-visible:border-ui-focus ${
active
@@ -376,6 +378,7 @@ export interface AppearanceStudioDrawerProps {
}
const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToast }) => {
+ const { t, tc, td } = useI18n();
const appearance = useUiStore((s) => s.appSettings.appearance);
const committedScale = useUiStore(
(s) => s.appSettings.interfaceScale ?? DEFAULT_INTERFACE_SCALE
@@ -478,6 +481,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
// Escape key to close (non-blocking — ignores when editing a text input or when another modal is open)
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key !== 'Escape' || e.defaultPrevented) return;
if (selectIsAnyModalOpen(useUiStore.getState())) return;
@@ -595,8 +599,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
lastMixIndexRef.current = index;
setTokenDrafts({});
commitAppearanceReplace(mixed);
- notify(`Look Mix: ${name}`);
- }, [commitAppearanceReplace, notify]);
+ notify(t('Look Mix: {name}', { name: td(name) }));
+ }, [commitAppearanceReplace, notify, t, td]);
const handleUndoTweak = useCallback(() => {
const stack = undoStackRef.current;
@@ -613,8 +617,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
const handleResetDefault = useCallback(() => {
setTokenDrafts({});
commitAppearanceReplace({ ...DEFAULT_APPEARANCE_CONFIG });
- notify('Appearance reset to Graphite Atelier');
- }, [commitAppearanceReplace, notify]);
+ notify(t('Appearance reset to Graphite Atelier'));
+ }, [commitAppearanceReplace, notify, t]);
// Compare Original (Hold) — previews session-initial theme (or factory default if unchanged)
const stopCompareOriginal = useCallback(() => {
@@ -773,8 +777,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
...cur,
tokenOverrides: undefined,
});
- notify('Custom token overrides cleared');
- }, [commitAppearanceReplace, notify]);
+ notify(t('Custom token overrides cleared'));
+ }, [commitAppearanceReplace, notify, t]);
const handleExportThemeFile = useCallback(async () => {
const cur = latestAppearanceRef.current;
@@ -793,17 +797,17 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
data: json,
suggestedName: fileName,
mimeType: 'application/json;charset=utf-8',
- description: 'Ink Studio Theme',
+ description: t('Ink Studio Theme'),
extensions: ['.inktheme', '.json'],
category: 'theme',
- title: 'Save Theme As',
+ title: t('Save Theme As'),
});
if (res.canceled) return;
- notify(`Exported ${res.fileName}`);
+ notify(t('Exported {fileName}', { fileName: res.fileName }));
} catch {
- notify('Unable to export .inktheme file');
+ notify(t('Unable to export .inktheme file'));
}
- }, [notify, userName]);
+ }, [notify, t, userName]);
const handleImportThemeFile = useCallback(
async (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -814,19 +818,26 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
const rawText = await file.text();
const result = parseThemePreset(rawText);
if (!result.ok) {
- notify(`Import failed: ${result.error}`);
+ notify(t('Import failed: {error}', { error: result.error }));
return;
}
setTokenDrafts({});
commitAppearanceReplace(result.preset.appearance);
- const warnNote =
- result.warnings.length > 0 ? ` (${result.warnings.length} dial clamped)` : '';
- notify(`Imported theme "${result.preset.name}"${warnNote}`);
+ if (result.warnings.length > 0) {
+ notify(
+ t('Imported theme "{name}" ({count} dial clamped)', {
+ name: td(result.preset.name),
+ count: result.warnings.length,
+ })
+ );
+ } else {
+ notify(t('Imported theme "{name}"', { name: td(result.preset.name) }));
+ }
} catch {
- notify('Failed to read .inktheme file');
+ notify(t('Failed to read .inktheme file'));
}
},
- [commitAppearanceReplace, notify]
+ [commitAppearanceReplace, notify, t, td]
);
const handleCopyThemeCode = useCallback(async () => {
@@ -869,20 +880,20 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
setJustCopied(true);
if (copiedTimerRef.current) clearTimeout(copiedTimerRef.current);
copiedTimerRef.current = setTimeout(() => setJustCopied(false), 1800);
- notify('Theme code copied to clipboard');
+ notify(t('Theme code copied to clipboard'));
} else {
setPastePanelOpen(true);
setPasteCodeDraft(code);
setPasteError(null);
- notify('Theme code ready to copy below');
+ notify(t('Theme code ready to copy below'));
}
- }, [notify, userName]);
+ }, [notify, t, userName]);
const handleApplyPastedCode = useCallback(() => {
const result = decodeThemeShareCode(pasteCodeDraft);
if (!result.ok) {
setPasteError(result.error);
- notify(`Invalid theme code: ${result.error}`);
+ notify(t('Invalid theme code: {error}', { error: result.error }));
return;
}
setPasteError(null);
@@ -890,10 +901,99 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
setPastePanelOpen(false);
setTokenDrafts({});
commitAppearanceReplace(result.preset.appearance);
- const warnNote =
- result.warnings.length > 0 ? ` (${result.warnings.length} dial clamped)` : '';
- notify(`Applied theme "${result.preset.name}"${warnNote}`);
- }, [commitAppearanceReplace, notify, pasteCodeDraft]);
+ if (result.warnings.length > 0) {
+ notify(
+ t('Applied theme "{name}" ({count} dial clamped)', {
+ name: td(result.preset.name),
+ count: result.warnings.length,
+ })
+ );
+ } else {
+ notify(t('Applied theme "{name}"', { name: td(result.preset.name) }));
+ }
+ }, [commitAppearanceReplace, notify, pasteCodeDraft, t, td]);
+
+ // Localized option lists (recomputed live on language switch)
+ const localizedAxisTabs = useMemo(
+ () =>
+ AXIS_TABS.map((tab) => ({
+ ...tab,
+ label: tc('appearanceTab', tab.label),
+ ...(tab.title ? { title: t(tab.title) } : {}),
+ })),
+ [t, tc]
+ );
+
+ const localizedCanvasMatteOptions = useMemo(
+ () =>
+ CANVAS_MATTE_OPTIONS.map((opt) => ({
+ ...opt,
+ label:
+ opt.value === 'neutral-dark' || opt.value === 'neutral-light'
+ ? tc('theme', opt.label)
+ : t(opt.label),
+ title: t(opt.title),
+ })),
+ [t, tc]
+ );
+
+ const localizedCornerRadiusOptions = useMemo(
+ () =>
+ CORNER_RADIUS_OPTIONS.map((opt) => ({
+ ...opt,
+ label: tc('cornerRadius', opt.label),
+ })),
+ [tc]
+ );
+
+ const localizedChromeStyleOptions = useMemo(
+ () => CHROME_STYLE_OPTIONS.map((opt) => ({ ...opt, label: tc('chromeStyle', opt.label) })),
+ [tc]
+ );
+
+ const localizedDensityOptions = useMemo(
+ () => DENSITY_OPTIONS.map((opt) => ({ ...opt, label: t(opt.label) })),
+ [t]
+ );
+
+ const localizedFontProfileOptions = useMemo(
+ () => FONT_PROFILE_OPTIONS.map((opt) => ({ ...opt, label: t(opt.label) })),
+ [t]
+ );
+
+ const localizedIconWeightOptions = useMemo(
+ () => ICON_WEIGHT_OPTIONS.map((opt) => ({ ...opt, label: t(opt.label) })),
+ [t]
+ );
+
+ const localizedSliderStyleOptions = useMemo(
+ () => SLIDER_STYLE_OPTIONS.map((opt) => ({ ...opt, label: t(opt.label) })),
+ [t]
+ );
+
+ const localizedBrushListOptions = useMemo(
+ () =>
+ BRUSH_LIST_OPTIONS.map((opt) => ({
+ ...opt,
+ label: opt.value === 'stroke' ? tc('brushStudio', opt.label) : t(opt.label),
+ })),
+ [t, tc]
+ );
+
+ const localizedLayerThumbOptions = useMemo(
+ () => LAYER_THUMB_OPTIONS.map((opt) => ({ ...opt, label: t(opt.label) })),
+ [t]
+ );
+
+ const localizedScrollbarSizeOptions = useMemo(
+ () =>
+ SCROLLBAR_SIZE_OPTIONS.map((opt) => ({
+ ...opt,
+ label: t(opt.label),
+ title: t(opt.title),
+ })),
+ [t]
+ );
// =========================================================================
// Contrast Indicators (Live WCAG 2.1)
@@ -902,6 +1002,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
const primaryRatio = resolvedTheme.contrast.primaryOnPanel;
const mutedRatio = resolvedTheme.contrast.mutedOnPanel;
const primaryGrade = getContrastGrade(primaryRatio);
+ const primaryGradeLabel = td(primaryGrade.label, 'contrast');
const hasContrastWarning = primaryRatio < 4.5 || mutedRatio < 3.0;
const drawerStyle: React.CSSProperties = isDocked
@@ -928,7 +1029,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<aside
ref={drawerRef}
role="region"
- aria-label="Appearance Studio"
+ aria-label={t('Appearance Studio')}
data-testid="appearance-studio-drawer"
data-docked={isDocked ? 'true' : 'false'}
data-comparing={isComparing ? 'true' : 'false'}
@@ -957,8 +1058,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
}}
title={
isDocked
- ? 'Drag to float Appearance Studio over canvas'
- : 'Drag to move · Double-click to re-dock right'
+ ? t('Drag to float Appearance Studio over canvas')
+ : t('Drag to move · Double-click to re-dock right')
}
className="h-8 px-2 flex items-center justify-between gap-1.5 shrink-0 bg-ui-header border-b border-ui-subtle cursor-grab active:cursor-grabbing"
>
@@ -966,7 +1067,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<GripVertical className="w-3 h-3 text-ui-icon-muted shrink-0" />
<Palette className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span className="text-[11px] font-medium text-ui-primary truncate">
- Appearance Studio
+ {t('Appearance Studio')}
</span>
</div>
@@ -976,7 +1077,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
type="button"
data-testid="appearance-compare-btn"
aria-pressed={isComparing}
- title="Hold to temporarily compare with original look"
+ title={t('Hold to temporarily compare with original look')}
onPointerDown={(e) => {
if (e.button !== 0) return;
e.preventDefault();
@@ -1011,7 +1112,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
}`}
>
<Eye className="w-3 h-3 shrink-0" />
- <span>{isComparing ? 'Original' : 'Compare'}</span>
+ <span>{isComparing ? t('Original') : t('Compare')}</span>
</button>
{!isDocked && (
@@ -1019,7 +1120,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
data-testid="appearance-dock-btn"
size="xs"
icon={<PanelRight className="w-3 h-3" />}
- title="Dock to Right Edge"
+ title={t('Dock to Right Edge')}
onClick={() => setIsDocked(true)}
/>
)}
@@ -1028,7 +1129,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
data-testid="appearance-close-btn"
size="xs"
icon={<X className="w-3 h-3" />}
- title="Close Appearance Studio (Esc)"
+ title={t('Close Appearance Studio (Esc)')}
onClick={() => uiStoreActions.setAppearanceStudioOpen(false)}
/>
</div>
@@ -1062,8 +1163,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
size="xs"
variant="subtle"
icon={<Shuffle className="w-3 h-3 text-ui-accent" />}
- label="Mix"
- title="Cycle curated harmonious look combinations"
+ label={t('Mix')}
+ title={t('Cycle curated harmonious look combinations')}
onClick={handleMixSurprise}
className="flex-1"
/>
@@ -1072,11 +1173,11 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
size="xs"
variant="subtle"
icon={<Undo2 className="w-3 h-3" />}
- label="Undo"
+ label={t('Undo')}
title={
undoStack.length > 0
- ? `Undo last tweak (${undoStack.length} available)`
- : 'No tweaks to undo yet'
+ ? t('Undo last tweak ({count} available)', { count: undoStack.length })
+ : t('No tweaks to undo yet')
}
disabled={undoStack.length === 0}
onClick={handleUndoTweak}
@@ -1087,8 +1188,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
size="xs"
variant="subtle"
icon={<RotateCcw className="w-3 h-3" />}
- label="Reset"
- title="Reset appearance to Graphite Atelier defaults"
+ label={t('Reset')}
+ title={t('Reset appearance to Graphite Atelier defaults')}
onClick={handleResetDefault}
className="flex-1"
/>
@@ -1101,9 +1202,9 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="px-2 bg-ui-header shrink-0">
<HairlineTabs<StudioAxisTab>
data-testid="appearance-axis-tabs"
- aria-label="Appearance categories"
+ aria-label={t('Appearance categories')}
value={activeTab}
- tabs={AXIS_TABS}
+ tabs={localizedAxisTabs}
onChange={setActiveTab}
size="xs"
fullWidth
@@ -1122,7 +1223,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1.5">
<ScrubSlider
data-testid="appearance-brightness-slider"
- label="Surface Brightness"
+ label={t('Surface Brightness')}
min={APPEARANCE_LIMITS.surfaceBrightness.min}
max={APPEARANCE_LIMITS.surfaceBrightness.max}
step={1}
@@ -1147,7 +1248,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<ScrubSlider
data-testid="appearance-contrast-slider"
- label="Contrast & Seams"
+ label={t('Contrast & Seams')}
min={APPEARANCE_LIMITS.surfaceContrast.min}
max={APPEARANCE_LIMITS.surfaceContrast.max}
step={0.02}
@@ -1179,7 +1280,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<ScrubSlider
data-testid="appearance-warmth-slider"
- label="Surface Warmth"
+ label={t('Surface Warmth')}
min={APPEARANCE_LIMITS.surfaceWarmth.min}
max={APPEARANCE_LIMITS.surfaceWarmth.max}
step={1}
@@ -1187,8 +1288,8 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
value={appearance.surfaceWarmth}
formatValue={(v) => {
const r = Math.round(v);
- if (r === 0) return 'Neutral 0';
- return r > 0 ? `+${r} Warm` : `${r} Cool`;
+ if (r === 0) return t('Neutral 0');
+ return r > 0 ? t('+{n} Warm', { n: r }) : t('{n} Cool', { n: r });
}}
onChange={(v) =>
handleLiveDialChange({
@@ -1206,7 +1307,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
}
/>
<div className="flex items-center justify-between text-[9.5px] text-ui-muted px-0.5">
- <span>Cool Slate</span>
+ <span>{t('Cool Slate')}</span>
<button
type="button"
data-testid="appearance-warmth-neutral-btn"
@@ -1222,11 +1323,11 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
? 'bg-ui-control-active text-ui-primary border-ui-default'
: 'bg-ui-input text-ui-muted hover:text-ui-primary border-ui-subtle'
}`}
- title="Snap surface tint to strictly achromatic neutral 0"
+ title={t('Snap surface tint to strictly achromatic neutral 0')}
>
- Neutral 0
+ {t('Neutral 0')}
</button>
- <span>Warm Sumi</span>
+ <span>{t('Warm Sumi')}</span>
</div>
</div>
</div>
@@ -1234,11 +1335,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
{/* Accent Pigment Swatch Row */}
<div className="space-y-1.5">
<div className="flex items-center justify-between">
- <span className="text-[10.5px] font-medium text-ui-secondary">Accent Pigment</span>
+ <span className="text-[10.5px] font-medium text-ui-secondary">
+ {t('Accent Pigment')}
+ </span>
<span className="text-[10px] font-ui-mono text-ui-muted">
{appearance.accent === 'custom'
? appearance.customAccentHex
- : ACCENT_PIGMENTS[appearance.accent].label}
+ : td(ACCENT_PIGMENTS[appearance.accent].label)}
</span>
</div>
@@ -1253,9 +1356,9 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
key={pigmentId}
type="button"
data-testid={`appearance-accent-${pigmentId}`}
- aria-label={def.label}
+ aria-label={td(def.label)}
aria-pressed={isSelected}
- title={`${def.label} — ${def.description}`}
+ title={`${td(def.label)} — ${td(def.description)}`}
onClick={() => commitAppearancePatch({ accent: pigmentId })}
className={`flex-1 h-7 rounded-ui-sm border flex items-center justify-center transition-colors cursor-pointer focus:outline-none focus-visible:border-ui-focus ${
isSelected
@@ -1282,9 +1385,9 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<button
type="button"
data-testid="appearance-accent-custom"
- aria-label="Custom Accent Pigment"
+ aria-label={t('Custom Accent Pigment')}
aria-pressed={appearance.accent === 'custom'}
- title="Custom Accent Hex"
+ title={t('Custom Accent Hex')}
onClick={() => commitAppearancePatch({ accent: 'custom' })}
className={`h-7 px-2 rounded-ui-sm border flex items-center gap-1 text-[10px] transition-colors cursor-pointer focus:outline-none focus-visible:border-ui-focus ${
appearance.accent === 'custom'
@@ -1298,7 +1401,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
backgroundColor: normalizeHex6(appearance.customAccentHex, '#e5e5e5'),
}}
/>
- <span>Custom</span>
+ <span>{t('Custom')}</span>
</button>
</div>
@@ -1306,7 +1409,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="flex items-center gap-1.5 p-1.5 rounded-ui-sm bg-ui-header border border-ui-subtle">
<input
type="color"
- aria-label="Pick Custom Accent Color"
+ aria-label={t('Pick Custom Accent Color')}
data-testid="appearance-accent-custom-picker"
value={normalizeHex6(appearance.customAccentHex, '#e5e5e5')}
onChange={(e) => {
@@ -1318,7 +1421,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
/>
<input
type="text"
- aria-label="Custom Accent Hex"
+ aria-label={t('Custom Accent Hex')}
data-testid="appearance-accent-custom-hex"
value={customAccentDraft}
maxLength={7}
@@ -1343,7 +1446,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary">
- Canvas Surround (Matte)
+ {t('Canvas Surround (Matte)')}
</span>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{resolvedTheme.tokens['--ui-canvas-matte']}
@@ -1351,9 +1454,9 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
</div>
<SegmentedControl<CanvasMatteMode>
data-testid="appearance-matte-mode"
- aria-label="Canvas Surround Matte"
+ aria-label={t('Canvas Surround Matte')}
value={appearance.canvasMatteMode}
- options={CANVAS_MATTE_OPTIONS}
+ options={localizedCanvasMatteOptions}
onChange={(mode) => commitAppearancePatch({ canvasMatteMode: mode })}
size="xs"
fullWidth
@@ -1363,7 +1466,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="flex items-center gap-1.5 p-1.5 rounded-ui-sm bg-ui-header border border-ui-subtle">
<input
type="color"
- aria-label="Pick Custom Canvas Matte Color"
+ aria-label={t('Pick Custom Canvas Matte Color')}
data-testid="appearance-matte-custom-picker"
value={normalizeHex6(appearance.canvasMatteCustomHex, '#161616')}
onChange={(e) => {
@@ -1378,7 +1481,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
/>
<input
type="text"
- aria-label="Custom Canvas Matte Hex"
+ aria-label={t('Custom Canvas Matte Hex')}
data-testid="appearance-matte-custom-hex"
value={customMatteDraft}
maxLength={7}
@@ -1411,13 +1514,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<>
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Corner Radius
+ {t('Corner Radius')}
</span>
<SegmentedControl<CornerRadiusPreset>
data-testid="appearance-corner-radius"
- aria-label="Corner Radius"
+ aria-label={t('Corner Radius')}
value={appearance.cornerRadius}
- options={CORNER_RADIUS_OPTIONS}
+ options={localizedCornerRadiusOptions}
onChange={(cornerRadius) => commitAppearancePatch({ cornerRadius })}
size="sm"
fullWidth
@@ -1426,13 +1529,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Panel Style
+ {t('Panel Style')}
</span>
<SegmentedControl<ChromeStyle>
data-testid="appearance-chrome-style"
- aria-label="Panel Style"
+ aria-label={t('Panel Style')}
value={appearance.chromeStyle}
- options={CHROME_STYLE_OPTIONS}
+ options={localizedChromeStyleOptions}
onChange={(chromeStyle) => commitAppearancePatch({ chromeStyle })}
size="sm"
fullWidth
@@ -1442,7 +1545,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1.5 pt-0.5">
<ScrubSlider
data-testid="appearance-border-crispness-slider"
- label="Border Crispness"
+ label={t('Border Crispness')}
min={APPEARANCE_LIMITS.borderCrispness.min}
max={APPEARANCE_LIMITS.borderCrispness.max}
step={1}
@@ -1455,7 +1558,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<ScrubSlider
data-testid="appearance-floating-opacity-slider"
- label="Floating Panel Opacity"
+ label={t('Floating Panel Opacity')}
variant="opacity"
min={65}
max={100}
@@ -1485,13 +1588,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<>
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Interface Density
+ {t('Interface Density')}
</span>
<SegmentedControl<DensityPreset>
data-testid="appearance-density"
- aria-label="Interface Density"
+ aria-label={t('Interface Density')}
value={appearance.density}
- options={DENSITY_OPTIONS}
+ options={localizedDensityOptions}
onChange={(density) => commitAppearancePatch({ density })}
size="sm"
fullWidth
@@ -1502,17 +1605,17 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary">
- Interface Scale
+ {t('Interface Scale')}
</span>
{draftScale !== committedScale && (
<span className="text-[9.5px] font-ui-mono text-ui-accent">
- Release to apply
+ {t('Release to apply')}
</span>
)}
</div>
<ScrubSlider
data-testid="appearance-interface-scale-slider"
- label="UI Scale"
+ label={t('UI Scale')}
min={MIN_INTERFACE_SCALE}
max={MAX_INTERFACE_SCALE}
step={INTERFACE_SCALE_STEP}
@@ -1553,13 +1656,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Typography
+ {t('Typography')}
</span>
<SegmentedControl<FontProfile>
data-testid="appearance-font-profile"
- aria-label="Typography"
+ aria-label={t('Typography')}
value={appearance.fontProfile}
- options={FONT_PROFILE_OPTIONS}
+ options={localizedFontProfileOptions}
onChange={(fontProfile) => commitAppearancePatch({ fontProfile })}
size="sm"
fullWidth
@@ -1568,13 +1671,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Icon Weight
+ {t('Icon Weight')}
</span>
<SegmentedControl<'1.25' | '1.5' | '1.85'>
data-testid="appearance-icon-weight"
- aria-label="Icon Weight"
+ aria-label={t('Icon Weight')}
value={String(appearance.iconStrokeWidth) as '1.25' | '1.5' | '1.85'}
- options={ICON_WEIGHT_OPTIONS}
+ options={localizedIconWeightOptions}
onChange={(val) =>
commitAppearancePatch({
iconStrokeWidth: Number(val) as IconStrokeWidth,
@@ -1588,7 +1691,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Scrollbar Size
+ {t('Scrollbar Size')}
</span>
<span className="text-[9.5px] font-ui-mono tabular-nums text-ui-muted">
{resolvedTheme.tokens['--ui-scrollbar-size']}
@@ -1596,9 +1699,9 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
</div>
<SegmentedControl<ScrollbarSize>
data-testid="appearance-scrollbar-size"
- aria-label="Scrollbar Size"
+ aria-label={t('Scrollbar Size')}
value={appearance.scrollbarSize}
- options={SCROLLBAR_SIZE_OPTIONS}
+ options={localizedScrollbarSizeOptions}
onChange={(scrollbarSize) => commitAppearancePatch({ scrollbarSize })}
size="xs"
fullWidth
@@ -1614,13 +1717,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<>
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Slider Style
+ {t('Slider Style')}
</span>
<SegmentedControl<SliderStyle>
data-testid="appearance-slider-style"
- aria-label="Slider Style"
+ aria-label={t('Slider Style')}
value={appearance.sliderStyle}
- options={SLIDER_STYLE_OPTIONS}
+ options={localizedSliderStyleOptions}
onChange={(sliderStyle) => commitAppearancePatch({ sliderStyle })}
size="sm"
fullWidth
@@ -1629,13 +1732,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Brush List View
+ {t('Brush List View')}
</span>
<SegmentedControl<BrushListStyle>
data-testid="appearance-brush-list-style"
- aria-label="Brush List View"
+ aria-label={t('Brush List View')}
value={appearance.brushListStyle}
- options={BRUSH_LIST_OPTIONS}
+ options={localizedBrushListOptions}
onChange={(brushListStyle) => commitAppearancePatch({ brushListStyle })}
size="sm"
fullWidth
@@ -1644,13 +1747,13 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Layer Thumbnails
+ {t('Layer Thumbnails')}
</span>
<SegmentedControl<LayerThumbSize>
data-testid="appearance-layer-thumb-size"
- aria-label="Layer Thumbnails"
+ aria-label={t('Layer Thumbnails')}
value={appearance.layerThumbSize}
- options={LAYER_THUMB_OPTIONS}
+ options={localizedLayerThumbOptions}
onChange={(layerThumbSize) => commitAppearancePatch({ layerThumbSize })}
size="sm"
fullWidth
@@ -1670,15 +1773,15 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
{/* ================================================================= */}
<SectionDisclosure
data-testid="appearance-advanced-accordion"
- title="Advanced & Share"
+ title={t('Advanced & Share')}
open={advancedOpen}
onToggle={() => setAdvancedOpen((prev) => !prev)}
summary={
hasContrastWarning
- ? `${primaryRatio.toFixed(1)}:1 Low`
+ ? t('{ratio}:1 Low', { ratio: primaryRatio.toFixed(1) })
: activeOverrideCount > 0
- ? `${primaryRatio.toFixed(1)}:1 ${primaryGrade.label} · ${activeOverrideCount}`
- : `${primaryRatio.toFixed(1)}:1 ${primaryGrade.label}`
+ ? `${primaryRatio.toFixed(1)}:1 ${primaryGradeLabel} · ${activeOverrideCount}`
+ : `${primaryRatio.toFixed(1)}:1 ${primaryGradeLabel}`
}
summaryTone={hasContrastWarning ? 'default' : 'muted'}
className="mt-auto"
@@ -1696,7 +1799,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<div className="flex items-center gap-1.5 min-w-0">
{hasContrastWarning && <AlertTriangle className="w-3 h-3 shrink-0" />}
<span className="truncate">
- {hasContrastWarning ? 'Low contrast warning' : 'WCAG Text Contrast'}
+ {hasContrastWarning ? t('Low contrast warning') : t('WCAG Text Contrast')}
</span>
</div>
<div className="flex items-center gap-1.5 font-ui-mono tabular-nums shrink-0">
@@ -1705,9 +1808,11 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
primaryRatio >= 4.5 ? 'text-ui-success font-medium' : 'text-ui-danger font-medium'
}
>
- {primaryRatio.toFixed(1)}:1 {primaryGrade.label}
+ {primaryRatio.toFixed(1)}:1 {primaryGradeLabel}
+ </span>
+ <span className="text-ui-muted">
+ {t('· Muted {ratio}:1', { ratio: mutedRatio.toFixed(1) })}
</span>
- <span className="text-ui-muted">· Muted {mutedRatio.toFixed(1)}:1</span>
</div>
</div>
@@ -1721,7 +1826,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
className="flex items-center gap-1 text-[10px] font-medium text-ui-secondary hover:text-ui-primary cursor-pointer"
>
<SlidersHorizontal className="w-3 h-3 text-ui-icon-muted" />
- <span>Custom Token Overrides</span>
+ <span>{t('Custom Token Overrides')}</span>
{activeOverrideCount > 0 && (
<span className="font-ui-mono text-[9.5px] text-ui-accent">
({activeOverrideCount})
@@ -1735,7 +1840,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
onClick={handleClearAllOverrides}
className="text-[9.5px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Clear all
+ {t('Clear all')}
</button>
)}
</div>
@@ -1747,6 +1852,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
const resolvedVal = resolvedTheme.tokens[key];
const displayVal = tokenDrafts[key] ?? appearance.tokenOverrides?.[key] ?? resolvedVal;
const swatchHex = colorTokenToHex6(resolvedVal, '#808080');
+ const trLabel = t(label);
return (
<div
@@ -1760,12 +1866,12 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
}`}
title={key}
>
- {label}
+ {trLabel}
</span>
<input
type="color"
- aria-label={`${label} color picker`}
+ aria-label={t('{label} color picker', { label: trLabel })}
data-testid={`token-picker-${key}`}
value={swatchHex}
onChange={(e) => {
@@ -1778,7 +1884,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<input
type="text"
- aria-label={`${label} color value`}
+ aria-label={t('{label} color value', { label: trLabel })}
data-testid={`token-input-${key}`}
value={displayVal}
onChange={(e) => {
@@ -1802,7 +1908,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
data-testid={`token-reset-${key}`}
size="xs"
icon={<RotateCcw className="w-2.5 h-2.5" />}
- title={`Reset ${label}`}
+ title={t('Reset {label}', { label: trLabel })}
disabled={!isOverridden}
onClick={() => handleResetSingleToken(key)}
/>
@@ -1816,7 +1922,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
{/* Theme Sharing (.inktheme Export/Import & Copy/Paste Code) */}
<div className="space-y-1.5">
<span className="text-[10px] font-medium text-ui-secondary block">
- Theme Sharing (.inktheme)
+ {t('Theme Sharing (.inktheme)')}
</span>
<div className="grid grid-cols-2 gap-1">
<IconButton
@@ -1824,7 +1930,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
size="xs"
variant="subtle"
icon={<Download className="w-3 h-3" />}
- label="Export .inktheme"
+ label={t('Export .inktheme')}
onClick={handleExportThemeFile}
className="w-full"
/>
@@ -1833,7 +1939,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
size="xs"
variant="subtle"
icon={<Upload className="w-3 h-3" />}
- label="Import .inktheme"
+ label={t('Import .inktheme')}
onClick={() => importInputRef.current?.click()}
className="w-full"
/>
@@ -1848,7 +1954,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<Copy className="w-3 h-3" />
)
}
- label={justCopied ? 'Copied!' : 'Copy Code'}
+ label={justCopied ? t('Copied!') : t('Copy Code')}
onClick={() => void handleCopyThemeCode()}
className="w-full"
/>
@@ -1858,7 +1964,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
variant="subtle"
active={pastePanelOpen}
icon={<Upload className="w-3 h-3" />}
- label="Paste Code"
+ label={t('Paste Code')}
onClick={() => {
setPastePanelOpen((prev) => !prev);
setPasteError(null);
@@ -1873,19 +1979,20 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
<input
type="text"
data-testid="appearance-paste-code-input"
- aria-label="Paste Theme Code"
+ aria-label={t('Paste Theme Code')}
value={pasteCodeDraft}
onChange={(e) => {
setPasteCodeDraft(e.target.value);
if (pasteError) setPasteError(null);
}}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
handleApplyPastedCode();
}
}}
- placeholder="Paste INKTHEME1:... or JSON"
+ placeholder={t('Paste INKTHEME1:... or JSON')}
className="flex-1 min-w-0 h-6 px-1.5 rounded-ui-xs bg-ui-input border border-ui-default font-ui-mono text-[10px] text-ui-primary"
/>
<button
@@ -1894,7 +2001,7 @@ const AppearanceStudioPanel: React.FC<AppearanceStudioDrawerProps> = ({ showToas
onClick={handleApplyPastedCode}
className="h-6 px-2 rounded-ui-xs bg-ui-control-active hover:bg-ui-control-hover border border-ui-accent-border text-[10px] font-medium text-ui-primary cursor-pointer shrink-0"
>
- Apply
+ {t('Apply')}
</button>
</div>
{pasteError && (
diff --git a/src/components/AutoActionPanel.tsx b/src/components/AutoActionPanel.tsx
index 6ddcfe5..fe9dbae 100644
--- a/src/components/AutoActionPanel.tsx
+++ b/src/components/AutoActionPanel.tsx
@@ -18,6 +18,7 @@ import {
} from '../utils/autoActionEngine';
import { autoActionStoreActions, useAutoActionStore } from '../stores';
import { saveFileWithDialog } from '../utils/fileSaveDialog';
+import { isImeComposing, useI18n } from '../i18n';
export interface AutoActionPanelProps {
hasOpenDocument: boolean;
@@ -27,6 +28,7 @@ export interface AutoActionPanelProps {
export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
({ hasOpenDocument, onPlayAction, showToast }) => {
+ const { t, td } = useI18n();
const sets = useAutoActionStore((s) => s.sets);
const activeSetId = useAutoActionStore((s) => s.activeSetId);
const selectedActionId = useAutoActionStore((s) => s.selectedActionId);
@@ -52,19 +54,19 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
};
const handleCreateSet = () => {
- const name = `Action Set ${sets.length + 1}`;
+ const name = t('Action Set {n}', { n: sets.length + 1 });
autoActionStoreActions.createSet(name);
- showToast?.(`Created set "${name}"`);
+ showToast?.(t('Created set "{name}"', { name }));
};
const handleToggleRecord = () => {
if (isRecording) {
autoActionStoreActions.stopRecording();
- showToast?.('Auto Action recording stopped');
+ showToast?.(t('Auto Action recording stopped'));
} else {
const id = autoActionStoreActions.startRecording(selectedAction?.id);
setExpandedIds((prev) => ({ ...prev, [id]: true }));
- showToast?.('Recording Auto Action steps...');
+ showToast?.(t('Recording Auto Action steps...'));
}
};
@@ -75,15 +77,15 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
data: json,
suggestedName: 'inkstudio-auto-actions.json',
mimeType: 'application/json',
- description: 'Ink Studio Auto Actions',
+ description: t('Ink Studio Auto Actions'),
extensions: ['.json'],
category: 'auto-action',
- title: 'Save Auto Actions As',
+ title: t('Save Auto Actions As'),
});
if (res.canceled) return;
- showToast?.(`Exported ${res.fileName}`);
+ showToast?.(t('Exported {fileName}', { fileName: res.fileName }));
} catch {
- showToast?.('Failed to export Auto Action sets');
+ showToast?.(t('Failed to export Auto Action sets'));
}
};
@@ -98,9 +100,11 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
const text = await file.text();
const imported = importAutoActionSetsJson(text);
autoActionStoreActions.replaceSets(imported);
- showToast?.(`Imported ${imported.length} Auto Action set(s)`);
+ showToast?.(t('Imported {count} Auto Action set(s)', { count: imported.length }));
} catch (err) {
- showToast?.(err instanceof Error ? err.message : 'Failed to import Auto Actions');
+ showToast?.(
+ err instanceof Error ? td(err.message) : t('Failed to import Auto Actions')
+ );
}
};
input.click();
@@ -118,14 +122,14 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
>
{sets.map((s) => (
<option key={s.id} value={s.id}>
- {s.name}
+ {td(s.name)}
</option>
))}
</select>
<button
type="button"
onClick={handleCreateSet}
- title="New Action Set"
+ title={t('New Action Set')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-icon-muted hover:text-ui-primary cursor-pointer transition-colors"
>
<FolderPlus className="w-3.5 h-3.5" />
@@ -133,7 +137,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
<button
type="button"
onClick={handleImportJson}
- title="Import Action Sets (.json)"
+ title={t('Import Action Sets (.json)')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-icon-muted hover:text-ui-primary cursor-pointer transition-colors"
>
<Upload className="w-3.5 h-3.5" />
@@ -141,7 +145,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
<button
type="button"
onClick={handleExportJson}
- title="Export Action Sets (.json)"
+ title={t('Export Action Sets (.json)')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-icon-muted hover:text-ui-primary cursor-pointer transition-colors"
>
<Download className="w-3.5 h-3.5" />
@@ -154,15 +158,16 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
value={newActionName}
onChange={(e) => setNewActionName(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') handleCreateAction();
}}
- placeholder="New action name..."
+ placeholder={t('New action name...')}
className="flex-1 bg-ui-input text-[11px] text-ui-primary placeholder:text-ui-muted px-2 py-1 rounded-ui-sm border border-ui-default min-w-0 focus:outline-none focus:border-ui-focus"
/>
<button
type="button"
onClick={handleCreateAction}
- title="Create Auto Action"
+ title={t('Create Auto Action')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary cursor-pointer transition-colors"
>
<Plus className="w-3.5 h-3.5" />
@@ -175,14 +180,14 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
<div className="px-2.5 py-1 bg-ui-danger/15 border-b border-ui-danger/30 flex items-center justify-between text-[10px] text-ui-danger shrink-0">
<div className="flex items-center gap-1.5">
<span className="w-2 h-2 rounded-full bg-ui-danger animate-pulse" />
- <span>Recording commands...</span>
+ <span>{t('Recording commands...')}</span>
</div>
<button
type="button"
onClick={() => autoActionStoreActions.stopRecording()}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-danger/20 hover:bg-ui-danger/35 text-ui-danger font-medium cursor-pointer transition-colors"
>
- Stop
+ {t('Stop')}
</button>
</div>
)}
@@ -191,7 +196,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
<div className="flex-1 overflow-y-auto p-1.5 space-y-1">
{!activeSet || activeSet.actions.length === 0 ? (
<div className="text-[11px] text-ui-muted text-center py-6">
- No actions in this set. Click + to create one.
+ {t('No actions in this set. Click + to create one.')}
</div>
) : (
activeSet.actions.map((action) => {
@@ -228,7 +233,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
</button>
<span className="flex-1 text-[11px] font-medium truncate">
- {action.name}
+ {td(action.name)}
</span>
<span className="text-[9px] font-ui-mono tabular-nums text-ui-muted mr-1">
@@ -246,7 +251,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
e.stopPropagation();
onPlayAction(action);
}}
- title="Play Auto Action"
+ title={t('Play Auto Action')}
className="p-1 rounded-ui-xs bg-ui-control hover:bg-ui-accent hover:text-ui-accent-contrast text-ui-primary disabled:opacity-35 cursor-pointer transition-colors"
>
<Play className="w-3 h-3" />
@@ -258,7 +263,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
e.stopPropagation();
autoActionStoreActions.deleteAction(action.id);
}}
- title="Delete Action"
+ title={t('Delete Action')}
className="p-1 rounded-ui-xs hover:bg-ui-danger/15 text-ui-muted hover:text-ui-danger cursor-pointer transition-colors"
>
<Trash2 className="w-3 h-3" />
@@ -269,7 +274,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
<div className="px-2 pb-1.5 pt-1 space-y-1 border-t border-ui-subtle">
{action.steps.length === 0 ? (
<div className="text-[10px] text-ui-muted italic py-1">
- Empty. Press Record and perform layer/filter commands.
+ {t('Empty. Press Record and perform layer/filter commands.')}
</div>
) : (
action.steps.map((step) => (
@@ -290,7 +295,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
step.enabled === false ? 'line-through opacity-50' : ''
}`}
>
- {step.label}
+ {td(step.label)}
</span>
<button
type="button"
@@ -298,7 +303,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
autoActionStoreActions.deleteStep(action.id, step.id)
}
className="text-ui-muted hover:text-ui-danger cursor-pointer"
- title="Remove step"
+ title={t('Remove step')}
>
<Trash2 className="w-2.5 h-2.5" />
</button>
@@ -328,12 +333,12 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
{isRecording ? (
<>
<Square className="w-3 h-3 fill-current" />
- <span>Stop</span>
+ <span>{t('Stop')}</span>
</>
) : (
<>
<Circle className="w-3 h-3 text-ui-danger fill-ui-danger" />
- <span>Record</span>
+ <span>{t('Record')}</span>
</>
)}
</button>
@@ -345,7 +350,7 @@ export const AutoActionPanel: React.FC<AutoActionPanelProps> = React.memo(
className="flex-1 py-1.5 px-2 rounded-ui-sm text-[11px] font-medium bg-ui-accent text-ui-accent-contrast hover:opacity-90 flex items-center justify-center gap-1.5 cursor-pointer transition-opacity disabled:opacity-40"
>
<Play className="w-3 h-3 fill-current" />
- <span>Play</span>
+ <span>{t('Play')}</span>
</button>
</div>
</div>
diff --git a/src/components/BrushSizePalette.tsx b/src/components/BrushSizePalette.tsx
index 3b9f4d0..d83b042 100644
--- a/src/components/BrushSizePalette.tsx
+++ b/src/components/BrushSizePalette.tsx
@@ -11,6 +11,7 @@ import {
import { ToolType } from '../types/editor';
import { ThemePreset } from '../types/settings';
import { BRUSH_SIZE_PRESETS } from '../utils/brushPresetManager';
+import { useI18n } from '../i18n';
export interface BrushSizePaletteProps {
currentSize: number;
@@ -37,8 +38,10 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
hideHeader = false,
themePreset = 'modern',
}) => {
+ const { t, td } = useI18n();
const [showMenu, setShowMenu] = useState(false);
const menuRef = useRef<HTMLDivElement>(null);
+ const displayBrushName = activeBrushName ? td(activeBrushName) : t('Brush');
useEffect(() => {
if (!showMenu) return;
@@ -148,7 +151,7 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
<button
type="button"
onClick={() => setShowMenu((prev) => !prev)}
- title="Brush Size Options"
+ title={t('Brush Size Options')}
className="p-1 rounded-ui-xs transition-colors cursor-pointer text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover"
>
<Menu className="w-3.5 h-3.5" />
@@ -166,7 +169,7 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
className="w-full px-3 py-1.5 text-left hover:bg-ui-control-hover hover:text-ui-primary flex items-center space-x-2 cursor-pointer"
>
<RotateCcw className="w-3 h-3 text-ui-accent" />
- <span>Reset Size to Default</span>
+ <span>{t('Reset Size to Default')}</span>
</button>
)}
{onResetAllSettings && (
@@ -179,11 +182,11 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
className="w-full px-3 py-1.5 text-left hover:bg-ui-danger/15 hover:text-ui-danger flex items-center space-x-2 cursor-pointer"
>
<RotateCcw className="w-3 h-3 text-ui-danger" />
- <span>Reset All Brush Settings</span>
+ <span>{t('Reset All Brush Settings')}</span>
</button>
)}
<div className="px-3 py-1 text-[10px] font-ui-mono tabular-nums text-ui-muted border-t border-ui-subtle mt-1">
- Current: {currentSize} px
+ {t('Current: {size} px', { size: currentSize })}
</div>
</div>
)}
@@ -193,9 +196,9 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
<span
className="text-[11px] font-medium tracking-tight truncate"
- title={`Brush size [${activeBrushName || 'Brush'}]`}
+ title={t('Brush size [{name}]', { name: displayBrushName })}
>
- {activeBrushName || 'Brush'}
+ {displayBrushName}
</span>
</div>
diff --git a/src/components/BrushStudioModal.tsx b/src/components/BrushStudioModal.tsx
index 589eae6..b8f9b3e 100644
--- a/src/components/BrushStudioModal.tsx
+++ b/src/components/BrushStudioModal.tsx
@@ -45,6 +45,7 @@ import {
ImpastoWetEdgeTab,
NaturalPaintMixingTab,
} from './brushStudio/BrushStudioTabsSecondary';
+import { isImeComposing, useI18n } from '../i18n';
type StudioTabId =
| 'shape'
@@ -78,6 +79,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
onClose,
showToast,
}) => {
+ const { t, tc, td } = useI18n();
const brushSettings = useToolStore((s) => s.brushSettings);
const activePreset = useToolStore((s) => s.activePresetId) || DEFAULT_BRUSH_PRESET_ID;
@@ -98,6 +100,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.stopPropagation();
onClose();
@@ -129,8 +132,8 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
const handleSaveAsNewPreset = async (suffix: string = '') => {
const live = useToolStore.getState().brushSettings;
- const baseName = (brushName || live.brushName || 'Custom Brush').trim();
- const finalName = suffix ? `${baseName} ${suffix}` : baseName;
+ const baseName = td(brushName || live.brushName || t('Custom Brush')).trim();
+ const finalName = suffix === 'Copy' ? t('{name} Copy', { name: baseName }) : suffix ? `${baseName} ${suffix}` : baseName;
const id = `inkb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
const exported = buildExportableBrush(activePreset, getCachedCustomBrushes(), live);
const newBrush: CspBrush = {
@@ -150,7 +153,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
...prepared,
preset: newBrush.id,
});
- showToast?.(`Saved preset "${finalName}"`);
+ showToast?.(t('Saved preset "{name}"', { name: finalName }));
};
const handleResetDefault = () => {
@@ -160,7 +163,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
...restored,
preset: activePreset,
});
- showToast?.('Brush reset to default');
+ showToast?.(t('Brush reset to default'));
};
const handleExportInkb = async () => {
@@ -173,9 +176,9 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
desc: description,
};
const res = await exportBrushToInkbFile(exportBrush);
- if (res.exported) showToast?.(`Exported ${res.fileName}`);
+ if (res.exported) showToast?.(t('Exported {fileName}', { fileName: res.fileName }));
} catch (err) {
- showToast?.(err instanceof Error ? err.message : 'Export failed');
+ showToast?.(err instanceof Error ? err.message : t('Export failed'));
}
};
@@ -187,19 +190,26 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
const count = parsed.importWarnings.length;
showToast?.(
count === 1
- ? `Imported "${parsed.name}" (Notice: ${parsed.importWarnings[0]})`
- : `Imported "${parsed.name}" with ${count} CSP import notices`
+ ? t('Imported "{name}" (Notice: {notice})', {
+ name: parsed.name,
+ notice: parsed.importWarnings[0],
+ })
+ : t('Imported "{name}" with {count} CSP import notices', {
+ name: parsed.name,
+ count,
+ })
);
} else {
- showToast?.(`Imported "${parsed.name}"`);
+ showToast?.(t('Imported "{name}"', { name: parsed.name }));
}
} catch (err) {
- showToast?.(err instanceof Error ? err.message : 'Import failed');
+ showToast?.(err instanceof Error ? err.message : t('Import failed'));
}
};
if (!isOpen) return null;
+ const displayBrushName = td(brushName, 'brushName');
const isTabFeatureActive = (tabId: StudioTabId): boolean => {
switch (tabId) {
case 'texture':
@@ -219,7 +229,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
<div
role="dialog"
aria-modal="true"
- aria-label={`Brush Studio — ${brushName}`}
+ aria-label={t('Brush Studio — {name}', { name: displayBrushName })}
data-testid="brush-studio-modal"
className="fixed inset-0 z-50 bg-ui-overlay flex items-center justify-center p-4 select-none"
onPointerDown={(e) => {
@@ -235,15 +245,15 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
</div>
<div className="flex items-baseline gap-2 min-w-0">
<span className="text-[10px] font-ui-mono uppercase tracking-[0.1em] text-ui-muted shrink-0">
- Brush Studio
+ {t('Brush Studio')}
</span>
<span className="text-ui-disabled shrink-0">/</span>
<h2 className="text-[13px] font-medium tracking-tight truncate text-ui-primary">
- {brushName}
+ {displayBrushName}
</h2>
</div>
<span className="text-[9.5px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-input border border-ui-subtle text-ui-secondary uppercase shrink-0">
- {brushSettings.renderMode ?? 'stamp'}
+ {tc('renderMode', brushSettings.renderMode ?? 'stamp')}
</span>
</div>
@@ -252,7 +262,7 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
size="sm"
variant="subtle"
onClick={handleResetDefault}
- title="Reset brush to default"
+ title={t('Reset brush to default')}
icon={<RotateCcw className="w-3.5 h-3.5" />}
/>
<button
@@ -260,12 +270,12 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
onClick={() => handleSaveAsNewPreset()}
className="h-[var(--ui-control-height)] px-3 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[11px] font-medium transition-opacity cursor-pointer"
>
- Save New Preset
+ {t('Save New Preset')}
</button>
<IconButton
size="sm"
onClick={onClose}
- title="Close Brush Studio (Esc)"
+ title={t('Close Brush Studio (Esc)')}
icon={<X className="w-4 h-4" />}
/>
</div>
@@ -275,12 +285,13 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
<div className="flex-1 flex min-h-0">
{/* Left Category Navigation Rail */}
<nav
- aria-label="Brush Studio Sections"
+ aria-label={t('Brush Studio Sections')}
className="w-[164px] bg-ui-header border-r border-ui-subtle p-1.5 space-y-0.5 shrink-0 overflow-y-auto"
>
{STUDIO_TABS.map((tab) => {
const selected = activeTab === tab.id;
const featureOn = isTabFeatureActive(tab.id);
+ const tabLabel = t(tab.label);
return (
<button
key={tab.id}
@@ -304,11 +315,11 @@ export const BrushStudioModal: React.FC<BrushStudioModalProps> = ({
<span className={selected ? 'text-ui-accent shrink-0' : 'text-ui-icon-muted shrink-0'}>
{tab.icon}
</span>
- <span className="truncate">{tab.label}</span>
+ <span className="truncate">{tabLabel}</span>
</span>
{featureOn && (
<span
- aria-label={`${tab.label} active`}
+ aria-label={t('{label} active', { label: tabLabel })}
className="w-1.5 h-1.5 rounded-full bg-ui-accent shrink-0"
/>
)}
diff --git a/src/components/CanvasResizeOverlay.tsx b/src/components/CanvasResizeOverlay.tsx
index dccc47b..079c180 100644
--- a/src/components/CanvasResizeOverlay.tsx
+++ b/src/components/CanvasResizeOverlay.tsx
@@ -15,6 +15,7 @@ import { CanvasNavigationHandle, CameraTransformState } from '../hooks/useCanvas
import { screenToCanvas } from '../utils/canvasUtils';
import { resolvePointerModifierAction } from '../utils/shortcutManager';
import { uiStoreActions, useUiStore } from '../stores';
+import { useI18n } from '../i18n';
import {
CropGridMode,
CropHandleId,
@@ -247,6 +248,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
onApply,
onCancel,
}) => {
+ const { t, td } = useI18n();
const isOpen = useUiStore((s) => s.isResizeCanvasModalOpen);
const draft = useUiStore((s) => s.canvasResizeDraft);
const isInspectorCollapsed = useUiStore((s) => s.isResizeInspectorCollapsed);
@@ -605,7 +607,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
transformOrigin: 'center bottom',
}}
>
- <span className="text-ui-accent font-medium">Resample</span>
+ <span className="text-ui-accent font-medium">{t('Resample')}</span>
<span>
{cropW} × {cropH} px
</span>
@@ -833,7 +835,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
height: `${cropH}px`,
cursor: activeHandle === 'move' ? 'grabbing' : 'move',
}}
- title="Drag to reposition canvas frame · Double-click to apply"
+ title={t('Drag to reposition canvas frame · Double-click to apply')}
/>
{/* 3. Interactive Edge Hit Strips */}
@@ -916,11 +918,13 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
gridMode: cycleCropGridMode(prev.gridMode),
}))
}
- title={`Crop guide: ${getGridLabel(draft.gridMode)} (click to cycle)`}
+ title={t('Crop guide: {mode} (click to cycle)', {
+ mode: td(getGridLabel(draft.gridMode)),
+ })}
className="px-2 py-1 rounded-ui-xs text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover flex items-center gap-1.5 transition-colors cursor-pointer"
>
<Grid3X3 className="w-3.5 h-3.5" />
- <span className="hidden sm:inline">{getGridLabel(draft.gridMode)}</span>
+ <span className="hidden sm:inline">{td(getGridLabel(draft.gridMode))}</span>
</button>
<button
@@ -929,7 +933,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
onClick={() =>
uiStoreActions.updateCanvasResizeDraft((prev) => applyResetCropToDraft(prev))
}
- title="Reset crop frame to original canvas"
+ title={t('Reset crop frame to original canvas')}
className={`px-2 py-1 rounded-ui-xs flex items-center gap-1 transition-colors ${
modified
? 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer'
@@ -937,7 +941,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
}`}
>
<RotateCcw className="w-3.5 h-3.5" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</>
)}
@@ -947,7 +951,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
onClick={() =>
uiStoreActions.updateCanvasResizeDraft((prev) => applySwapDimensionsToDraft(prev))
}
- title="Swap Width and Height"
+ title={t('Swap Width and Height')}
className="px-1.5 py-1 rounded-ui-xs text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover flex items-center gap-1 transition-colors cursor-pointer"
>
<ArrowLeftRight className="w-3.5 h-3.5" />
@@ -956,7 +960,11 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
<button
type="button"
onClick={() => uiStoreActions.setResizeInspectorCollapsed(!isInspectorCollapsed)}
- title={isInspectorCollapsed ? 'Show Resize Canvas settings panel' : 'Hide Resize Canvas settings panel'}
+ title={
+ isInspectorCollapsed
+ ? t('Show Resize Canvas settings panel')
+ : t('Hide Resize Canvas settings panel')
+ }
className={`px-2 py-1 rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer ${
!isInspectorCollapsed
? 'bg-ui-accent-subtle text-ui-accent border border-ui-accent-border'
@@ -965,7 +973,7 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
>
<SlidersHorizontal className="w-3.5 h-3.5" />
<span className="hidden sm:inline">
- {isInspectorCollapsed ? 'Show Panel' : 'Panel'}
+ {isInspectorCollapsed ? t('Show Panel') : t('Panel')}
</span>
</button>
@@ -974,21 +982,21 @@ export const CanvasResizeOverlay: React.FC<CanvasResizeOverlayProps> = ({
<button
type="button"
onClick={handleCancel}
- title="Cancel (Esc)"
+ title={t('Cancel (Esc)')}
className="px-2 py-1 rounded-ui-xs text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover flex items-center gap-1 transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
- <span>Cancel</span>
+ <span>{t('Cancel')}</span>
</button>
<button
type="button"
onClick={handleConfirm}
- title="Apply Resize / Crop (Enter)"
+ title={t('Apply Resize / Crop (Enter)')}
className="px-2.5 py-1 rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium flex items-center gap-1 transition-opacity cursor-pointer"
>
<Check className="w-3.5 h-3.5" />
- <span>{draft.scaleContent ? 'Resize' : 'Apply'}</span>
+ <span>{draft.scaleContent ? t('Resize') : t('Apply')}</span>
</button>
</div>,
document.body
diff --git a/src/components/ChangelogBox.tsx b/src/components/ChangelogBox.tsx
index 1ac2fb4..619bb52 100644
--- a/src/components/ChangelogBox.tsx
+++ b/src/components/ChangelogBox.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import { ChangelogEntry } from '../utils/changelog';
+import { useI18n } from '../i18n';
export interface ChangelogBoxProps {
entry: ChangelogEntry;
@@ -47,6 +48,7 @@ export const ChangelogBox: React.FC<ChangelogBoxProps> = ({
entry,
maxHeightClass = 'max-h-44',
}) => {
+ const { td } = useI18n();
return (
<div
className={`bg-ui-header rounded-ui-md border border-ui-subtle p-3 ${maxHeightClass} overflow-y-auto space-y-3 select-text`}
@@ -58,7 +60,7 @@ export const ChangelogBox: React.FC<ChangelogBoxProps> = ({
<div key={`${section.title || 'items'}-${sectionIdx}`} className="space-y-1">
{section.title && (
<div className={`text-[10px] font-semibold uppercase tracking-wider ${titleColor}`}>
- {section.title}
+ {td(section.title, 'changelog')}
</div>
)}
<ul className="space-y-1 pl-3.5 list-disc text-[11px] text-ui-secondary leading-relaxed">
diff --git a/src/components/ClipboardInviteToast.tsx b/src/components/ClipboardInviteToast.tsx
index 0581f7e..3181550 100644
--- a/src/components/ClipboardInviteToast.tsx
+++ b/src/components/ClipboardInviteToast.tsx
@@ -5,6 +5,7 @@ import {
ParsedInviteLink,
ParsedP2pInvite,
} from '../services/multiplayerService';
+import { useI18n } from '../i18n';
function isP2pInvite(
invite: ParsedCollabTarget | ParsedInviteLink
@@ -31,6 +32,7 @@ export const ClipboardInviteToast: React.FC<ClipboardInviteToastProps> = ({
onJoinTarget,
onDismiss,
}) => {
+ const { t } = useI18n();
if (!invite) return null;
const subtitle = isP2pInvite(invite)
@@ -61,11 +63,11 @@ export const ClipboardInviteToast: React.FC<ClipboardInviteToastProps> = ({
<div className="max-w-xs sm:max-w-sm min-w-0">
<div className="flex items-center gap-1.5">
<span className="text-[11px] font-semibold text-ui-primary">
- Invitation Detected
+ {t('Invitation Detected')}
</span>
</div>
<div className="text-[11px] text-ui-secondary truncate">
- Room: <span className="font-medium text-ui-primary">"{invite.roomName}"</span>
+ {t('Room: "{name}"', { name: invite.roomName })}
</div>
<div className="text-[10px] text-ui-muted font-ui-mono tabular-nums truncate">{subtitle}</div>
</div>
@@ -76,15 +78,15 @@ export const ClipboardInviteToast: React.FC<ClipboardInviteToastProps> = ({
onClick={handleConnect}
className="flex items-center justify-center gap-1 min-h-[44px] min-w-[44px] rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:bg-ui-accent-hover px-3 py-1.5 text-xs font-medium transition-colors cursor-pointer"
>
- <span>Connect</span>
+ <span>{t('Connect')}</span>
<ArrowRight className="w-3.5 h-3.5" />
</button>
<button
type="button"
onClick={onDismiss}
- aria-label="Dismiss invitation"
- title="Dismiss"
+ aria-label={t('Dismiss invitation')}
+ title={t('Dismiss')}
className="w-11 h-11 rounded-ui-sm flex items-center justify-center text-ui-muted hover:bg-ui-control-hover hover:text-ui-primary transition-colors cursor-pointer"
>
<X className="w-4 h-4" />
diff --git a/src/components/CloseConfirmModal.tsx b/src/components/CloseConfirmModal.tsx
index cfbca56..57d9b59 100644
--- a/src/components/CloseConfirmModal.tsx
+++ b/src/components/CloseConfirmModal.tsx
@@ -8,6 +8,23 @@ import {
findNextPendingDirtyIndex,
formatCanvasDisplayName,
} from '../utils/appCloseFlow';
+import { isImeComposing, useI18n } from '../i18n';
+
+function renderHighlightedTemplate(
+ template: string,
+ token: string,
+ highlight: React.ReactNode
+): React.ReactNode {
+ const idx = template.indexOf(token);
+ if (idx === -1) return template;
+ return (
+ <>
+ {template.slice(0, idx)}
+ {highlight}
+ {template.slice(idx + token.length)}
+ </>
+ );
+}
export interface CloseConfirmModalProps {
onSaveDocumentById: (docId: string) => Promise<SaveDocumentResult>;
@@ -16,6 +33,7 @@ export interface CloseConfirmModalProps {
export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
({ onSaveDocumentById, onFinalizeClose }) => {
+ const { t } = useI18n();
const prompt = useUiStore((s) => s.appClosePrompt);
const documents = useDocumentStore((s) => s.documents);
@@ -34,6 +52,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
useEffect(() => {
if (!prompt.isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !useUiStore.getState().appClosePrompt.isBusy) {
e.preventDefault();
e.stopPropagation();
@@ -151,8 +170,8 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
<button
type="button"
onClick={handleCancel}
- aria-label="Cancel close"
- title="Cancel (Esc)"
+ aria-label={t('Cancel close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -168,25 +187,33 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
<div className="flex-1 min-w-0 space-y-1 text-[12.5px] leading-relaxed text-ui-primary">
{prompt.step === 'confirm-quit' && (
- <p>Are you sure you want to close Ink Studio?</p>
+ <p>{t('Are you sure you want to close Ink Studio?')}</p>
)}
{prompt.step === 'summary' && (
<>
<p>
- There are <span className="font-semibold text-ui-primary tabular-nums">{totalPending}</span>{' '}
- canvases with unsaved changes.
+ {renderHighlightedTemplate(
+ t('There are {count} canvases with unsaved changes.'),
+ '{count}',
+ <span className="font-semibold text-ui-primary tabular-nums">
+ {totalPending}
+ </span>
+ )}
</p>
<p className="text-ui-secondary">
- Do you want to confirm these changes before closing?
+ {t('Do you want to confirm these changes before closing?')}
</p>
</>
)}
{prompt.step === 'per-canvas' && (
<p className="break-words">
- <span className="font-semibold text-ui-primary">{currentDocName}</span> has been
- changed. Do you want to save it?
+ {renderHighlightedTemplate(
+ t('{name} has been changed. Do you want to save it?'),
+ '{name}',
+ <span className="font-semibold text-ui-primary">{currentDocName}</span>
+ )}
</p>
)}
</div>
@@ -207,7 +234,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 disabled:opacity-50 font-medium transition-opacity cursor-pointer inline-flex items-center gap-1.5"
>
{prompt.isBusy && <Loader2 className="w-3.5 h-3.5 animate-spin" />}
- <span>Close</span>
+ <span>{t('Close')}</span>
</button>
<button
type="button"
@@ -215,7 +242,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
onClick={handleCancel}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default disabled:opacity-50 text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</>
)}
@@ -229,7 +256,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
onClick={() => void handleConfirmChanges()}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 disabled:opacity-50 font-medium transition-opacity cursor-pointer"
>
- Confirm changes...
+ {t('Confirm changes...')}
</button>
<button
type="button"
@@ -238,7 +265,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default disabled:opacity-50 text-ui-primary transition-colors cursor-pointer inline-flex items-center gap-1.5"
>
{prompt.isBusy && <Loader2 className="w-3.5 h-3.5 animate-spin" />}
- <span>Discard changes</span>
+ <span>{t('Discard changes')}</span>
</button>
<button
type="button"
@@ -246,7 +273,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
onClick={handleCancel}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default disabled:opacity-50 text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</>
)}
@@ -261,7 +288,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
className="px-4 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 disabled:opacity-50 font-medium transition-opacity cursor-pointer inline-flex items-center gap-1.5"
>
{prompt.isBusy && <Loader2 className="w-3.5 h-3.5 animate-spin" />}
- <span>{prompt.isBusy ? 'Saving...' : 'Save'}</span>
+ <span>{prompt.isBusy ? t('Saving...') : t('Save')}</span>
</button>
<button
type="button"
@@ -269,7 +296,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
onClick={() => void handleDoNotSaveCurrent()}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default disabled:opacity-50 text-ui-primary transition-colors cursor-pointer"
>
- Do Not Save
+ {t('Do Not Save')}
</button>
<button
type="button"
@@ -277,7 +304,7 @@ export const CloseConfirmModal: React.FC<CloseConfirmModalProps> = React.memo(
onClick={handleCancel}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default disabled:opacity-50 text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</>
)}
diff --git a/src/components/CollabRoomOverlay.tsx b/src/components/CollabRoomOverlay.tsx
index 62e5901..d7152c7 100644
--- a/src/components/CollabRoomOverlay.tsx
+++ b/src/components/CollabRoomOverlay.tsx
@@ -24,6 +24,7 @@ import type {
SessionHostInfo,
} from '../types/multiplayer';
import { peerIdEquals } from '../utils/collabPermissions';
+import { isImeComposing, t as translateStatic, useI18n } from '../i18n';
export interface CollabRoomOverlayProps {
isConnected: boolean;
@@ -72,29 +73,41 @@ function buildDiagnosticsTooltip(
diagnostics.transport ?? (hostInfo?.transport === 'webrtc' ? 'webrtc' : 'ws');
const transportLine =
effectiveTransport === 'webrtc'
- ? `Transport: WebRTC (${
- diagnostics.iceCandidateType === 'relay'
- ? 'TURN relay'
- : diagnostics.iceCandidateType
- ? `P2P · ${diagnostics.iceCandidateType}`
- : 'P2P'
- })`
- : 'Transport: WebSocket';
+ ? translateStatic('Transport: WebRTC ({mode})', {
+ mode:
+ diagnostics.iceCandidateType === 'relay'
+ ? translateStatic('TURN relay')
+ : diagnostics.iceCandidateType
+ ? `P2P · ${diagnostics.iceCandidateType}`
+ : 'P2P',
+ })
+ : translateStatic('Transport: WebSocket');
const pingLine =
diagnostics.rttMs !== null
- ? `Ping: ${Math.round(diagnostics.rttMs)} ms`
- : 'Ping: measuring...';
- const throughputLine = `TX: ${formatByteRate(diagnostics.txBytesPerSec)} (${diagnostics.txMsgsPerSec.toFixed(1)} msg/s) · RX: ${formatByteRate(diagnostics.rxBytesPerSec)} (${diagnostics.rxMsgsPerSec.toFixed(1)} msg/s)`;
- const queueLine = `Tile queue: ${diagnostics.tileQueueDepth} · Dropped ephemeral: ${diagnostics.droppedEphemeralCount}`;
+ ? translateStatic('Ping: {ms} ms', { ms: Math.round(diagnostics.rttMs) })
+ : translateStatic('Ping: measuring...');
+ const throughputLine = translateStatic(
+ 'TX: {txRate} ({txMsgs} msg/s) · RX: {rxRate} ({rxMsgs} msg/s)',
+ {
+ txRate: formatByteRate(diagnostics.txBytesPerSec),
+ txMsgs: diagnostics.txMsgsPerSec.toFixed(1),
+ rxRate: formatByteRate(diagnostics.rxBytesPerSec),
+ rxMsgs: diagnostics.rxMsgsPerSec.toFixed(1),
+ }
+ );
+ const queueLine = translateStatic('Tile queue: {queue} · Dropped ephemeral: {dropped}', {
+ queue: diagnostics.tileQueueDepth,
+ dropped: diagnostics.droppedEphemeralCount,
+ });
const lines = [transportLine, pingLine, throughputLine, queueLine];
if (diagnostics.lastAuditAt !== null) {
const auditLabel =
diagnostics.lastAuditStatus === 'resyncing'
- ? `Resyncing (${diagnostics.auditResyncCount})`
+ ? translateStatic('Resyncing ({count})', { count: diagnostics.auditResyncCount })
: diagnostics.auditResyncCount > 0
- ? `OK (${diagnostics.auditResyncCount} healed)`
- : 'OK';
- lines.push(`Sync audit: ${auditLabel}`);
+ ? translateStatic('OK ({count} healed)', { count: diagnostics.auditResyncCount })
+ : translateStatic('OK');
+ lines.push(translateStatic('Sync audit: {status}', { status: auditLabel }));
}
return lines.join('\n');
}
@@ -136,6 +149,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
diagnostics = null,
isWebtoonMode = false,
}) => {
+ const { t, td } = useI18n();
const [isMinimized, setIsMinimized] = useState(false);
const [activeTab, setActiveTab] = useState<'participants' | 'chat'>('participants');
const [chatDraft, setChatDraft] = useState('');
@@ -167,7 +181,13 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
? peers.find((p) => peerIdEquals(p.id, followingPeerId)) || null
: null;
- const roomTitle = hostInfo?.roomName || 'Collab Room';
+ const formatRoleLabel = (role?: string, isPeerHost?: boolean): string => {
+ if (isPeerHost || role === 'host') return t('Host');
+ if (role === 'viewer') return t('Viewer');
+ return t('Editor');
+ };
+
+ const roomTitle = hostInfo?.roomName || t('Collab Room');
const totalCount = peers.length + 1;
const topOffsetClass = isWebtoonMode ? 'top-12' : 'top-3';
@@ -202,6 +222,13 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
};
const handleChatInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
+ if (isImeComposing(e)) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ }
+ e.stopPropagation();
+ return;
+ }
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -233,10 +260,10 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
/>
<Eye className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span className="font-medium whitespace-nowrap">
- Following <span className="text-ui-primary font-semibold">{followingPeer.name}</span>&apos;s camera
+ {t("Following {name}'s camera", { name: followingPeer.name })}
</span>
<span className="text-[10px] text-ui-muted hidden sm:inline whitespace-nowrap">
- · Pan/zoom to exit
+ {t('· Pan/zoom to exit')}
</span>
<button
type="button"
@@ -244,7 +271,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
onClick={onStopFollowing}
className="ml-1 rounded-full bg-ui-control hover:bg-ui-control-hover border border-ui-subtle px-2 py-0.5 text-[10px] font-medium text-ui-primary transition-colors cursor-pointer"
>
- Stop
+ {t('Stop')}
</button>
</div>
</>
@@ -272,7 +299,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
type="button"
onClick={() => setIsMinimized(false)}
className="max-w-28 truncate font-medium text-ui-primary hover:opacity-90 cursor-pointer"
- title="Expand Room Overlay"
+ title={t('Expand Room Overlay')}
>
{roomTitle}
</button>
@@ -282,7 +309,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
setActiveTab('participants');
setIsMinimized(false);
}}
- title="Show Participants"
+ title={t('Show Participants')}
className="flex items-center gap-1 rounded-full bg-ui-control hover:bg-ui-control-hover border border-ui-subtle px-1.5 py-0.5 text-[10px] font-ui-mono tabular-nums text-ui-primary transition-colors cursor-pointer"
>
<Users className="w-3 h-3 text-ui-accent" />
@@ -295,7 +322,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
setActiveTab('chat');
setIsMinimized(false);
}}
- title="Open Room Chat"
+ title={t('Open Room Chat')}
className="relative flex items-center gap-1 rounded-full bg-ui-control hover:bg-ui-control-hover border border-ui-subtle px-1.5 py-0.5 text-[10px] text-ui-primary transition-colors cursor-pointer"
>
<MessageSquare className="w-3 h-3" />
@@ -322,8 +349,8 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
type="button"
data-testid="collab-expand-btn"
onClick={() => setIsMinimized(false)}
- aria-label="Expand Room Overlay"
- title="Expand Room Overlay"
+ aria-label={t('Expand Room Overlay')}
+ title={t('Expand Room Overlay')}
className="w-5 h-5 rounded-full flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<ChevronDown className="w-3.5 h-3.5" />
@@ -340,10 +367,10 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
}`}
/>
<span className="text-[11px] font-semibold text-ui-primary truncate">
- {isReconnecting ? 'Reconnecting...' : roomTitle}
+ {isReconnecting ? t('Reconnecting...') : roomTitle}
</span>
<span className="text-[9px] font-ui-mono uppercase px-1.5 py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-muted shrink-0">
- {myRole}
+ {formatRoleLabel(myRole)}
</span>
</div>
<div className="flex items-center gap-0.5 shrink-0">
@@ -363,8 +390,8 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
<button
type="button"
onClick={onOpenHostModal}
- title="Room Settings & Invite Link"
- aria-label="Room Settings & Invite Link"
+ title={t('Room Settings & Invite Link')}
+ aria-label={t('Room Settings & Invite Link')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Settings2 className="w-3.5 h-3.5" />
@@ -373,8 +400,8 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
type="button"
data-testid="collab-minimize-btn"
onClick={() => setIsMinimized(true)}
- title="Minimize Room Overlay"
- aria-label="Minimize Room Overlay"
+ title={t('Minimize Room Overlay')}
+ aria-label={t('Minimize Room Overlay')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<ChevronUp className="w-3.5 h-3.5" />
@@ -391,8 +418,10 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
<div className="flex items-center gap-1.5 min-w-0">
<Paintbrush className="w-3 h-3 text-ui-accent shrink-0" />
<span className="truncate text-ui-primary">
- Trying <span className="font-medium">{activeGrabbedBrush.peerName}</span>&apos;s{' '}
- <span className="font-semibold text-ui-primary">{activeGrabbedBrush.brushName}</span>
+ {t("Trying {peerName}'s {brushName}", {
+ peerName: activeGrabbedBrush.peerName,
+ brushName: td(activeGrabbedBrush.brushName),
+ })}
</span>
</div>
<div className="flex items-center gap-1 shrink-0">
@@ -400,16 +429,16 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
type="button"
data-testid="collab-save-grabbed-brush-btn"
onClick={onSaveGrabbedBrush}
- title="Save this brush permanently to your Custom Brushes"
+ title={t('Save this brush permanently to your Custom Brushes')}
className="flex items-center gap-1 rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 px-1.5 py-0.5 text-[10px] font-medium transition-opacity cursor-pointer"
>
<BookmarkPlus className="w-3 h-3" />
- <span>Save</span>
+ <span>{t('Save')}</span>
</button>
<button
type="button"
onClick={onDismissGrabbedBrush}
- aria-label="Dismiss grabbed brush banner"
+ aria-label={t('Dismiss grabbed brush banner')}
className="p-0.5 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary cursor-pointer"
>
<X className="w-3 h-3" />
@@ -431,7 +460,9 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
}`}
>
<Users className="w-3.5 h-3.5" />
- <span className="tabular-nums">Participants ({totalCount})</span>
+ <span className="tabular-nums">
+ {t('Participants ({count})', { count: totalCount })}
+ </span>
</button>
<button
type="button"
@@ -444,7 +475,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
}`}
>
<MessageSquare className="w-3.5 h-3.5" />
- <span>Chat</span>
+ <span>{t('Chat')}</span>
{unreadChatCount > 0 && (
<span
data-testid="collab-unread-badge"
@@ -468,9 +499,9 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
/>
<div className="min-w-0">
<div className="text-[11px] font-medium text-ui-primary truncate">
- {myPeer.name} <span className="text-ui-muted font-normal">(You)</span>
+ {t('{name} (You)', { name: myPeer.name })}
</div>
- <div className="text-[9px] text-ui-muted capitalize">{myRole}</div>
+ <div className="text-[9px] text-ui-muted">{formatRoleLabel(myRole)}</div>
</div>
</div>
<button
@@ -478,11 +509,11 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
data-testid="collab-share-my-brush-btn"
onClick={onShareMyBrush}
disabled={!isConnected}
- title="Share your active brush (tip & texture) with everyone in the room"
+ title={t('Share your active brush (tip & texture) with everyone in the room')}
className="flex items-center gap-1 rounded-ui-xs border border-ui-default bg-ui-control hover:bg-ui-control-hover hover:border-ui-strong disabled:opacity-40 px-2 py-1 text-[10px] font-medium text-ui-primary transition-colors shrink-0 cursor-pointer"
>
<Share2 className="w-3 h-3 text-ui-accent" />
- <span>Share Brush</span>
+ <span>{t('Share Brush')}</span>
</button>
</div>
@@ -490,14 +521,14 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
{peers.length === 0 ? (
<div className="px-3 py-5 text-center space-y-2">
<p className="text-[11px] text-ui-muted">
- Waiting for other artists to join...
+ {t('Waiting for other artists to join...')}
</p>
<button
type="button"
onClick={onOpenHostModal}
className="rounded-ui-xs border border-ui-default bg-ui-control hover:bg-ui-control-hover px-2.5 py-1 text-[10px] font-medium text-ui-primary transition-colors cursor-pointer"
>
- Copy Invite Link / Code
+ {t('Copy Invite Link / Code')}
</button>
</div>
) : (
@@ -506,11 +537,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
followingPeerId !== null && peerIdEquals(followingPeerId, peer.id);
const isGrabbing =
grabbingPeerId !== null && peerIdEquals(grabbingPeerId, peer.id);
- const peerRoleLabel = peer.isHost
- ? 'Host'
- : peer.role === 'viewer'
- ? 'Viewer'
- : 'Editor';
+ const peerRoleLabel = formatRoleLabel(peer.role, peer.isHost);
return (
<div
@@ -528,8 +555,10 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
disabled={!isConnected}
title={
isFollowing
- ? `Stop following ${peer.name}'s camera`
- : `Click to follow ${peer.name}'s camera in real time`
+ ? t("Stop following {name}'s camera", { name: peer.name })
+ : t("Click to follow {name}'s camera in real time", {
+ name: peer.name,
+ })
}
className="flex-1 min-w-0 flex items-center gap-2 text-left rounded-ui-xs py-0.5 px-1 -ml-1 hover:bg-ui-control-hover transition-colors cursor-pointer disabled:opacity-50"
>
@@ -555,16 +584,18 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
{isFollowing ? (
<span className="text-ui-accent font-medium flex items-center gap-1">
<Eye className="w-2.5 h-2.5 shrink-0" />
- <span>Following camera</span>
+ <span>{t('Following camera')}</span>
</span>
) : peer.activeBrushName ? (
<span className="text-ui-muted truncate">
- {peer.activeBrushName} · Click to follow
+ {t('{brush} · Click to follow', {
+ brush: td(peer.activeBrushName),
+ })}
</span>
) : (
<span className="text-ui-muted flex items-center gap-1">
<Eye className="w-2.5 h-2.5 shrink-0 opacity-70" />
- <span>Follow camera</span>
+ <span>{t('Follow camera')}</span>
</span>
)}
</div>
@@ -580,8 +611,8 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
onGrabPeerBrush(peer.id);
}}
disabled={!isConnected || isGrabbing}
- title={`Try ${peer.name}'s Brush`}
- aria-label={`Try ${peer.name}'s Brush`}
+ title={t("Try {name}'s Brush", { name: peer.name })}
+ aria-label={t("Try {name}'s Brush", { name: peer.name })}
className="flex items-center gap-1 rounded-ui-xs border border-ui-default bg-ui-control hover:bg-ui-control-hover hover:border-ui-accent-border disabled:opacity-50 px-2 py-1 text-[10px] font-medium text-ui-primary transition-colors shrink-0 cursor-pointer"
>
{isGrabbing ? (
@@ -589,7 +620,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
) : (
<Paintbrush className="w-3 h-3 text-ui-accent" />
)}
- <span>Try Brush</span>
+ <span>{t('Try Brush')}</span>
</button>
</div>
);
@@ -606,9 +637,9 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
{chatMessages.length === 0 ? (
<div className="h-full flex flex-col items-center justify-center text-center px-4 text-ui-muted space-y-1">
<MessageSquare className="w-5 h-5 opacity-40" />
- <p className="text-[11px]">No messages yet</p>
+ <p className="text-[11px]">{t('No messages yet')}</p>
<p className="text-[10px] text-ui-muted opacity-80">
- Chat with desktop &amp; browser guests right here on the canvas.
+ {t('Chat with desktop & browser guests right here on the canvas.')}
</p>
</div>
) : (
@@ -629,7 +660,9 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
style={{ backgroundColor: msg.senderColor }}
/>
<span className="font-semibold text-[10px] text-ui-primary truncate">
- {msg.isLocal ? `${msg.senderName} (You)` : msg.senderName}
+ {msg.isLocal
+ ? t('{name} (You)', { name: msg.senderName })
+ : msg.senderName}
</span>
</div>
<span className="text-[9px] font-ui-mono tabular-nums text-ui-muted shrink-0">
@@ -641,7 +674,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
<div className="flex items-center gap-1.5 min-w-0">
<Paintbrush className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span className="text-[11px] font-medium text-ui-primary truncate">
- {msg.sharedBrush.brushName}
+ {td(msg.sharedBrush.brushName)}
</span>
</div>
{!msg.isLocal && (
@@ -651,7 +684,7 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
onClick={() => onTrySharedBrush(msg.sharedBrush!)}
className="rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 px-2 py-0.5 text-[10px] font-medium shrink-0 transition-opacity cursor-pointer"
>
- Try Brush
+ {t('Try Brush')}
</button>
)}
</div>
@@ -680,15 +713,15 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
onKeyDown={handleChatInputKeyDown}
disabled={!isConnected}
maxLength={1000}
- placeholder={isConnected ? 'Message room...' : 'Reconnecting...'}
+ placeholder={isConnected ? t('Message room...') : t('Reconnecting...')}
className="flex-1 min-w-0 rounded-ui-sm border border-ui-default bg-ui-input px-2.5 py-1.5 text-[11px] text-ui-primary placeholder:text-ui-muted focus:border-ui-focus focus:outline-hidden disabled:opacity-50"
/>
<button
type="button"
onClick={onShareMyBrush}
disabled={!isConnected}
- title="Share your current brush to chat"
- aria-label="Share your current brush to chat"
+ title={t('Share your current brush to chat')}
+ aria-label={t('Share your current brush to chat')}
className="w-7 h-7 rounded-ui-sm border border-ui-subtle bg-ui-control hover:bg-ui-control-hover disabled:opacity-40 flex items-center justify-center text-ui-icon-muted hover:text-ui-accent transition-colors shrink-0 cursor-pointer"
>
<Paintbrush className="w-3.5 h-3.5" />
@@ -697,8 +730,8 @@ export const CollabRoomOverlay: React.FC<CollabRoomOverlayProps> = React.memo(
type="submit"
data-testid="collab-chat-send-btn"
disabled={!isConnected || !chatDraft.trim()}
- title="Send message (Enter)"
- aria-label="Send message"
+ title={t('Send message (Enter)')}
+ aria-label={t('Send message')}
className="w-7 h-7 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 disabled:opacity-40 flex items-center justify-center transition-opacity shrink-0 cursor-pointer"
>
<Send className="w-3.5 h-3.5" />
diff --git a/src/components/ColorHistoryPanel.tsx b/src/components/ColorHistoryPanel.tsx
index 462f6d3..07d26d0 100644
--- a/src/components/ColorHistoryPanel.tsx
+++ b/src/components/ColorHistoryPanel.tsx
@@ -11,6 +11,7 @@ import {
SwatchColumnCount,
uiStoreActions,
} from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
export interface ColorHistoryPanelProps {
colorMode?: CanvasColorMode;
@@ -40,12 +41,14 @@ function clampPopoverPosition(
export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
({ colorMode = 'color', containerWidth = 224 }) => {
+ const { t, td } = useI18n();
const recentColors = useToolStore((s) => s.recentColors);
const primaryColor = useToolStore((s) => s.primaryColor);
const columns = useColorSetsStore((s) => s.historyColumns);
const activeSetName = useColorSetsStore(
(s) => s.sets.find((set) => set.id === s.activeSetId)?.name ?? s.sets[0]?.name ?? 'Color Set'
);
+ const activeSetDisplayName = td(activeSetName);
const isNarrow = containerWidth < 132;
const [hoveredHex, setHoveredHex] = useState<string | null>(null);
@@ -63,6 +66,7 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
setContextMenu(null);
};
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setContextMenu(null);
};
window.addEventListener('mousedown', onPointerDown);
@@ -77,22 +81,30 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
(hex: string) => {
const added = colorSetsStoreActions.addSwatch(hex);
if (added) {
- uiStoreActions.showToast(`Added ${added.hex.toUpperCase()} to "${activeSetName}"`);
+ uiStoreActions.showToast(
+ t('Added {hex} to "{set}"', {
+ hex: added.hex.toUpperCase(),
+ set: activeSetDisplayName,
+ })
+ );
}
setContextMenu(null);
},
- [activeSetName]
+ [activeSetDisplayName, t]
);
- const handleCopyHex = useCallback((hex: string) => {
- try {
- void navigator.clipboard?.writeText(hex.toUpperCase());
- } catch {
- // Ignore clipboard errors
- }
- uiStoreActions.showToast(`Copied ${hex.toUpperCase()}`);
- setContextMenu(null);
- }, []);
+ const handleCopyHex = useCallback(
+ (hex: string) => {
+ try {
+ void navigator.clipboard?.writeText(hex.toUpperCase());
+ } catch {
+ // Ignore clipboard errors
+ }
+ uiStoreActions.showToast(t('Copied {hex}', { hex: hex.toUpperCase() }));
+ setContextMenu(null);
+ },
+ [t]
+ );
const normalizedPrimary = primaryColor.toLowerCase();
const swatchHeightClass = getSwatchHeightClass(columns);
@@ -119,12 +131,12 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
<div className="flex items-center gap-1 shrink-0">
<label
className="flex items-center gap-1 shrink-0 text-ui-muted"
- title="Swatches per row (1–8)"
+ title={t('Swatches per row (1–8)')}
>
{!isNarrow && <LayoutGrid className="w-2.5 h-2.5 text-ui-icon-muted shrink-0" />}
<select
data-testid="color-history-columns-select"
- aria-label="Color History columns"
+ aria-label={t('Color History columns')}
value={columns}
onChange={(e) =>
colorSetsStoreActions.setHistoryColumns(
@@ -146,8 +158,8 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
data-testid="color-history-clear-btn"
disabled={recentColors.length === 0}
onClick={() => toolStoreActions.clearRecentColors()}
- title="Clear Color History"
- aria-label="Clear Color History"
+ title={t('Clear Color History')}
+ aria-label={t('Clear Color History')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center shrink-0 transition-colors ${
recentColors.length === 0
? 'text-ui-disabled cursor-not-allowed'
@@ -166,7 +178,7 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
>
{recentColors.length === 0 ? (
<div className="h-full min-h-[64px] flex items-center justify-center px-2 text-center text-[11px] text-ui-muted">
- No recent colors
+ {t('No recent colors')}
</div>
) : (
<div
@@ -188,9 +200,12 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
data-testid={`color-history-swatch-${idx}`}
data-hex={hex}
data-active={isActive ? 'true' : undefined}
- aria-label={`Recent color ${hex.toUpperCase()}`}
+ aria-label={t('Recent color {color}', { color: hex.toUpperCase() })}
aria-pressed={isActive}
- title={`${hex.toUpperCase()} — Click: Primary · Middle: Secondary · Right-click: Add to "${activeSetName}"`}
+ title={t(
+ '{hex} — Click: Primary · Middle: Secondary · Right-click: Add to "{set}"',
+ { hex: hex.toUpperCase(), set: activeSetDisplayName }
+ )}
onClick={() => toolStoreActions.setPrimaryColor(hex, false, colorMode)}
onAuxClick={(e) => {
if (e.button === 1) {
@@ -222,8 +237,14 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
e.stopPropagation();
handleAddToActiveSet(hex);
}}
- title={`Add ${hex.toUpperCase()} to "${activeSetName}"`}
- aria-label={`Add ${hex.toUpperCase()} to ${activeSetName}`}
+ title={t('Add {hex} to "{set}"', {
+ hex: hex.toUpperCase(),
+ set: activeSetDisplayName,
+ })}
+ aria-label={t('Add {hex} to {set}', {
+ hex: hex.toUpperCase(),
+ set: activeSetDisplayName,
+ })}
className="opacity-0 group-hover:opacity-100 focus:opacity-100 absolute right-1 top-1/2 -translate-y-1/2 z-20 w-4 h-4 rounded-ui-xs flex items-center justify-center bg-ui-elevated/90 border border-ui-default text-ui-primary hover:bg-ui-control-active cursor-pointer transition-opacity"
>
<Plus className="w-2.5 h-2.5" />
@@ -253,11 +274,14 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
type="button"
data-testid="color-history-add-to-set-btn"
onClick={() => handleAddToActiveSet(footerColor)}
- title={`Add ${footerColor.toUpperCase()} to "${activeSetName}"`}
+ title={t('Add {hex} to "{set}"', {
+ hex: footerColor.toUpperCase(),
+ set: activeSetDisplayName,
+ })}
className="h-4.5 px-1.5 rounded-ui-xs flex items-center gap-0.5 text-[10px] bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors shrink-0"
>
<Plus className="w-2.5 h-2.5" />
- <span>Set</span>
+ <span>{t('Set')}</span>
</button>
</div>
)}
@@ -294,7 +318,9 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Plus className="w-3 h-3 text-ui-accent shrink-0" />
- <span className="truncate">Add to "{activeSetName}"</span>
+ <span className="truncate">
+ {t('Add to "{set}"', { set: activeSetDisplayName })}
+ </span>
</button>
<button
@@ -306,7 +332,7 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
}}
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
- <span>Set Secondary Color</span>
+ <span>{t('Set Secondary Color')}</span>
</button>
<button
@@ -316,7 +342,7 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Copy className="w-3 h-3 text-ui-icon-muted" />
- <span>Copy Hex</span>
+ <span>{t('Copy Hex')}</span>
</button>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -331,7 +357,7 @@ export const ColorHistoryPanel: React.FC<ColorHistoryPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<X className="w-3 h-3" />
- <span>Remove from History</span>
+ <span>{t('Remove from History')}</span>
</button>
</div>,
document.body
diff --git a/src/components/ColorPanel.tsx b/src/components/ColorPanel.tsx
index fdcc823..49358bd 100644
--- a/src/components/ColorPanel.tsx
+++ b/src/components/ColorPanel.tsx
@@ -24,6 +24,7 @@ import {
colorSetsStoreActions,
toolStoreActions,
} from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
export interface ColorPanelProps {
primaryColor: string;
@@ -56,6 +57,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
containerWidth = 180,
containerHeight,
}) => {
+ const { t } = useI18n();
const [activeTab, setActiveTab] = useState<ColorPanelTab>(() => {
try {
const saved = localStorage.getItem('ink_color_tab');
@@ -214,6 +216,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
setHistoryOpen(false);
};
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setHistoryOpen(false);
};
const onReposition = () => {
@@ -271,7 +274,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
<button
type="button"
onClick={() => setActiveTarget('primary')}
- title={`Primary: ${primaryColor.toUpperCase()}`}
+ title={t('Primary: {color}', { color: primaryColor.toUpperCase() })}
className={`w-3.5 h-3.5 rounded-ui-xs cursor-pointer transition-transform ${
activeTarget === 'primary'
? 'scale-110 ring-[1.5px] ring-ui-accent'
@@ -282,7 +285,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
<button
type="button"
onClick={() => setActiveTarget('secondary')}
- title={`Secondary: ${secondaryColor.toUpperCase()}`}
+ title={t('Secondary: {color}', { color: secondaryColor.toUpperCase() })}
className={`w-3.5 h-3.5 rounded-ui-xs cursor-pointer transition-transform ${
activeTarget === 'secondary'
? 'scale-110 ring-[1.5px] ring-ui-accent'
@@ -295,8 +298,8 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
<button
type="button"
onClick={onSwapColors}
- title="Swap Colors (X)"
- aria-label="Swap Colors"
+ title={t('Swap Colors (X)')}
+ aria-label={t('Swap Colors')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer transition-colors"
>
<ArrowLeftRight className="w-2.5 h-2.5" />
@@ -309,7 +312,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
type="button"
data-testid="color-panel-tab-wheel"
onClick={() => selectTab('wheel')}
- title="Color Wheel"
+ title={t('Color Wheel')}
aria-pressed={activeTab === 'wheel'}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeTab === 'wheel'
@@ -324,7 +327,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
type="button"
data-testid="color-panel-tab-slider"
onClick={() => selectTab('slider')}
- title="Color Sliders"
+ title={t('Color Sliders')}
aria-pressed={activeTab === 'slider'}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeTab === 'slider'
@@ -349,12 +352,12 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
}}
title={
isSphereFloating
- ? '3D Sphere (Floating — click to dock)'
+ ? t('3D Sphere (Floating — click to dock)')
: activeTab === 'sphere'
- ? '3D Sphere (Docked — click to unpin & float)'
- : '3D Sphere Color Picker'
+ ? t('3D Sphere (Docked — click to unpin & float)')
+ : t('3D Sphere Color Picker')
}
- aria-label="3D Sphere Color Picker"
+ aria-label={t('3D Sphere Color Picker')}
aria-pressed={activeTab === 'sphere' || isSphereFloating}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeTab === 'sphere' || isSphereFloating
@@ -379,10 +382,10 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
onClick={handleToggleInlineSliders}
title={
activeTab === 'wheel' && showInlineSlidersBelowWheel
- ? 'Hide Sliders Below Wheel'
- : 'Show Sliders Below Wheel'
+ ? t('Hide Sliders Below Wheel')
+ : t('Show Sliders Below Wheel')
}
- aria-label="Show Sliders Below Wheel"
+ aria-label={t('Show Sliders Below Wheel')}
aria-pressed={activeTab === 'wheel' && showInlineSlidersBelowWheel}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeTab === 'wheel' && showInlineSlidersBelowWheel
@@ -407,12 +410,13 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
onChange={(e) => handleHexChange(e.target.value)}
onBlur={handleHexCommit}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') handleHexCommit();
}}
maxLength={7}
- aria-label="Hex Color"
+ aria-label={t('Hex Color')}
className="w-[58px] h-[18px] shrink-0 bg-ui-input text-ui-primary border border-ui-subtle focus:border-ui-focus font-ui-mono tabular-nums text-[10px] px-1 rounded-ui-xs"
- title="Hex Color"
+ title={t('Hex Color')}
/>
{/* Compact Inline Recent-Color History Strip */}
@@ -431,8 +435,8 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
data-testid={`color-panel-inline-swatch-${idx}`}
data-hex={hex}
onClick={() => applyColorValue(hex, false)}
- title={`Recent: ${hex.toUpperCase()}`}
- aria-label={`Recent color ${hex.toUpperCase()}`}
+ title={t('Recent: {color}', { color: hex.toUpperCase() })}
+ aria-label={t('Recent color {color}', { color: hex.toUpperCase() })}
style={{
backgroundColor: hex,
boxShadow: isActive ? ACTIVE_SWATCH_SHADOW : undefined,
@@ -445,7 +449,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
})}
</div>
) : (
- <span className="text-[9.5px] text-ui-muted truncate">No history</span>
+ <span className="text-[9.5px] text-ui-muted truncate">{t('No history')}</span>
)}
</div>
@@ -457,8 +461,8 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
onClick={toggleHistoryDropdown}
aria-expanded={historyOpen}
aria-haspopup="true"
- aria-label="Open Color History"
- title="Recent Color History"
+ aria-label={t('Open Color History')}
+ title={t('Recent Color History')}
className={`w-4 h-[18px] shrink-0 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors border ${
historyOpen
? 'bg-ui-control-active text-ui-accent border-ui-accent-border'
@@ -584,7 +588,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
>
<div className="h-6 px-2 flex items-center justify-between bg-ui-header border-b border-ui-subtle">
<span className="text-[10px] font-medium text-ui-secondary">
- Color History
+ {t('Color History')}
<span className="ml-1 font-ui-mono tabular-nums text-ui-muted">
({recentColors.length})
</span>
@@ -594,8 +598,8 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
data-testid="color-panel-history-popover-clear"
disabled={recentColors.length === 0}
onClick={() => toolStoreActions.clearRecentColors()}
- title="Clear Color History"
- aria-label="Clear Color History"
+ title={t('Clear Color History')}
+ aria-label={t('Clear Color History')}
className={`w-4.5 h-4.5 rounded-ui-xs flex items-center justify-center transition-colors ${
recentColors.length === 0
? 'text-ui-disabled cursor-not-allowed'
@@ -609,7 +613,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
<div className="p-1.5 max-h-[188px] overflow-y-auto overflow-x-hidden">
{recentColors.length === 0 ? (
<div className="py-4 text-center text-[10.5px] text-ui-muted">
- No recent colors
+ {t('No recent colors')}
</div>
) : (
<div
@@ -630,7 +634,7 @@ export const ColorPanel: React.FC<ColorPanelProps> = ({
setHistoryOpen(false);
}}
title={hex.toUpperCase()}
- aria-label={`Select recent color ${hex.toUpperCase()}`}
+ aria-label={t('Select recent color {color}', { color: hex.toUpperCase() })}
style={{
backgroundColor: hex,
boxShadow: isActive ? ACTIVE_SWATCH_SHADOW : undefined,
diff --git a/src/components/ColorSetsPanel.tsx b/src/components/ColorSetsPanel.tsx
index 353b608..5181a71 100644
--- a/src/components/ColorSetsPanel.tsx
+++ b/src/components/ColorSetsPanel.tsx
@@ -37,6 +37,7 @@ import {
isExternalFileDrag,
readTauriFileBytes,
} from '../utils/fileDropImport';
+import { isImeComposing, useI18n } from '../i18n';
export interface ColorSetsPanelProps {
colorMode?: CanvasColorMode;
@@ -66,6 +67,7 @@ function clampPopoverPosition(
export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
({ colorMode = 'color', containerWidth = 224 }) => {
+ const { t, td } = useI18n();
const sets = useColorSetsStore((s) => s.sets);
const activeSetId = useColorSetsStore((s) => s.activeSetId);
const columns = useColorSetsStore((s) => s.setsColumns);
@@ -123,6 +125,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
setSetMenuOpen(false);
};
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setSetMenuOpen(false);
};
window.addEventListener('mousedown', onPointerDown);
@@ -142,6 +145,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
setSwatchMenu(null);
};
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setSwatchMenu(null);
};
window.addEventListener('mousedown', onPointerDown);
@@ -169,16 +173,16 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
const beginCreateSet = useCallback(() => {
setSetMenuOpen(false);
- setEditValue(`Custom Set ${sets.length + 1}`);
+ setEditValue(t('Custom Set {n}', { n: sets.length + 1 }));
setEditMode('create');
- }, [sets.length]);
+ }, [sets.length, t]);
const beginRenameSet = useCallback(() => {
if (!activeSet) return;
setSetMenuOpen(false);
- setEditValue(activeSet.name);
+ setEditValue(td(activeSet.name));
setEditMode('rename');
- }, [activeSet]);
+ }, [activeSet, td]);
const commitEdit = useCallback(() => {
const trimmed = editValue.trim();
@@ -221,17 +225,19 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
data: json,
suggestedName,
mimeType: 'application/json',
- description: 'Ink Studio Color Set',
+ description: t('Ink Studio Color Set'),
extensions: ['.json'],
category: 'color-set',
- title: 'Save Color Set As',
+ title: t('Save Color Set As'),
});
if (res.canceled) return;
- uiStoreActions.showToast(`Exported color set "${activeSet.name}"`);
+ uiStoreActions.showToast(
+ t('Exported color set "{name}"', { name: td(activeSet.name) })
+ );
} catch {
- uiStoreActions.showToast('Could not export color set.');
+ uiStoreActions.showToast(t('Could not export color set.'));
}
- }, [activeSet]);
+ }, [activeSet, t, td]);
const importColorSetFiles = useCallback(async (files: File[]) => {
if (files.length === 0) return;
@@ -241,13 +247,16 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
const result = await colorSetsStoreActions.importSetFile(files[0]);
if (result.ok) {
uiStoreActions.showToast(
- `Imported "${result.set.name}" (${result.set.swatches.length} colors)`
+ t('Imported "{name}" ({count} colors)', {
+ name: td(result.set.name),
+ count: result.set.swatches.length,
+ })
);
} else {
- uiStoreActions.showToast(result.error);
+ uiStoreActions.showToast(td(result.error));
}
} catch {
- uiStoreActions.showToast('Failed to read color set file.');
+ uiStoreActions.showToast(t('Failed to read color set file.'));
}
return;
}
@@ -276,16 +285,38 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
}
if (importedCount === 1 && failedCount === 0) {
- uiStoreActions.showToast(`Imported "${lastImportedName}" (${lastSwatchCount} colors)`);
- } else if (importedCount > 0) {
- const suffix = failedCount > 0 ? ` (${failedCount} skipped)` : '';
uiStoreActions.showToast(
- `Imported ${importedCount} color set${importedCount === 1 ? '' : 's'}${suffix}`
+ t('Imported "{name}" ({count} colors)', {
+ name: td(lastImportedName),
+ count: lastSwatchCount,
+ })
);
+ } else if (importedCount > 0) {
+ if (failedCount > 0) {
+ uiStoreActions.showToast(
+ importedCount === 1
+ ? t('Imported {count} color set ({skipped} skipped)', {
+ count: importedCount,
+ skipped: failedCount,
+ })
+ : t('Imported {count} color sets ({skipped} skipped)', {
+ count: importedCount,
+ skipped: failedCount,
+ })
+ );
+ } else {
+ uiStoreActions.showToast(
+ importedCount === 1
+ ? t('Imported {count} color set', { count: importedCount })
+ : t('Imported {count} color sets', { count: importedCount })
+ );
+ }
} else {
- uiStoreActions.showToast(lastError || 'Failed to import color set files.');
+ uiStoreActions.showToast(
+ lastError ? td(lastError) : t('Failed to import color set files.')
+ );
}
- }, []);
+ }, [t, td]);
const handleTriggerImport = useCallback(() => {
setSetMenuOpen(false);
@@ -405,15 +436,33 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
if (importedCount === 1 && failedCount === 0) {
uiStoreActions.showToast(
- `Imported "${lastImportedName}" (${lastSwatchCount} colors)`
+ t('Imported "{name}" ({count} colors)', {
+ name: td(lastImportedName),
+ count: lastSwatchCount,
+ })
);
} else if (importedCount > 0) {
- const suffix = failedCount > 0 ? ` (${failedCount} skipped)` : '';
- uiStoreActions.showToast(
- `Imported ${importedCount} color set${importedCount === 1 ? '' : 's'}${suffix}`
- );
+ if (failedCount > 0) {
+ uiStoreActions.showToast(
+ importedCount === 1
+ ? t('Imported {count} color set ({skipped} skipped)', {
+ count: importedCount,
+ skipped: failedCount,
+ })
+ : t('Imported {count} color sets ({skipped} skipped)', {
+ count: importedCount,
+ skipped: failedCount,
+ })
+ );
+ } else {
+ uiStoreActions.showToast(
+ importedCount === 1
+ ? t('Imported {count} color set', { count: importedCount })
+ : t('Imported {count} color sets', { count: importedCount })
+ );
+ }
} else if (lastError) {
- uiStoreActions.showToast(lastError);
+ uiStoreActions.showToast(td(lastError));
}
})();
}
@@ -432,7 +481,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
cancelled = true;
unlisten?.();
};
- }, []);
+ }, [t, td]);
const handleAddCurrentColor = useCallback(() => {
if (!activeSet) return;
@@ -475,15 +524,18 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
[]
);
- const handleCopyHex = useCallback((hex: string) => {
- try {
- void navigator.clipboard?.writeText(hex.toUpperCase());
- } catch {
- // Ignore clipboard errors in restricted environments
- }
- uiStoreActions.showToast(`Copied ${hex.toUpperCase()}`);
- setSwatchMenu(null);
- }, []);
+ const handleCopyHex = useCallback(
+ (hex: string) => {
+ try {
+ void navigator.clipboard?.writeText(hex.toUpperCase());
+ } catch {
+ // Ignore clipboard errors in restricted environments
+ }
+ uiStoreActions.showToast(t('Copied {hex}', { hex: hex.toUpperCase() }));
+ setSwatchMenu(null);
+ },
+ [t]
+ );
const normalizedPrimary = primaryColor.toLowerCase();
const swatchHeightClass = getSwatchHeightClass(columns);
@@ -514,14 +566,14 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
<div className="h-7 px-1.5 flex items-center gap-1 shrink-0 bg-ui-header border-b border-ui-subtle">
<select
data-testid="color-sets-selector"
- aria-label="Active Color Set"
+ aria-label={t('Active Color Set')}
value={activeSet?.id ?? ''}
onChange={(e) => colorSetsStoreActions.selectSet(e.target.value)}
className="flex-1 min-w-0 h-5 bg-ui-input text-ui-primary border border-ui-subtle hover:border-ui-default text-[11px] px-1.5 rounded-ui-xs cursor-pointer truncate"
>
{sets.map((set) => (
<option key={set.id} value={set.id} className="bg-ui-elevated text-ui-primary">
- {set.name}
+ {td(set.name)}
</option>
))}
</select>
@@ -531,8 +583,8 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
type="button"
data-testid="color-sets-menu-btn"
onClick={openSetMenu}
- title="Color Set Actions"
- aria-label="Color Set Actions"
+ title={t('Color Set Actions')}
+ aria-label={t('Color Set Actions')}
aria-expanded={setMenuOpen}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center shrink-0 text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
@@ -552,9 +604,10 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
type="text"
value={editValue}
maxLength={48}
- placeholder={editMode === 'create' ? 'New set name...' : 'Set name...'}
+ placeholder={editMode === 'create' ? t('New set name...') : t('Set name...')}
onChange={(e) => setEditValue(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
commitEdit();
@@ -569,14 +622,14 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
size="xs"
data-testid="color-sets-name-confirm"
onClick={commitEdit}
- title="Confirm"
+ title={t('Confirm')}
icon={<Check className="w-3 h-3 text-ui-success" />}
/>
<IconButton
size="xs"
data-testid="color-sets-name-cancel"
onClick={() => setEditMode(null)}
- title="Cancel"
+ title={t('Cancel')}
icon={<X className="w-3 h-3" />}
/>
</div>
@@ -589,8 +642,11 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
type="button"
data-testid="color-sets-add-swatch"
onClick={handleAddCurrentColor}
- title={`Add active color (${primaryColor.toUpperCase()}) to "${activeSet?.name ?? 'Set'}"`}
- aria-label="Add current color to set"
+ title={t('Add active color ({hex}) to "{set}"', {
+ hex: primaryColor.toUpperCase(),
+ set: activeSet ? td(activeSet.name) : t('Set'),
+ })}
+ aria-label={t('Add current color to set')}
className="h-4.5 px-1 rounded-ui-xs flex items-center gap-1 bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer shrink-0"
>
<span
@@ -609,12 +665,12 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
<label
className="flex items-center gap-1 shrink-0 text-ui-muted"
- title="Swatches per row (1–8)"
+ title={t('Swatches per row (1–8)')}
>
{!isNarrow && <LayoutGrid className="w-2.5 h-2.5 text-ui-icon-muted shrink-0" />}
<select
data-testid="color-sets-columns-select"
- aria-label="Color Sets columns"
+ aria-label={t('Color Sets columns')}
value={columns}
onChange={(e) =>
colorSetsStoreActions.setSetsColumns(
@@ -636,13 +692,13 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
<div className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-1.5">
{!activeSet || activeSet.swatches.length === 0 ? (
<div className="h-full min-h-[72px] flex flex-col items-center justify-center gap-1.5 text-center px-2 text-ui-muted">
- <span className="text-[11px]">Empty color set</span>
+ <span className="text-[11px]">{t('Empty color set')}</span>
<button
type="button"
onClick={handleAddCurrentColor}
className="px-2 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer transition-colors"
>
- + Add {primaryColor.toUpperCase()}
+ {t('+ Add {hex}', { hex: primaryColor.toUpperCase() })}
</button>
</div>
) : (
@@ -655,8 +711,9 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
{activeSet.swatches.map((swatch, idx) => {
const isActive = swatch.hex.toLowerCase() === normalizedPrimary;
const isDragTarget = dragOverIndex === idx && dragIndex !== null && dragIndex !== idx;
- const label = swatch.name
- ? `${swatch.name} (${swatch.hex.toUpperCase()})`
+ const swatchDisplayName = swatch.name ? td(swatch.name) : '';
+ const label = swatchDisplayName
+ ? `${swatchDisplayName} (${swatch.hex.toUpperCase()})`
: swatch.hex.toUpperCase();
return (
@@ -669,7 +726,10 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
data-active={isActive ? 'true' : undefined}
aria-label={label}
aria-pressed={isActive}
- title={`${label} — Click: Primary · Middle: Secondary · Right-click: Menu · Alt+Click: Remove`}
+ title={t(
+ '{label} — Click: Primary · Middle: Secondary · Right-click: Menu · Alt+Click: Remove',
+ { label }
+ )}
onClick={(e) => handleSwatchClick(e, swatch)}
onAuxClick={(e) => handleSwatchAuxClick(e, swatch)}
onContextMenu={(e) => handleSwatchContextMenu(e, swatch)}
@@ -739,7 +799,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<FolderPlus className="w-3 h-3 text-ui-icon-muted" />
- <span>New Color Set</span>
+ <span>{t('New Color Set')}</span>
</button>
<button
@@ -749,7 +809,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Pencil className="w-3 h-3 text-ui-icon-muted" />
- <span>Rename Set</span>
+ <span>{t('Rename Set')}</span>
</button>
<button
@@ -759,7 +819,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Copy className="w-3 h-3 text-ui-icon-muted" />
- <span>Duplicate Set</span>
+ <span>{t('Duplicate Set')}</span>
</button>
<div className="my-1 border-t border-ui-subtle" />
@@ -768,11 +828,11 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
type="button"
data-testid="color-sets-action-import"
onClick={handleTriggerImport}
- title="Import Color Set (.json, Clip Studio .cls, or .png palette)"
+ title={t('Import Color Set (.json, Clip Studio .cls, or .png palette)')}
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Upload className="w-3 h-3 text-ui-icon-muted shrink-0" />
- <span>Import Set (.json, .cls, .png)...</span>
+ <span>{t('Import Set (.json, .cls, .png)...')}</span>
</button>
<button
@@ -782,7 +842,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Download className="w-3 h-3 text-ui-icon-muted" />
- <span>Export Set (JSON)...</span>
+ <span>{t('Export Set (JSON)...')}</span>
</button>
<div className="my-1 border-t border-ui-subtle" />
@@ -799,7 +859,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
}`}
>
<Trash2 className="w-3 h-3" />
- <span>Delete Set</span>
+ <span>{t('Delete Set')}</span>
</button>
</div>,
document.body
@@ -829,7 +889,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
{swatchMenu.swatch.hex}
</span>
{swatchMenu.swatch.name && (
- <span className="truncate text-ui-secondary">· {swatchMenu.swatch.name}</span>
+ <span className="truncate text-ui-secondary">· {td(swatchMenu.swatch.name)}</span>
)}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -843,7 +903,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
}}
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
- <span>Set Secondary Color</span>
+ <span>{t('Set Secondary Color')}</span>
</button>
<button
@@ -864,7 +924,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<RefreshCw className="w-3 h-3 text-ui-icon-muted" />
- <span>Replace with Primary</span>
+ <span>{t('Replace with Primary')}</span>
</button>
<button
@@ -874,7 +934,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Copy className="w-3 h-3 text-ui-icon-muted" />
- <span>Copy Hex</span>
+ <span>{t('Copy Hex')}</span>
</button>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -889,7 +949,7 @@ export const ColorSetsPanel: React.FC<ColorSetsPanelProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<Trash2 className="w-3 h-3" />
- <span>Delete Swatch</span>
+ <span>{t('Delete Swatch')}</span>
</button>
</div>,
document.body
diff --git a/src/components/ColorSlider.tsx b/src/components/ColorSlider.tsx
index 0573876..aa1c168 100644
--- a/src/components/ColorSlider.tsx
+++ b/src/components/ColorSlider.tsx
@@ -20,6 +20,7 @@ import {
isValidHex,
} from '../utils/colorUtils';
import { safeLocalStorageGetItem, safeLocalStorageSetItem } from '../utils/safeStorage';
+import { isImeComposing, useI18n } from '../i18n';
export interface ColorSliderProps {
primaryColor: string;
@@ -69,6 +70,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
hideHeader = false,
compact = false,
}) => {
+ const { t } = useI18n();
// Target swatch being edited: 'primary' or 'secondary'
const [internalActiveTarget, setInternalActiveTarget] = useState<'primary' | 'secondary'>('primary');
const activeTarget = controlledActiveTarget ?? internalActiveTarget;
@@ -416,7 +418,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<Menu className="w-3.5 h-3.5 text-ui-icon-muted cursor-pointer hover:text-ui-primary transition-colors" />
<div className="flex items-center space-x-1.5">
<Sliders className="w-3.5 h-3.5 text-ui-accent" />
- <span className="font-medium tracking-wide">Color Slider</span>
+ <span className="font-medium tracking-wide">{t('Color Slider')}</span>
</div>
</div>
@@ -424,7 +426,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={onSwapColors}
- title="Swap Primary & Secondary Colors (X)"
+ title={t('Swap Primary & Secondary Colors (X)')}
className="flex items-center space-x-1 px-1.5 py-0.5 bg-ui-control hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary rounded-ui-xs border border-ui-subtle transition-colors cursor-pointer"
>
<ArrowLeftRight className="w-3 h-3" />
@@ -450,7 +452,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={() => setMode('rgb')}
- title="RGB Color Model"
+ title={t('RGB Color Model')}
className={`flex-1 py-1 flex items-center justify-center cursor-pointer transition-colors relative ${
mode === 'rgb'
? 'bg-ui-control-active text-ui-primary font-semibold'
@@ -466,7 +468,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={() => setMode('hsv')}
- title="HSV Color Model"
+ title={t('HSV Color Model')}
className={`flex-1 py-1 flex items-center justify-center cursor-pointer transition-colors border-t border-ui-subtle relative ${
mode === 'hsv'
? 'bg-ui-control-active text-ui-primary font-semibold'
@@ -482,7 +484,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={() => setMode('cmyk')}
- title="CMYK Color Model"
+ title={t('CMYK Color Model')}
className={`flex-1 py-1 flex items-center justify-center cursor-pointer transition-colors border-t border-ui-subtle relative ${
mode === 'cmyk'
? 'bg-ui-control-active text-ui-primary font-semibold'
@@ -563,7 +565,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={() => handleStep(channel.id, 1)}
- title="Increment (+1)"
+ title={t('Increment (+1)')}
className="p-0 text-ui-icon-muted hover:text-ui-accent active:text-ui-primary cursor-pointer transition-colors"
>
<ChevronUp className="w-2.5 h-2.5" />
@@ -571,7 +573,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={() => handleStep(channel.id, -1)}
- title="Decrement (-1)"
+ title={t('Decrement (-1)')}
className="p-0 text-ui-icon-muted hover:text-ui-accent active:text-ui-primary cursor-pointer transition-colors"
>
<ChevronDown className="w-2.5 h-2.5" />
@@ -593,7 +595,9 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
setActiveTarget('primary');
if (currentTool === 'eraser' && onSelectTool) onSelectTool('brush');
}}
- title={`Primary Color: ${primaryColor} (Click to select & edit)`}
+ title={t('Primary Color: {color} (Click to select & edit)', {
+ color: primaryColor,
+ })}
className={`flex-1 ${swatchHeight} rounded-ui-sm cursor-pointer transition-all relative overflow-hidden ${
activeTarget === 'primary' && !isTransparentActive
? 'ring-1 ring-ui-accent ring-offset-1 ring-offset-ui-panel border border-ui-strong z-10'
@@ -608,7 +612,9 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
setActiveTarget('secondary');
if (currentTool === 'eraser' && onSelectTool) onSelectTool('brush');
}}
- title={`Secondary Color: ${secondaryColor} (Click to select & edit)`}
+ title={t('Secondary Color: {color} (Click to select & edit)', {
+ color: secondaryColor,
+ })}
className={`flex-1 ${swatchHeight} rounded-ui-sm cursor-pointer transition-all relative overflow-hidden ${
activeTarget === 'secondary' && !isTransparentActive
? 'ring-1 ring-ui-accent ring-offset-1 ring-offset-ui-panel border border-ui-strong z-10'
@@ -620,7 +626,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={handleToggleTransparent}
- title="Transparent Color / Eraser Mode (C)"
+ title={t('Transparent Color / Eraser Mode (C)')}
className={`flex-1 ${swatchHeight} rounded-ui-sm cursor-pointer transition-all relative overflow-hidden ${
isTransparentActive
? 'ring-1 ring-ui-accent ring-offset-1 ring-offset-ui-panel border border-ui-strong z-10'
@@ -643,6 +649,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
onChange={(e) => handleHexInput(e.target.value)}
onBlur={handleHexCommit}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') handleHexCommit();
}}
className="w-full bg-ui-input border border-ui-default focus:border-ui-focus rounded-ui-sm pl-5 pr-7 py-1 text-ui-primary font-ui-mono tabular-nums text-xs outline-none"
@@ -652,7 +659,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
<button
type="button"
onClick={copyHexToClipboard}
- title="Copy Hex Code"
+ title={t('Copy Hex Code')}
className="absolute right-1.5 p-1 text-ui-icon-muted hover:text-ui-primary rounded-ui-xs transition-colors cursor-pointer"
>
{copiedHex ? (
@@ -670,9 +677,9 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
{!compact && recentColors && recentColors.length > 0 && (
<div className="pt-1.5 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[10px] text-ui-muted mb-1 font-medium">
- <span>Recent Colors</span>
+ <span>{t('Recent Colors')}</span>
<span className="text-[9px] font-ui-mono tabular-nums text-ui-muted">
- {recentColors.length} items
+ {t('{count} items', { count: recentColors.length })}
</span>
</div>
<div className="flex items-center space-x-1 overflow-x-auto py-0.5 no-scrollbar">
@@ -683,7 +690,7 @@ export const ColorSlider: React.FC<ColorSliderProps> = ({
onClick={() => {
commitHexColor(color, false);
}}
- title={`Recent: ${color}`}
+ title={t('Recent: {color}', { color })}
className={`w-5 h-5 rounded-ui-xs border shrink-0 cursor-pointer transition-transform hover:scale-110 ${
activeColor.toLowerCase() === color.toLowerCase()
? 'border-ui-accent ring-1 ring-ui-accent-border'
diff --git a/src/components/ColorWheel.tsx b/src/components/ColorWheel.tsx
index f9151a6..d26fad7 100644
--- a/src/components/ColorWheel.tsx
+++ b/src/components/ColorWheel.tsx
@@ -8,6 +8,7 @@ import {
enforceColorMode,
HSV,
} from '../utils/colorUtils';
+import { useI18n } from '../i18n';
export interface ColorWheelProps {
primaryColor: string;
@@ -38,6 +39,7 @@ export const ColorWheel: React.FC<ColorWheelProps> = ({
containerHeight,
activeTarget: controlledActiveTarget,
}) => {
+ const { t } = useI18n();
const activeTarget = controlledActiveTarget ?? 'primary';
const [wheelMode, setWheelMode] = useState<'square' | 'triangle'>('square');
const activeColor = activeTarget === 'primary' ? primaryColor : secondaryColor;
@@ -385,7 +387,11 @@ export const ColorWheel: React.FC<ColorWheelProps> = ({
<button
type="button"
onClick={() => setWheelMode((m) => (m === 'square' ? 'triangle' : 'square'))}
- title={`Switch to ${wheelMode === 'square' ? 'Triangle' : 'Square'} Mode`}
+ title={
+ wheelMode === 'square'
+ ? t('Switch to Triangle Mode')
+ : t('Switch to Square Mode')
+ }
className="absolute bottom-1 right-1.5 w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
{wheelMode === 'square' ? (
diff --git a/src/components/CommandBar.tsx b/src/components/CommandBar.tsx
index b0b00f6..4a9e562 100644
--- a/src/components/CommandBar.tsx
+++ b/src/components/CommandBar.tsx
@@ -49,6 +49,7 @@ import {
useWorkspaceStore,
workspaceStoreActions,
} from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
export async function toggleAppFullscreen(): Promise<void> {
try {
@@ -291,6 +292,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
handlers,
themePreset: _themePreset = 'modern',
}) => {
+ const { t, td } = useI18n();
const commandBarIds = useWorkspaceStore((s) => s.commandBarIds);
const showCommandBar = useWorkspaceStore((s) => s.showCommandBar);
const activePreset = useWorkspaceStore((s) => s.activePreset);
@@ -322,6 +324,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
}
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
setIsCustomizeOpen(false);
setIsPresetMenuOpen(false);
@@ -356,7 +359,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
const activePresetDisplayLabel = activeSavedProfile
? activeSavedProfile.name
- : WORKSPACE_PRESET_LABELS[activePreset];
+ : td(WORKSPACE_PRESET_LABELS[activePreset]);
const handleCommitSaveWorkspace = () => {
const name = saveNameDraft.trim();
@@ -364,7 +367,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
const saved = workspaceStoreActions.saveCustomWorkspace(name);
setSaveNameDraft('');
setIsSaveFormOpen(false);
- uiStoreActions.showToast(`Saved workspace "${saved.name}"`);
+ uiStoreActions.showToast(t('Saved workspace "{name}"', { name: saved.name }));
};
return (
@@ -381,6 +384,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
if (!entry) return null;
const disabled = isCommandDisabled(cmdId, handlers);
const active = isCommandActive(cmdId, handlers, palettesHidden, quickBrushPanelVisible);
+ const cmdLabel = td(entry.label);
return (
<button
@@ -388,8 +392,8 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
type="button"
disabled={disabled}
onClick={() => executeWorkspaceCommand(cmdId, handlers)}
- title={`${entry.label}${entry.shortcut ? ` (${entry.shortcut})` : ''}`}
- aria-label={entry.label}
+ title={`${cmdLabel}${entry.shortcut ? ` (${entry.shortcut})` : ''}`}
+ aria-label={cmdLabel}
aria-pressed={active || undefined}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors shrink-0 ${
disabled
@@ -412,8 +416,8 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
setIsPresetMenuOpen(false);
setIsCustomizeOpen((v) => !v);
}}
- title="Customize Command Bar"
- aria-label="Customize Command Bar"
+ title={t('Customize Command Bar')}
+ aria-label={t('Customize Command Bar')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
isCustomizeOpen
? 'bg-ui-control-active text-ui-accent'
@@ -426,13 +430,13 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{isCustomizeOpen && (
<div className="fixed top-9 left-1/2 -translate-x-1/2 w-64 rounded-ui-md shadow-ui-popover p-2 z-50 text-[11px] bg-ui-elevated border border-ui-default text-ui-primary">
<div className="flex items-center justify-between pb-1.5 mb-1.5 border-b border-ui-subtle">
- <span className="font-medium text-xs">Command Bar</span>
+ <span className="font-medium text-xs">{t('Command Bar')}</span>
<button
type="button"
onClick={() => workspaceStoreActions.resetCommandBar()}
className="text-[10px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Reset
+ {t('Reset')}
</button>
</div>
@@ -440,7 +444,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{commandBarIds.length > 0 && (
<div className="mb-2 space-y-0.5 max-h-32 overflow-y-auto">
<div className="text-[10px] uppercase tracking-wider text-ui-muted px-1 mb-0.5 tabular-nums">
- Pinned ({commandBarIds.length})
+ {t('Pinned ({count})', { count: commandBarIds.length })}
</div>
{commandBarIds.map((cid, idx) => {
const entry = catalogById.get(cid);
@@ -452,7 +456,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
>
<div className="flex items-center gap-1.5 min-w-0">
{renderCommandIcon(cid)}
- <span className="truncate">{entry.label}</span>
+ <span className="truncate">{td(entry.label)}</span>
</div>
<div className="flex items-center gap-0.5 shrink-0">
<button
@@ -460,7 +464,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
disabled={idx === 0}
onClick={() => workspaceStoreActions.moveCommandBarItem(cid, -1)}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
- title="Move left"
+ title={t('Move left')}
>
<ChevronUp className="w-3 h-3" />
</button>
@@ -469,7 +473,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
disabled={idx === commandBarIds.length - 1}
onClick={() => workspaceStoreActions.moveCommandBarItem(cid, 1)}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
- title="Move right"
+ title={t('Move right')}
>
<ChevronDown className="w-3 h-3" />
</button>
@@ -477,7 +481,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
type="button"
onClick={() => workspaceStoreActions.toggleCommandBarItem(cid)}
className="p-0.5 text-ui-muted hover:text-ui-danger cursor-pointer"
- title="Remove"
+ title={t('Remove')}
>
<X className="w-3 h-3" />
</button>
@@ -490,7 +494,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{/* Toggle all catalog commands */}
<div className="text-[10px] uppercase tracking-wider text-ui-muted px-1 mb-0.5">
- Available Commands
+ {t('Available Commands')}
</div>
<div className="max-h-44 overflow-y-auto space-y-0.5">
{COMMAND_CATALOG.map((entry) => {
@@ -508,7 +512,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
>
<span className="flex items-center gap-1.5 min-w-0">
{renderCommandIcon(entry.id)}
- <span className="truncate">{entry.label}</span>
+ <span className="truncate">{td(entry.label)}</span>
</span>
{pinned && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
@@ -533,7 +537,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
});
}}
data-testid="workspace-preset-trigger"
- title="Workspace Archetypes, Saved Profiles & Left-Handed Mirror"
+ title={t('Workspace Archetypes, Saved Profiles & Left-Handed Mirror')}
className="h-6 px-2 rounded-ui-sm flex items-center gap-1 text-[11px] transition-colors cursor-pointer bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary"
>
<LayoutGrid className="w-3 h-3 text-ui-accent shrink-0" />
@@ -543,10 +547,10 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{leftHandedMode && (
<span
data-testid="workspace-left-handed-badge"
- title="Left-Handed Mirror Active"
+ title={t('Left-Handed Mirror Active')}
className="px-1 rounded-ui-xs bg-ui-accent-subtle text-ui-accent font-ui-mono text-[9px] leading-tight"
>
- LH
+ {t('LH')}
</span>
)}
{anyLockActive && (
@@ -554,14 +558,16 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
data-testid="workspace-lock-indicator"
title={
allLocksActive
- ? 'All palette locks active (Width, Height, Move)'
- : `Palette locks active: ${[
- workspaceLocks.lockWidth ? 'Width' : null,
- workspaceLocks.lockHeight ? 'Height' : null,
- workspaceLocks.lockMove ? 'Move' : null,
- ]
- .filter(Boolean)
- .join(', ')}`
+ ? t('All palette locks active (Width, Height, Move)')
+ : t('Palette locks active: {locks}', {
+ locks: [
+ workspaceLocks.lockWidth ? t('Width') : null,
+ workspaceLocks.lockHeight ? t('Height') : null,
+ workspaceLocks.lockMove ? t('Move') : null,
+ ]
+ .filter(Boolean)
+ .join(', '),
+ })
}
className="text-ui-accent flex items-center shrink-0"
>
@@ -577,7 +583,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
className="absolute top-7 right-0 w-60 rounded-ui-md shadow-ui-popover p-1.5 z-50 text-[11px] bg-ui-elevated border border-ui-default text-ui-primary"
>
<div className="px-2 py-0.5 text-[9.5px] uppercase tracking-wider text-ui-muted">
- Workspace Archetypes
+ {t('Workspace Archetypes')}
</div>
{BUILT_IN_WORKSPACE_PRESET_IDS.map((preset) => {
const selected = activePreset === preset && !activeSavedWorkspaceId;
@@ -596,10 +602,10 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
: 'text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary'
}`}
>
- <span className="truncate">{WORKSPACE_PRESET_LABELS[preset]}</span>
+ <span className="truncate">{td(WORKSPACE_PRESET_LABELS[preset])}</span>
<span className="flex items-center gap-1 shrink-0">
{preset === 'photoshop-studio' && (
- <span className="text-[9px] font-ui-mono text-ui-muted">Options</span>
+ <span className="text-[9px] font-ui-mono text-ui-muted">{t('Options')}</span>
)}
{selected && <Check className="w-3 h-3 text-ui-accent" />}
</span>
@@ -610,7 +616,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{/* Saved Named Custom Workspaces */}
<div className="my-1 border-t border-ui-subtle" />
<div className="px-2 py-0.5 flex items-center justify-between text-[9.5px] uppercase tracking-wider text-ui-muted">
- <span>Saved Workspaces</span>
+ <span>{t('Saved Workspaces')}</span>
{savedWorkspaces.length > 0 && (
<span className="font-ui-mono tabular-nums">{savedWorkspaces.length}</span>
)}
@@ -647,8 +653,8 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
e.stopPropagation();
workspaceStoreActions.deleteCustomWorkspace(ws.id);
}}
- title={`Delete "${ws.name}"`}
- aria-label={`Delete ${ws.name}`}
+ title={t('Delete "{name}"', { name: ws.name })}
+ aria-label={t('Delete {name}', { name: ws.name })}
className="opacity-0 group-hover:opacity-100 p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-danger cursor-pointer transition-opacity shrink-0"
>
<Trash2 className="w-3 h-3" />
@@ -666,12 +672,13 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
type="text"
autoFocus
data-testid="workspace-save-name-input"
- aria-label="Workspace Name"
- placeholder="e.g. Lineart, Coloring..."
+ aria-label={t('Workspace Name')}
+ placeholder={t('e.g. Lineart, Coloring...')}
maxLength={48}
value={saveNameDraft}
onChange={(e) => setSaveNameDraft(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
handleCommitSaveWorkspace();
@@ -689,7 +696,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
onClick={handleCommitSaveWorkspace}
className="h-6 px-2 rounded-ui-xs bg-ui-control-active hover:bg-ui-control-hover border border-ui-accent-border text-[10px] font-medium text-ui-primary disabled:opacity-40 cursor-pointer shrink-0"
>
- Save
+ {t('Save')}
</button>
</div>
</div>
@@ -704,7 +711,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm text-left text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer"
>
<BookmarkPlus className="w-3 h-3 text-ui-accent" />
- <span>Save Current Workspace...</span>
+ <span>{t('Save Current Workspace...')}</span>
</button>
)}
@@ -712,7 +719,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{/* Granular Palette & Workspace Locks */}
<div className="px-2 py-0.5 flex items-center justify-between text-[9.5px] uppercase tracking-wider text-ui-muted">
- <span>Palette Locks</span>
+ <span>{t('Palette Locks')}</span>
<button
type="button"
data-testid="workspace-lock-all-btn"
@@ -720,7 +727,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
onClick={() => {
const locked = workspaceStoreActions.toggleLockAllWorkspace();
uiStoreActions.showToast(
- locked ? 'All palette locks enabled' : 'All palette locks disabled'
+ locked ? t('All palette locks enabled') : t('All palette locks disabled')
);
}}
className={`px-1.5 py-[1px] rounded-ui-xs border font-ui-mono text-[9px] normal-case flex items-center gap-1 transition-colors cursor-pointer ${
@@ -736,7 +743,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
) : (
<Unlock className="w-2.5 h-2.5" />
)}
- <span>{allLocksActive ? 'Unlock All' : 'Lock All'}</span>
+ <span>{allLocksActive ? t('Unlock All') : t('Lock All')}</span>
</button>
</div>
@@ -763,7 +770,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
: 'text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary'
}`}
>
- <span className="truncate">{label}</span>
+ <span className="truncate">{t(label)}</span>
{checked && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
);
@@ -780,7 +787,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
onClick={() => {
const next = workspaceStoreActions.toggleLeftHandedMode();
uiStoreActions.showToast(
- next ? 'Left-Handed Workspace Mirror: ON' : 'Left-Handed Workspace Mirror: OFF'
+ next ? t('Left-Handed Workspace Mirror: ON') : t('Left-Handed Workspace Mirror: OFF')
);
}}
className={`w-full flex items-center justify-between gap-2 px-2 py-1 rounded-ui-sm text-left transition-colors cursor-pointer ${
@@ -791,14 +798,14 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
>
<span className="flex items-center gap-1.5 min-w-0">
<FlipHorizontal className="w-3 h-3 text-ui-accent shrink-0" />
- <span className="truncate">Left-Handed Mirror</span>
+ <span className="truncate">{t('Left-Handed Mirror')}</span>
</span>
<span
className={`text-[9.5px] font-ui-mono uppercase ${
leftHandedMode ? 'text-ui-accent' : 'text-ui-muted'
}`}
>
- {leftHandedMode ? 'ON' : 'OFF'}
+ {leftHandedMode ? t('ON') : t('OFF')}
</span>
</button>
@@ -817,7 +824,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
>
<span className="flex items-center gap-1.5 min-w-0">
<PanelTop className="w-3 h-3 text-ui-muted shrink-0" />
- <span className="truncate">Tool Options Bar</span>
+ <span className="truncate">{t('Tool Options Bar')}</span>
</span>
{showToolOptionsBar && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
@@ -830,7 +837,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
}}
className="w-full flex items-center justify-between px-2 py-1 rounded-ui-sm text-left text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer"
>
- <span>{palettesHidden ? 'Show Palettes' : 'Hide Palettes'}</span>
+ <span>{palettesHidden ? t('Show Palettes') : t('Hide Palettes')}</span>
<span className="text-[10px] font-ui-mono text-ui-muted">Tab</span>
</button>
@@ -842,7 +849,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
}}
className="w-full flex items-center justify-between px-2 py-1 rounded-ui-sm text-left text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer"
>
- <span>{quickBrushPanelVisible ? 'Hide Quick Brushes' : 'Show Quick Brushes'}</span>
+ <span>{quickBrushPanelVisible ? t('Hide Quick Brushes') : t('Show Quick Brushes')}</span>
<span className="text-[10px] font-ui-mono text-ui-muted">Shift+B</span>
</button>
@@ -858,7 +865,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm text-left text-ui-warning hover:bg-ui-control-hover cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset Workspace</span>
+ <span>{t('Reset Workspace')}</span>
</button>
</div>
)}
diff --git a/src/components/ConfirmDialogModal.tsx b/src/components/ConfirmDialogModal.tsx
index 7bb5fed..6ce0e4f 100644
--- a/src/components/ConfirmDialogModal.tsx
+++ b/src/components/ConfirmDialogModal.tsx
@@ -1,13 +1,16 @@
import React, { useEffect } from 'react';
import { AlertTriangle, HelpCircle, Paintbrush, Trash2, X } from 'lucide-react';
import { uiStoreActions, useUiStore } from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
export const ConfirmDialogModal: React.FC = React.memo(() => {
+ const { t, td } = useI18n();
const dialog = useUiStore((s) => s.appDialog);
useEffect(() => {
if (!dialog.isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -58,14 +61,14 @@ export const ConfirmDialogModal: React.FC = React.memo(() => {
id="app-confirm-dialog-title"
className="text-xs font-medium text-ui-primary tracking-wide truncate"
>
- {dialog.title}
+ {td(dialog.title)}
</span>
</div>
<button
type="button"
onClick={handleCancel}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer shrink-0"
>
<X className="w-3.5 h-3.5" />
@@ -148,7 +151,7 @@ export const ConfirmDialogModal: React.FC = React.memo(() => {
onClick={handleCancel}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-xs font-medium text-ui-primary transition-colors cursor-pointer"
>
- {dialog.cancelLabel}
+ {td(dialog.cancelLabel)}
</button>
)}
<button
@@ -162,7 +165,7 @@ export const ConfirmDialogModal: React.FC = React.memo(() => {
}
>
{isDanger && <Trash2 className="w-3.5 h-3.5" />}
- <span>{dialog.confirmLabel}</span>
+ <span>{td(dialog.confirmLabel)}</span>
</button>
</div>
</div>
diff --git a/src/components/CrashRecoveryModal.tsx b/src/components/CrashRecoveryModal.tsx
index a9094dc..cb7e58f 100644
--- a/src/components/CrashRecoveryModal.tsx
+++ b/src/components/CrashRecoveryModal.tsx
@@ -9,6 +9,7 @@ import {
X,
} from 'lucide-react';
import { CrashedSessionInfo } from '../services/recoveryService';
+import { isImeComposing, useI18n } from '../i18n';
interface CrashRecoveryModalProps {
isOpen: boolean;
@@ -45,6 +46,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
onDiscardAll,
onClose,
}) => {
+ const { t, td, formatDateTime } = useI18n();
const [selectedIndex, setSelectedIndex] = useState<number>(0);
const [isRestoring, setIsRestoring] = useState<boolean>(false);
const [isDiscarding, setIsDiscarding] = useState<boolean>(false);
@@ -61,6 +63,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
useEffect(() => {
if (!isOpen || !onClose) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !isBusy) {
e.preventDefault();
e.stopPropagation();
@@ -77,7 +80,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
const currentSession = sessions[safeIndex] || sessions[0];
const manifestData = parseSessionManifest(currentSession.manifest_json);
- const documentName = manifestData?.documentName || 'Untitled Document';
+ const documentName = manifestData?.documentName || t('Untitled Document');
const width = manifestData?.width || 3000;
const height = manifestData?.height || 3000;
const dpi = manifestData?.dpi || 600;
@@ -85,11 +88,11 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
const layerCount = manifestData?.layers?.length || 1;
const crashDate = currentSession.timestamp
- ? new Date(currentSession.timestamp).toLocaleString(undefined, {
+ ? formatDateTime(currentSession.timestamp, {
dateStyle: 'medium',
timeStyle: 'medium',
})
- : 'Unknown';
+ : t('Unknown');
const handleRestoreClick = async () => {
if (isBusy) return;
@@ -137,11 +140,11 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
id="crash-recovery-title"
className="text-xs font-medium text-ui-primary truncate"
>
- Restore Unsaved Session
+ {t('Restore Unsaved Session')}
</h2>
<span className="inline-flex items-center gap-1.5 font-ui-mono text-[10px] px-1.5 py-0.5 rounded-ui-xs bg-ui-panel border border-ui-subtle text-ui-secondary shrink-0">
<span className="w-1.5 h-1.5 rounded-full bg-ui-accent" />
- WAL Protected
+ {t('WAL Protected')}
</span>
</div>
@@ -155,8 +158,8 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
<button
type="button"
onClick={onClose}
- aria-label="Close recovery dialog"
- title="Close (Esc)"
+ aria-label={t('Close recovery dialog')}
+ title={t('Close (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -169,13 +172,14 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
{sessions.length > 1 && (
<div className="px-4 py-2 bg-ui-header border-b border-ui-subtle flex items-center gap-3 overflow-x-auto no-scrollbar shrink-0">
<span className="text-[10px] text-ui-muted font-medium uppercase tracking-wider shrink-0">
- Sessions
+ {t('Sessions')}
</span>
<div className="inline-flex items-center gap-0.5 bg-ui-input p-0.5 rounded-ui-sm border border-ui-subtle">
{sessions.map((s, idx) => {
const isActive = idx === safeIndex;
const sessionManifest = parseSessionManifest(s.manifest_json);
- const sessionTitle = sessionManifest?.documentName || `Session ${idx + 1}`;
+ const sessionTitle =
+ sessionManifest?.documentName || t('Session {n}', { n: idx + 1 });
return (
<button
key={s.session_id}
@@ -192,7 +196,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
{isActive && (
<span className="w-1.5 h-1.5 rounded-full bg-ui-accent shrink-0" />
)}
- <span>Session {idx + 1}</span>
+ <span>{t('Session {n}', { n: idx + 1 })}</span>
</button>
);
})}
@@ -203,7 +207,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
{/* Modal Main Content */}
<div className="p-5 space-y-4 bg-ui-panel">
<p className="text-[11px] text-ui-muted leading-relaxed">
- Ink Studio detected an unexpected shutdown. Your progress can be restored from the recovery journal below.
+ {t('Ink Studio detected an unexpected shutdown. Your progress can be restored from the recovery journal below.')}
</p>
{/* Document Preview & Metadata Grid */}
@@ -225,17 +229,17 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
{currentSession.thumbnail_data_url ? (
<img
src={currentSession.thumbnail_data_url}
- alt="Document preview"
+ alt={t('Document preview')}
className="w-full h-full object-contain p-1.5"
/>
) : (
<div className="flex flex-col items-center justify-center p-4 text-center">
<Layers className="w-8 h-8 mb-2 text-ui-disabled" />
<span className="text-[11px] font-medium text-ui-secondary">
- No Snapshot Preview
+ {t('No Snapshot Preview')}
</span>
<span className="text-[10px] text-ui-muted mt-0.5">
- WAL journal entries intact
+ {t('WAL journal entries intact')}
</span>
</div>
)}
@@ -267,38 +271,42 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
<div className="grid grid-cols-2 gap-1.5">
<div className="bg-ui-header border border-ui-subtle rounded-ui-sm px-2.5 py-2">
- <span className="text-[10px] text-ui-muted block">Canvas Size</span>
+ <span className="text-[10px] text-ui-muted block">{t('Canvas Size')}</span>
<span className="text-xs font-medium font-ui-mono tabular-nums text-ui-primary">
{width} × {height}
</span>
</div>
<div className="bg-ui-header border border-ui-subtle rounded-ui-sm px-2.5 py-2">
- <span className="text-[10px] text-ui-muted block">Resolution</span>
+ <span className="text-[10px] text-ui-muted block">{t('Resolution')}</span>
<span className="text-xs font-medium font-ui-mono tabular-nums text-ui-primary">{dpi} DPI</span>
</div>
<div className="bg-ui-header border border-ui-subtle rounded-ui-sm px-2.5 py-2">
- <span className="text-[10px] text-ui-muted block">Layer Tree</span>
+ <span className="text-[10px] text-ui-muted block">{t('Layer Tree')}</span>
<span className="text-xs font-medium tabular-nums text-ui-primary">
- {layerCount} {layerCount === 1 ? 'Layer' : 'Layers'}
+ {layerCount === 1
+ ? t('{n} Layer', { n: layerCount })
+ : t('{n} Layers', { n: layerCount })}
</span>
</div>
<div className="bg-ui-header border border-ui-subtle rounded-ui-sm px-2.5 py-2">
- <span className="text-[10px] text-ui-muted block">Color Mode</span>
- <span className="text-xs font-medium text-ui-primary capitalize">{colorMode}</span>
+ <span className="text-[10px] text-ui-muted block">{t('Color Mode')}</span>
+ <span className="text-xs font-medium text-ui-primary capitalize">
+ {td(colorMode, 'colorMode')}
+ </span>
</div>
</div>
{/* Timestamp & Process Info */}
<div className="bg-ui-header rounded-ui-sm border border-ui-subtle divide-y divide-ui-subtle text-[11px]">
<div className="px-2.5 py-1.5 flex items-center justify-between gap-2">
- <span className="text-ui-muted">Terminated At</span>
+ <span className="text-ui-muted">{t('Terminated At')}</span>
<span className="text-ui-primary font-ui-mono tabular-nums">{crashDate}</span>
</div>
<div className="px-2.5 py-1.5 flex items-center justify-between gap-2">
- <span className="text-ui-muted">Previous PID</span>
+ <span className="text-ui-muted">{t('Previous PID')}</span>
<span className="text-ui-secondary font-ui-mono tabular-nums">{currentSession.pid}</span>
</div>
</div>
@@ -320,7 +328,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
) : (
<Trash2 className="w-3.5 h-3.5" />
)}
- <span>{isDiscarding ? 'Discarding...' : 'Discard & Start Fresh'}</span>
+ <span>{isDiscarding ? t('Discarding...') : t('Discard & Start Fresh')}</span>
</button>
<button
@@ -330,8 +338,8 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
data-testid="discard-all-sessions-btn"
title={
sessions.length > 1
- ? `Permanently discard all ${sessions.length} unsaved sessions`
- : 'Permanently discard all unsaved sessions'
+ ? t('Permanently discard all {count} unsaved sessions', { count: sessions.length })
+ : t('Permanently discard all unsaved sessions')
}
className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-ui-sm text-xs font-medium bg-ui-danger/15 hover:bg-ui-danger/25 border border-ui-danger/40 hover:border-ui-danger/60 text-ui-danger transition-colors disabled:opacity-50 cursor-pointer"
>
@@ -342,10 +350,10 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
)}
<span>
{isDiscardingAll
- ? 'Discarding All...'
+ ? t('Discarding All...')
: sessions.length > 1
- ? `Discard All Sessions (${sessions.length})`
- : 'Discard All Sessions'}
+ ? t('Discard All Sessions ({count})', { count: sessions.length })
+ : t('Discard All Sessions')}
</span>
</button>
</div>
@@ -362,7 +370,7 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
) : (
<RotateCcw className="w-3.5 h-3.5" />
)}
- <span>{isRestoring ? 'Restoring Canvas...' : 'Restore Session'}</span>
+ <span>{isRestoring ? t('Restoring Canvas...') : t('Restore Session')}</span>
</button>
</div>
</div>
diff --git a/src/components/Csp3DToolbar.tsx b/src/components/Csp3DToolbar.tsx
index 3ae9e81..d59e6d0 100644
--- a/src/components/Csp3DToolbar.tsx
+++ b/src/components/Csp3DToolbar.tsx
@@ -26,6 +26,7 @@ import { PRIMITIVE_3D_ITEMS, Primitive3DType } from '../utils/primitives3D';
import { LightSourceWidget } from './LightSourceWidget';
import { Primitive3DIcon } from './Primitive3DIcon';
import { store3DActions, use3DStore } from '../stores';
+import { useI18n } from '../i18n';
export type Csp3DToolMode = Tool3DMode;
@@ -105,6 +106,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
onBakeTo2D,
onClose,
}) => {
+ const { t, tc, td } = useI18n();
const activeMode = use3DStore((s) => s.activeMode);
const gizmoMode = use3DStore((s) => s.gizmoMode);
const loadedModelName = use3DStore((s) => s.loadedModelName);
@@ -216,20 +218,22 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
>
<span className="flex items-center gap-1.5 text-ui-secondary">
<Box className="w-3.5 h-3.5 text-ui-accent" />
- <span className="max-w-[120px] truncate">{loadedModelName || '3D Reference'}</span>
+ <span className="max-w-[120px] truncate">
+ {loadedModelName ? td(loadedModelName) : t('3D Reference')}
+ </span>
</span>
<button
type="button"
onClick={onActivate3DTool}
- title="Switch to 3D Tool (K) to rotate, move, scale, or adjust lighting"
+ title={t('Switch to 3D Tool (K) to rotate, move, scale, or adjust lighting')}
className="px-2 py-0.5 rounded-full bg-ui-accent text-ui-accent-contrast font-medium hover:opacity-90 transition-opacity cursor-pointer"
>
- Edit 3D (K)
+ {t('Edit 3D (K)')}
</button>
<button
type="button"
onClick={() => store3DActions.toggleReferenceVisible()}
- title={isReferenceVisible ? 'Hide 3D Reference' : 'Show 3D Reference'}
+ title={isReferenceVisible ? t('Hide 3D Reference') : t('Show 3D Reference')}
className="p-1 rounded-full text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
{isReferenceVisible ? <Eye className="w-3.5 h-3.5" /> : <EyeOff className="w-3.5 h-3.5" />}
@@ -237,7 +241,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<button
type="button"
onClick={onClose}
- title="Close 3D Stage"
+ title={t('Close 3D Stage')}
className="p-1 rounded-full text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -256,7 +260,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<button
type="button"
onClick={onTriggerImport}
- title="Import 3D Model (.glb, .gltf, .obj) — or drag & drop onto canvas"
+ title={t('Import 3D Model (.glb, .gltf, .obj) — or drag & drop onto canvas')}
className={`flex items-center gap-1 px-2 py-1 rounded-ui-sm text-[11px] border border-ui-subtle transition-colors cursor-pointer max-w-[110px] truncate ${
loadedModelName
? 'bg-ui-control-active text-ui-primary font-medium'
@@ -264,14 +268,14 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
}`}
>
<Upload className="w-3 h-3 shrink-0 text-ui-accent" />
- <span className="truncate">{loadedModelName || 'Import 3D'}</span>
+ <span className="truncate">{loadedModelName ? td(loadedModelName) : t('Import 3D')}</span>
</button>
<div className="relative">
<button
type="button"
onClick={() => setOpenPopover((p) => (p === 'primitives' ? null : 'primitives'))}
- title="Create 3D Primitive (Cube, Sphere, Capsule, Cylinder, Pyramid)"
+ title={t('Create 3D Primitive (Cube, Sphere, Capsule, Cylinder, Pyramid)')}
data-testid="toolbar-3d-primitives-btn"
className={`flex items-center gap-1 px-2 py-1 rounded-ui-sm text-[11px] border transition-colors cursor-pointer ${
openPopover === 'primitives' || modelKind === 'primitive'
@@ -280,7 +284,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
}`}
>
<Shapes className="w-3 h-3 shrink-0" />
- <span>Primitives</span>
+ <span>{t('Primitives')}</span>
</button>
{openPopover === 'primitives' && (
@@ -289,7 +293,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
className="absolute top-full mt-2 left-0 w-44 bg-ui-elevated border border-ui-default rounded-ui-md p-1.5 shadow-ui-popover z-50 space-y-0.5"
>
<div className="px-2 py-1 text-[10px] uppercase tracking-wider text-ui-muted">
- Create Primitive
+ {t('Create Primitive')}
</div>
{PRIMITIVE_3D_ITEMS.map((item) => {
const isSelected = modelKind === 'primitive' && activePrimitiveType === item.type;
@@ -301,7 +305,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
onCreatePrimitive(item.type);
setOpenPopover(null);
}}
- title={item.description}
+ title={td(item.description)}
data-testid={`toolbar-3d-primitive-${item.type}`}
className={`w-full flex items-center gap-2 px-2 py-1.5 rounded-ui-xs text-[11px] transition-colors cursor-pointer ${
isSelected
@@ -310,7 +314,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
}`}
>
<Primitive3DIcon type={item.type} className="w-3.5 h-3.5 shrink-0" />
- <span>{item.label}</span>
+ <span>{td(item.label)}</span>
</button>
);
})}
@@ -327,34 +331,34 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
key={item.mode}
type="button"
onPointerDown={(e) => handleModeButtonPointerDown(item.mode, e)}
- title={item.title}
+ title={t(item.title)}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] transition-colors cursor-pointer ${
activeMode === item.mode
? 'bg-ui-accent text-ui-accent-contrast font-medium'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {item.label}
+ {tc('3dToolbar', item.label)}
</button>
))}
</div>
{/* 3. Camera Modes (Click or Scrub-Drag) */}
<div className="flex items-center bg-ui-input rounded-ui-sm p-0.5 border border-ui-subtle">
- <span className="px-1 text-[10px] text-ui-muted font-medium">Cam</span>
+ <span className="px-1 text-[10px] text-ui-muted font-medium">{t('Cam')}</span>
{CAMERA_MODES.map((item) => (
<button
key={item.mode}
type="button"
onPointerDown={(e) => handleModeButtonPointerDown(item.mode, e)}
- title={item.title}
+ title={t(item.title)}
className={`px-1.5 py-0.5 rounded-ui-xs text-[11px] transition-colors cursor-pointer ${
activeMode === item.mode
? 'bg-ui-accent text-ui-accent-contrast font-medium'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {item.label}
+ {tc('3dCam', item.label)}
</button>
))}
</div>
@@ -368,7 +372,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
key={g.mode}
type="button"
onClick={() => store3DActions.setGizmoMode(g.mode)}
- title={g.label}
+ title={t(g.label)}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
gizmoMode === g.mode
? 'bg-ui-control-active text-ui-accent'
@@ -384,7 +388,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
type="button"
onClick={onSnapToGround}
disabled={!hasModel}
- title="Snap Model to Ground Floor (Y = 0)"
+ title={t('Snap Model to Ground Floor (Y = 0)')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-40 transition-colors cursor-pointer"
>
<Magnet className="w-3.5 h-3.5" />
@@ -395,7 +399,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
type="button"
onClick={onUndo}
disabled={!canUndo3D}
- title="Undo 3D Action (Ctrl+Z)"
+ title={t('Undo 3D Action (Ctrl+Z)')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-30 disabled:cursor-not-allowed transition-colors cursor-pointer"
>
<Undo2 className="w-3.5 h-3.5" />
@@ -404,7 +408,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
type="button"
onClick={onRedo}
disabled={!canRedo3D}
- title="Redo 3D Action (Ctrl+Y)"
+ title={t('Redo 3D Action (Ctrl+Y)')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-30 disabled:cursor-not-allowed transition-colors cursor-pointer"
>
<Redo2 className="w-3.5 h-3.5" />
@@ -416,7 +420,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<button
type="button"
onClick={() => setOpenPopover((p) => (p === 'light' ? null : 'light'))}
- title="Quick Lighting & 3D Light Sphere"
+ title={t('Quick Lighting & 3D Light Sphere')}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
openPopover === 'light'
? 'bg-ui-accent-subtle text-ui-accent'
@@ -460,7 +464,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<button
type="button"
onClick={() => setOpenPopover((p) => (p === 'help' ? null : 'help'))}
- title="3D Tool Controls & Behavior Rules"
+ title={t('3D Tool Controls & Behavior Rules')}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
openPopover === 'help'
? 'bg-ui-accent-subtle text-ui-accent'
@@ -473,10 +477,11 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
{openPopover === 'help' && (
<div className="absolute top-full mt-2 right-0 w-72 bg-ui-elevated border border-ui-default rounded-ui-md p-3 shadow-ui-popover z-50 space-y-2">
<div className="flex items-center justify-between pb-1.5 border-b border-ui-subtle">
- <span className="text-[11px] font-medium text-ui-primary">3D Tool Behavior Rules</span>
+ <span className="text-[11px] font-medium text-ui-primary">{t('3D Tool Behavior Rules')}</span>
<button
type="button"
onClick={() => setOpenPopover(null)}
+ aria-label={t('Close')}
className="text-ui-icon-muted hover:text-ui-primary cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -485,8 +490,8 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<div className="space-y-1.5">
{TOOL_3D_BEHAVIOR_RULES.map((rule) => (
<div key={rule.gesture} className="flex items-start justify-between gap-2 text-[10px]">
- <span className="font-ui-mono text-ui-primary shrink-0">{rule.gesture}</span>
- <span className="text-ui-muted text-right">{rule.action}</span>
+ <span className="font-ui-mono text-ui-primary shrink-0">{td(rule.gesture)}</span>
+ <span className="text-ui-muted text-right">{td(rule.action)}</span>
</div>
))}
</div>
@@ -504,14 +509,14 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
onOpenLTModal();
}}
disabled={isBaking || !hasModel}
- title="Open Line & Tone Extraction Preview Dialog"
+ title={t('Open Line & Tone Extraction Preview Dialog')}
className={`px-2 py-1 rounded-ui-sm text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${
isLTModalOpen
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-ui-accent-border'
: 'bg-ui-control border border-ui-subtle text-ui-primary hover:bg-ui-control-hover'
}`}
>
- LT
+ {t('LT')}
</button>
{/* 8. Primary Bake Action (Shift+Click stamps a copy without closing!) */}
@@ -521,20 +526,20 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
disabled={isBaking || !hasModel}
title={
!hasModel
- ? 'Load a 3D model first'
- : 'Rasterize 3D view into a 2D Layer (Shift+Click to keep 3D stage open)'
+ ? t('Load a 3D model first')
+ : t('Rasterize 3D view into a 2D Layer (Shift+Click to keep 3D stage open)')
}
className="flex items-center gap-1 px-2.5 py-1 bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium rounded-ui-sm text-[11px] transition-opacity disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
>
<Layers className="w-3 h-3" />
- <span>{isBaking ? 'Baking...' : 'Bake'}</span>
+ <span>{isBaking ? t('Baking...') : t('Bake')}</span>
</button>
{/* 9. Reference Visibility & Close */}
<button
type="button"
onClick={() => store3DActions.toggleReferenceVisible()}
- title={isReferenceVisible ? 'Hide 3D Reference' : 'Show 3D Reference'}
+ title={isReferenceVisible ? t('Hide 3D Reference') : t('Show 3D Reference')}
className="p-1 text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
{isReferenceVisible ? <Eye className="w-3.5 h-3.5" /> : <EyeOff className="w-3.5 h-3.5" />}
@@ -543,7 +548,7 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
<button
type="button"
onClick={onClose}
- title="Close 3D Stage"
+ title={t('Close 3D Stage')}
className="p-1 text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
diff --git a/src/components/DeleteDocumentModal.tsx b/src/components/DeleteDocumentModal.tsx
index f57104a..b371f95 100644
--- a/src/components/DeleteDocumentModal.tsx
+++ b/src/components/DeleteDocumentModal.tsx
@@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import { Trash2, EyeOff, AlertTriangle, X, FileText } from 'lucide-react';
import { RecentDocument, formatFileSize } from '../utils/recentDocumentsManager';
+import { isImeComposing, useI18n } from '../i18n';
interface DeleteDocumentModalProps {
isOpen: boolean;
@@ -17,9 +18,12 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
onHideFromApp,
onPermanentlyDelete,
}) => {
+ const { t } = useI18n();
+
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -52,14 +56,14 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
id="delete-document-modal-title"
className="text-xs font-medium text-ui-primary tracking-wide"
>
- Delete Document
+ {t('Delete Document')}
</span>
</div>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -92,7 +96,7 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
</div>
<div className="text-[11px] font-medium text-ui-muted uppercase tracking-wider pt-0.5">
- Select action
+ {t('Select action')}
</div>
<div className="space-y-2">
@@ -107,10 +111,10 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
</div>
<div className="min-w-0">
<div className="text-xs font-medium text-ui-primary">
- Remove from Recent List
+ {t('Remove from Recent List')}
</div>
<div className="text-[11px] text-ui-muted mt-0.5 leading-snug">
- Removes entry from the studio. Keeps the file intact on disk.
+ {t('Removes entry from the studio. Keeps the file intact on disk.')}
</div>
</div>
</button>
@@ -126,10 +130,10 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
</div>
<div className="min-w-0">
<div className="text-xs font-medium text-ui-danger">
- Permanently Delete from Disk
+ {t('Permanently Delete from Disk')}
</div>
<div className="text-[11px] text-ui-danger/80 mt-0.5 leading-snug">
- Erases file permanently from storage. Cannot be undone.
+ {t('Erases file permanently from storage. Cannot be undone.')}
</div>
</div>
</button>
@@ -143,7 +147,7 @@ export const DeleteDocumentModal: React.FC<DeleteDocumentModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-xs font-medium text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</div>
</div>
diff --git a/src/components/DockWorkspace.tsx b/src/components/DockWorkspace.tsx
index d5d4fa3..6644aae 100644
--- a/src/components/DockWorkspace.tsx
+++ b/src/components/DockWorkspace.tsx
@@ -84,6 +84,7 @@ import { AutoActionPanel, AutoActionPanelProps } from './AutoActionPanel';
import { WorkspaceCommandHandlers } from './CommandBar';
import { FloatingPanelWindow, FLOATING_HEADER_HEIGHT } from './FloatingPanelWindow';
import { FocusModeOverlay } from './focus';
+import { isImeComposing, t as translate, td as translateData, useI18n } from '../i18n';
const DND_PANEL_MIME = 'application/x-inkstudio-panel';
@@ -155,6 +156,7 @@ function useSharedCustomBrushes(): [CspBrush[], React.Dispatch<React.SetStateAct
/** Isolated BrushSizePalette wrapper so brush size changes never re-render dock chrome or layers */
const BrushSizeDockedContent: React.FC<{ themePreset: ThemePreset }> = React.memo(
({ themePreset }) => {
+ const { t } = useI18n();
const size = useToolStore((s) => s.brushSettings.size);
const brushName = useToolStore((s) => s.brushSettings.brushName);
const preset = useToolStore((s) => s.brushSettings.preset);
@@ -183,7 +185,7 @@ const BrushSizeDockedContent: React.FC<{ themePreset: ThemePreset }> = React.mem
<BrushSizePalette
currentSize={size}
onSelectSize={handleSelectSize}
- activeBrushName={brushName || (tool === 'eraser' ? 'Eraser' : String(preset || 'Brush'))}
+ activeBrushName={brushName || (tool === 'eraser' ? t('Eraser') : String(preset || t('Brush')))}
tool={tool}
presetId={activePresetId}
onResetSizeToDefault={handleResetSize}
@@ -328,6 +330,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
onCollapseRowOrDock,
renderPanelBody,
}) => {
+ const { t, td } = useI18n();
const lockMove = useWorkspaceStore((s) => s.workspaceLocks.lockMove);
const [menuOpen, setMenuOpen] = useState(false);
const [menuPos, setMenuPos] = useState<{ top: number; left: number } | null>(null);
@@ -385,6 +388,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
setMenuOpen(false);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setMenuOpen(false);
};
const handleReposition = () => {
@@ -530,8 +534,10 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
data-testid={`dock-tab-${pid}`}
title={
lockMove
- ? `${meta.title} (Position locked)`
- : `${meta.title} — Drag tab to move, split side-by-side, or detach`
+ ? t('{title} (Position locked)', { title: td(meta.title) })
+ : t('{title} — Drag tab to move, split side-by-side, or detach', {
+ title: td(meta.title),
+ })
}
className={`relative h-5 ${isCompactToolOnly ? 'px-1' : 'px-1.5'} rounded-ui-xs flex items-center gap-1 text-[10px] transition-colors shrink-0 ${
lockMove ? 'cursor-pointer' : 'cursor-grab active:cursor-grabbing'
@@ -544,7 +550,9 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
{renderPanelIcon(pid, 'w-3 h-3 shrink-0')}
{!isCompactToolOnly && (
<span className="truncate max-w-[84px]">
- {cell.panelIds.length > 1 || isSplitRow ? meta.shortTitle : meta.title}
+ {cell.panelIds.length > 1 || isSplitRow
+ ? td(meta.shortTitle, 'panelShort')
+ : td(meta.title)}
</span>
)}
{isActive && cell.panelIds.length > 1 && (
@@ -562,8 +570,8 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
data-testid="dock-detach-btn-tools"
disabled={lockMove}
onClick={handleDetachActivePanel}
- title={lockMove ? 'Position locked' : 'Detach & Float Tool Panel'}
- aria-label="Detach Tool panel"
+ title={lockMove ? t('Position locked') : t('Detach & Float Tool Panel')}
+ aria-label={t('Detach Tool panel')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-35 disabled:cursor-not-allowed cursor-pointer shrink-0"
>
<PinOff className="w-2.5 h-2.5" />
@@ -575,8 +583,8 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
data-testid={`dock-detach-btn-${activePanelId}`}
disabled={lockMove}
onClick={handleDetachActivePanel}
- title={lockMove ? 'Position locked' : 'Detach & Float Palette'}
- aria-label={`Detach ${DOCK_PANEL_META[activePanelId].title}`}
+ title={lockMove ? t('Position locked') : t('Detach & Float Palette')}
+ aria-label={t('Detach {title}', { title: td(DOCK_PANEL_META[activePanelId].title) })}
className="w-4 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-35 disabled:cursor-not-allowed cursor-pointer"
>
<PinOff className="w-2.5 h-2.5" />
@@ -586,11 +594,11 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
type="button"
data-testid={`dock-collapse-group-btn-${activePanelId}`}
onClick={onCollapseRowOrDock}
- title={isRowCollapsed ? 'Expand Panel' : 'Hide / Collapse Panel'}
+ title={isRowCollapsed ? t('Expand Panel') : t('Hide / Collapse Panel')}
aria-label={
isRowCollapsed
- ? `Expand ${DOCK_PANEL_META[activePanelId].title}`
- : `Hide ${DOCK_PANEL_META[activePanelId].title}`
+ ? t('Expand {title}', { title: td(DOCK_PANEL_META[activePanelId].title) })
+ : t('Hide {title}', { title: td(DOCK_PANEL_META[activePanelId].title) })
}
aria-expanded={!isRowCollapsed}
className={`w-4 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
@@ -615,7 +623,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
});
}}
data-testid={`dock-menu-btn-${activePanelId}`}
- title="Palette Dock Options"
+ title={t('Palette Dock Options')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<MoreHorizontal className="w-3 h-3" />
@@ -635,7 +643,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-52 rounded-ui-md shadow-ui-popover p-1 z-[1000] text-[11px] bg-ui-elevated border border-ui-default text-ui-primary"
>
<div className="px-2 py-0.5 text-[10px] text-ui-muted truncate">
- {DOCK_PANEL_META[activePanelId].title}
+ {td(DOCK_PANEL_META[activePanelId].title)}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -650,7 +658,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<PinOff className="w-3 h-3 text-ui-accent" />
- <span>Detach &amp; Float Palette</span>
+ <span>{t('Detach & Float Palette')}</span>
</button>
{canSplitActiveTab && (
@@ -672,7 +680,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<Columns2 className="w-3 h-3 text-ui-accent" />
- <span>Split Side-by-Side Left</span>
+ <span>{t('Split Side-by-Side Left')}</span>
</button>
<button
@@ -692,7 +700,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<Columns2 className="w-3 h-3 text-ui-accent" />
- <span>Split Side-by-Side Right</span>
+ <span>{t('Split Side-by-Side Right')}</span>
</button>
</>
)}
@@ -715,7 +723,9 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
>
<Columns2 className="w-3 h-3 text-ui-accent" />
<span>
- Side-by-Side with {adjacentRowForSideSplit.direction === 'above' ? 'Above' : 'Below'}
+ {adjacentRowForSideSplit.direction === 'above'
+ ? t('Side-by-Side with Above')
+ : t('Side-by-Side with Below')}
</span>
</button>
)}
@@ -732,7 +742,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowLeftToLine className="w-3 h-3 text-ui-accent" />
- <span>Move to Left Dock</span>
+ <span>{t('Move to Left Dock')}</span>
</button>
)}
@@ -748,7 +758,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowRightToLine className="w-3 h-3 text-ui-accent" />
- <span>Move to Right Dock</span>
+ <span>{t('Move to Right Dock')}</span>
</button>
)}
@@ -764,7 +774,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowDownToLine className="w-3 h-3 text-ui-accent" />
- <span>Move to Bottom Dock</span>
+ <span>{t('Move to Bottom Dock')}</span>
</button>
)}
@@ -784,7 +794,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
) : (
<PanelRight className="w-3 h-3 text-ui-muted" />
)}
- <span>Move to New Column</span>
+ <span>{t('Move to New Column')}</span>
</button>
<button
@@ -800,7 +810,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
) : (
<ChevronsRight className="w-3 h-3 text-ui-muted" />
)}
- <span>Collapse Dock Strip</span>
+ <span>{t('Collapse Dock Strip')}</span>
</button>
</>
)}
@@ -816,7 +826,7 @@ const DockCellPanel: React.FC<DockCellPanelProps> = React.memo(({
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<X className="w-3 h-3" />
- <span>Close Palette</span>
+ <span>{t('Close Palette')}</span>
</button>
</div>,
document.body
@@ -875,6 +885,7 @@ export const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
onStartPointerTabDrag,
renderPanelBody,
}) => {
+ const { t } = useI18n();
const lockWidth = useWorkspaceStore((s) => s.workspaceLocks.lockWidth);
const rowRef = useRef<HTMLDivElement>(null);
const [resizingCellSplitIdx, setResizingCellSplitIdx] = useState<number | null>(null);
@@ -1049,7 +1060,7 @@ export const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
onPointerDown={(e) =>
handleStartCellSplitResize(e, cell, cells[cellIdx + 1], cellIdx)
}
- title={lockWidth ? 'Width locked' : 'Drag to resize side-by-side palettes'}
+ title={lockWidth ? t('Width locked') : t('Drag to resize side-by-side palettes')}
className={`group/csplit relative w-1 shrink-0 flex items-center justify-center transition-colors ${
lockWidth ? 'cursor-default' : 'cursor-col-resize'
}`}
@@ -1108,6 +1119,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
onStartPointerTabDrag,
renderPanelBody,
}) => {
+ const { t, td } = useI18n();
const openPopover = useWorkspaceStore((s) => s.openPopover);
const workspaceLocks = useWorkspaceStore((s) => s.workspaceLocks);
const { lockWidth, lockHeight, lockMove } = workspaceLocks;
@@ -1292,7 +1304,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
type="button"
onClick={() => workspaceStoreActions.toggleColumnCollapsed(col.id, false)}
data-testid={`dock-expand-${col.id}`}
- title="Expand Dock Column"
+ title={t('Expand Dock Column')}
className="w-6 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer shrink-0"
>
{side === 'left' ? (
@@ -1322,8 +1334,10 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
data-testid={`collapsed-tab-${pid}`}
title={
lockMove
- ? `${meta.title} (Click to pop out — position locked)`
- : `${meta.title} (Click to pop out, drag to move or detach)`
+ ? t('{title} (Click to pop out — position locked)', { title: td(meta.title) })
+ : t('{title} (Click to pop out, drag to move or detach)', {
+ title: td(meta.title),
+ })
}
aria-pressed={isOpen}
className={`relative w-6 h-7 rounded-ui-sm flex items-center justify-center transition-colors cursor-pointer shrink-0 ${
@@ -1358,7 +1372,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<div className="flex items-center gap-1.5 min-w-0">
{renderPanelIcon(activePopoverPanelId, 'w-3.5 h-3.5 text-ui-accent')}
<span className="text-[11px] font-medium text-ui-primary truncate">
- {DOCK_PANEL_META[activePopoverPanelId].title}
+ {td(DOCK_PANEL_META[activePopoverPanelId].title)}
</span>
</div>
<div className="flex items-center gap-0.5 shrink-0">
@@ -1366,7 +1380,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
type="button"
disabled={lockMove}
onClick={() => workspaceStoreActions.detachPanel(activePopoverPanelId)}
- title={lockMove ? 'Position locked' : 'Detach & Float Palette'}
+ title={lockMove ? t('Position locked') : t('Detach & Float Palette')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-35 disabled:cursor-not-allowed cursor-pointer"
>
<PinOff className="w-3 h-3" />
@@ -1374,7 +1388,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<button
type="button"
onClick={() => workspaceStoreActions.toggleColumnCollapsed(col.id, false)}
- title="Expand & Pin Column"
+ title={t('Expand & Pin Column')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
{side === 'left' ? (
@@ -1386,7 +1400,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<button
type="button"
onClick={() => workspaceStoreActions.closePopover()}
- title="Dismiss Popover (Esc)"
+ title={t('Dismiss Popover (Esc)')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<X className="w-3 h-3" />
@@ -1426,7 +1440,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
type="button"
onClick={() => workspaceStoreActions.toggleColumnCollapsed(col.id, true)}
data-testid={`dock-collapse-${col.id}`}
- title="Collapse Dock Column to Icon Strip"
+ title={t('Collapse Dock Column to Icon Strip')}
className="h-3.5 px-1 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
{side === 'left' ? (
@@ -1477,7 +1491,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
data-active={resizingSplitIdx === idx ? 'true' : 'false'}
data-locked={lockHeight ? 'true' : 'false'}
onPointerDown={(e) => handleStartGroupSplitResize(e, grp, col.groups[idx + 1], idx)}
- title={lockHeight ? 'Height locked' : 'Drag to resize stacked palettes'}
+ title={lockHeight ? t('Height locked') : t('Drag to resize stacked palettes')}
className={`group/hsplit relative h-1 shrink-0 flex items-center justify-center transition-colors ${
lockHeight ? 'cursor-default' : 'cursor-row-resize'
}`}
@@ -1521,7 +1535,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
data-active={isResizingColumn ? 'true' : 'false'}
data-locked={lockWidth ? 'true' : 'false'}
onPointerDown={handleStartColumnResize}
- title={lockWidth ? 'Width locked' : 'Drag to resize dock column'}
+ title={lockWidth ? t('Width locked') : t('Drag to resize dock column')}
className={`group/vsplit absolute top-0 bottom-0 w-[6px] flex items-center justify-center z-30 ${
lockWidth ? 'cursor-default pointer-events-none' : 'cursor-col-resize'
} ${side === 'left' ? '-right-[5px]' : '-left-[5px]'}`}
@@ -1570,6 +1584,7 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
onStartPointerTabDrag,
renderPanelBody,
}) => {
+ const { t, td } = useI18n();
const workspaceLocks = useWorkspaceStore((s) => s.workspaceLocks);
const { lockWidth, lockHeight, lockMove } = workspaceLocks;
const rowRef = useRef<HTMLDivElement>(null);
@@ -1805,11 +1820,11 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
);
workspaceStoreActions.toggleBottomDockCollapsed(false);
}}
- title={`Expand ${meta.title}`}
+ title={t('Expand {title}', { title: td(meta.title) })}
className="h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer shrink-0"
>
{renderPanelIcon(pid, 'w-3 h-3 shrink-0')}
- <span className="truncate max-w-[92px]">{meta.shortTitle}</span>
+ <span className="truncate max-w-[92px]">{td(meta.shortTitle, 'panelShort')}</span>
</button>
);
})
@@ -1820,7 +1835,7 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
type="button"
data-testid="bottom-dock-collapse-btn"
onClick={() => workspaceStoreActions.toggleBottomDockCollapsed(false)}
- title="Expand Bottom Dock"
+ title={t('Expand Bottom Dock')}
aria-expanded="false"
className="h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer shrink-0"
>
@@ -1847,7 +1862,7 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
data-active={isResizingHeight ? 'true' : 'false'}
data-locked={lockHeight ? 'true' : 'false'}
onPointerDown={handleStartHeightResize}
- title={lockHeight ? 'Height locked' : 'Drag to resize Bottom Dock height'}
+ title={lockHeight ? t('Height locked') : t('Drag to resize Bottom Dock height')}
className={`group/bsplit relative h-[5px] shrink-0 flex items-center justify-center transition-colors ${
lockHeight ? 'cursor-default' : 'cursor-row-resize'
}`}
@@ -1867,7 +1882,7 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
data-testid="bottom-dock-collapse-btn"
onPointerDown={(e) => e.stopPropagation()}
onClick={handleCollapseBottom}
- title="Collapse Bottom Dock"
+ title={t('Collapse Bottom Dock')}
aria-expanded="true"
className="absolute right-1.5 -top-[5px] h-[14px] px-1.5 rounded-ui-xs bg-ui-header border border-ui-subtle text-ui-muted hover:text-ui-primary hover:border-ui-default flex items-center justify-center cursor-pointer z-30"
>
@@ -1918,7 +1933,7 @@ export const BottomDockView: React.FC<BottomDockViewProps> = React.memo(({
onPointerDown={(e) =>
handleStartCellSplitResize(e, cell, bottomDock.cells[cellIdx + 1], cellIdx)
}
- title={lockWidth ? 'Width locked' : 'Drag to resize side-by-side palettes'}
+ title={lockWidth ? t('Width locked') : t('Drag to resize side-by-side palettes')}
className={`group/csplit relative w-1 shrink-0 flex items-center justify-center transition-colors ${
lockWidth ? 'cursor-default' : 'cursor-col-resize'
}`}
@@ -2055,7 +2070,7 @@ export function detectDockDropTarget(
}
if (bestFloatingMatch) {
const targetFp = (layout.floatingPanels ?? []).find((p) => p.id === bestFloatingMatch!.id);
- const title = targetFp ? DOCK_PANEL_META[targetFp.activePanelId].title : 'Panel';
+ const title = targetFp ? translateData(DOCK_PANEL_META[targetFp.activePanelId].title) : translate('Panel');
return {
kind: 'floating-tab',
targetFloatingId: bestFloatingMatch.id,
@@ -2065,7 +2080,7 @@ export function detectDockDropTarget(
width: bestFloatingMatch.rect.width,
height: bestFloatingMatch.rect.height,
},
- label: `Group with ${title}`,
+ label: translate('Group with {title}', { title }),
};
}
@@ -2086,7 +2101,7 @@ export function detectDockDropTarget(
width: 28,
height: Math.max(40, wsRect.height - 8),
},
- label: 'Dock Left Edge',
+ label: translate('Dock Left Edge'),
};
}
if (clientX <= wsRect.right + 8 && clientX >= wsRect.right - outerEdgeWidth) {
@@ -2100,7 +2115,7 @@ export function detectDockDropTarget(
width: 28,
height: Math.max(40, wsRect.height - 8),
},
- label: 'Dock Right Edge',
+ label: translate('Dock Right Edge'),
};
}
@@ -2130,7 +2145,7 @@ export function detectDockDropTarget(
width: rect.width,
height: Math.max(40, rect.height - 4),
},
- label: 'Dock to Strip',
+ label: translate('Dock to Strip'),
};
}
}
@@ -2153,7 +2168,7 @@ export function detectDockDropTarget(
width: Math.max(60, rect.width - 4),
height: Math.max(24, rect.height),
},
- label: 'Dock to Bottom',
+ label: translate('Dock to Bottom'),
};
}
}
@@ -2179,7 +2194,7 @@ export function detectDockDropTarget(
width: 10,
height: Math.max(40, rect.height - 8),
},
- label: 'New Left Column',
+ label: translate('New Left Column'),
};
}
if (sideStr === 'right' && Math.abs(clientX - rect.left) <= 8) {
@@ -2193,7 +2208,7 @@ export function detectDockDropTarget(
width: 10,
height: Math.max(40, rect.height - 8),
},
- label: 'New Right Column',
+ label: translate('New Right Column'),
};
}
}
@@ -2238,7 +2253,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 2),
height: 24,
},
- label: 'Add as Tab',
+ label: translate('Add as Tab'),
};
}
@@ -2257,7 +2272,7 @@ export function detectDockDropTarget(
width: splitW,
height: Math.max(24, rect.height - 4),
},
- label: 'Split Left',
+ label: translate('Split Left'),
};
}
@@ -2276,7 +2291,7 @@ export function detectDockDropTarget(
width: splitW,
height: Math.max(24, rect.height - 4),
},
- label: 'Split Right',
+ label: translate('Split Right'),
};
}
@@ -2292,7 +2307,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 4),
height: Math.max(24, rect.height - 4),
},
- label: 'Add as Tab',
+ label: translate('Add as Tab'),
};
}
}
@@ -2339,7 +2354,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 2),
height: 24,
},
- label: 'Add as Tab',
+ label: translate('Add as Tab'),
};
}
@@ -2370,7 +2385,7 @@ export function detectDockDropTarget(
width: splitW,
height: Math.max(24, rect.height - 4),
},
- label: 'Split Side-by-Side Left',
+ label: translate('Split Side-by-Side Left'),
};
}
@@ -2389,7 +2404,7 @@ export function detectDockDropTarget(
width: splitW,
height: Math.max(24, rect.height - 4),
},
- label: 'Split Side-by-Side Right',
+ label: translate('Split Side-by-Side Right'),
};
}
@@ -2406,7 +2421,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 4),
height: splitH,
},
- label: 'Stack Above',
+ label: translate('Stack Above'),
};
}
@@ -2423,7 +2438,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 4),
height: splitH,
},
- label: 'Stack Below',
+ label: translate('Stack Below'),
};
}
@@ -2439,7 +2454,7 @@ export function detectDockDropTarget(
width: Math.max(24, rect.width - 4),
height: Math.max(24, rect.height - 4),
},
- label: 'Add as Tab',
+ label: translate('Add as Tab'),
};
}
}
@@ -2462,7 +2477,7 @@ export function detectDockDropTarget(
width: Math.max(80, stageRect.width - 12),
height: 32,
},
- label: 'Dock to Bottom',
+ label: translate('Dock to Bottom'),
};
}
}
@@ -2480,7 +2495,7 @@ export function detectDockDropTarget(
width: 24,
height: Math.max(40, wsRect.height - 8),
},
- label: 'New Left Column',
+ label: translate('New Left Column'),
};
}
}
@@ -2497,7 +2512,7 @@ export function detectDockDropTarget(
width: 24,
height: Math.max(40, wsRect.height - 8),
},
- label: 'New Right Column',
+ label: translate('New Right Column'),
};
}
}
@@ -2528,6 +2543,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
statusBar,
children,
}) => {
+ const { t, td } = useI18n();
const layout = useWorkspaceStore((s) => s.layout);
const palettesHidden = useWorkspaceStore((s) => s.palettesHidden);
const openPopover = useWorkspaceStore((s) => s.openPopover);
@@ -2575,6 +2591,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
useEffect(() => {
if (!openPopover) return;
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') workspaceStoreActions.closePopover();
};
window.addEventListener('keydown', handleKey);
@@ -2635,6 +2652,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
};
const onKeyDown = (ev: KeyboardEvent) => {
+ if (isImeComposing(ev)) return;
if (ev.key === 'Escape' && active) {
ev.preventDefault();
cleanup();
@@ -2818,6 +2836,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
};
const onKeyDown = (ev: KeyboardEvent) => {
+ if (isImeComposing(ev)) return;
if (ev.key === 'Escape' && active) {
ev.preventDefault();
workspaceStoreActions.moveFloatingPanel(floatingId, origX, origY, false);
@@ -3140,7 +3159,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
? 'w-8 bg-ui-accent-subtle border-2 border-dashed border-ui-accent'
: 'bg-ui-accent-subtle/40'
}`}
- title="Drop to create new Left Dock column"
+ title={t('Drop to create new Left Dock column')}
/>
)}
</div>
@@ -3177,10 +3196,10 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
? 'h-8 bg-ui-accent-subtle border-2 border-dashed border-ui-accent'
: 'h-4 bg-ui-accent-subtle/40 border border-dashed border-ui-accent-border/60'
}`}
- title="Drop to dock beneath the canvas"
+ title={t('Drop to dock beneath the canvas')}
>
{edgeDropSide === 'bottom' && (
- <span className="text-[10px] font-medium text-ui-primary">Dock to Bottom</span>
+ <span className="text-[10px] font-medium text-ui-primary">{t('Dock to Bottom')}</span>
)}
</div>
)}
@@ -3234,7 +3253,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
? 'w-8 bg-ui-accent-subtle border-2 border-dashed border-ui-accent'
: 'bg-ui-accent-subtle/40'
}`}
- title="Drop to create new Right Dock column"
+ title={t('Drop to create new Right Dock column')}
/>
)}
@@ -3321,14 +3340,14 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
>
{renderPanelIcon(pointerDragUi.source.panelId, 'w-3.5 h-3.5 text-ui-accent')}
<span className="font-medium">
- {DOCK_PANEL_META[pointerDragUi.source.panelId].title}
+ {td(DOCK_PANEL_META[pointerDragUi.source.panelId].title)}
</span>
<span className="text-[10px] text-ui-muted border-l border-ui-subtle pl-1.5">
{visibleDropTarget
? visibleDropTarget.label
: pointerDragUi.dropTarget?.kind === 'self-noop'
- ? 'Drag outside to float'
- : 'Release to float'}
+ ? t('Drag outside to float')
+ : t('Release to float')}
</span>
</div>,
document.body
diff --git a/src/components/DocumentLifecycleManager.tsx b/src/components/DocumentLifecycleManager.tsx
index 05db773..18aa280 100644
--- a/src/components/DocumentLifecycleManager.tsx
+++ b/src/components/DocumentLifecycleManager.tsx
@@ -2,10 +2,12 @@ import React, { useRef, useEffect, useCallback } from 'react';
import {
CanvasColorMode,
CanvasDimensions,
+ CanvasSelection,
DocumentTab,
LayerItem,
LoadedDocument,
NewCanvasOptions,
+ hasTileBackedLayer,
} from '../types/editor';
import { AppSettings, ResizeCanvasOptions } from '../types/settings';
import { openFile } from '../utils/imageLoader';
@@ -46,18 +48,28 @@ import {
useUiStore,
} from '../stores';
import { PushHistoryStepFn } from '../hooks/drawing';
+import {
+ CanvasResizeResult,
+ transformPerspectiveRulerForResize,
+ transformStraightRulerForResize,
+} from '../hooks/layerManager/useLayerResize';
+import { hydratePagedTilesForLayers } from '../utils/saveManager/exportGridPrep';
+import { cloneSelectionForHistory } from '../utils/selectionUtils';
+import { SparseTileGrid } from '../utils/tileEngine';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
import {
SaveDocumentResult,
isFinalizingAppClose,
requestAppClose,
} from '../utils/appCloseFlow';
+import { installReloadGuard } from '../utils/reloadGuard';
import {
findOpenDocumentBySourcePath,
listenForOpenFiles,
readTauriPathAsFile,
takePendingOpenFiles,
} from '../utils/osFileOpen';
+import { t } from '../i18n';
function hasMeaningfulLayerEdit(prev: LayerItem[], next: LayerItem[]): boolean {
if (prev === next) return false;
@@ -226,7 +238,10 @@ export interface UseDocumentLifecycleParams {
activeLayerId: string,
dimensions: CanvasDimensions
) => void;
- resizeCanvas: (newDims: CanvasDimensions, options: ResizeCanvasOptions) => void;
+ resizeCanvas: (
+ newDims: CanvasDimensions,
+ options: ResizeCanvasOptions
+ ) => CanvasResizeResult | void;
copyLayer: (id: string) => LayerItem | null;
pasteLayer: () => Promise<{
success: boolean;
@@ -236,6 +251,9 @@ export interface UseDocumentLifecycleParams {
layerTreeDelta?: import('../types/editor').LayerTreeDelta;
}>;
onDeselectAfterPaste?: () => void;
+ getSelection?: () => CanvasSelection | null;
+ clearSelectionWithoutHistory?: () => void;
+ flushPendingHistoryTasks?: () => void;
deleteLayer: (id: string) => void;
pasteLayerFromFile: (file: File) => Promise<string>;
resetZoomAndCenter: (dims?: CanvasDimensions) => void;
@@ -248,8 +266,8 @@ export function useDocumentLifecycle({
layers,
activeLayer,
activeLayerId,
- getEffectiveOpacity,
- isLayerEffectivelyVisible,
+ getEffectiveOpacity: _getEffectiveOpacity,
+ isLayerEffectivelyVisible: _isLayerEffectivelyVisible,
setActiveLayerId,
resetToNewCanvas,
setDefaultToneFrequency,
@@ -260,6 +278,9 @@ export function useDocumentLifecycle({
copyLayer,
pasteLayer,
onDeselectAfterPaste,
+ getSelection,
+ clearSelectionWithoutHistory,
+ flushPendingHistoryTasks,
deleteLayer,
pasteLayerFromFile,
resetZoomAndCenter,
@@ -268,8 +289,6 @@ export function useDocumentLifecycle({
showToast,
}: UseDocumentLifecycleParams) {
const activeDocumentId = useDocumentStore((s) => s.activeDocumentId);
- const dimensions = useDocumentStore((s) => s.dimensions);
- const colorMode = useDocumentStore((s) => s.colorMode);
const documentName = useDocumentStore((s) => s.documentName);
const savedFileInfo = useDocumentStore((s) => s.savedFileInfo);
@@ -356,12 +375,12 @@ export function useDocumentLifecycle({
};
artworkTimeTracker.initDocument(newDocId, 0);
- documentStoreActions.setPerspectiveRuler(null);
- documentStoreActions.setStraightRuler(null);
+ documentStoreActions.setPerspectiveRuler(null, { recordHistory: false });
+ documentStoreActions.setStraightRuler(null, { recordHistory: false });
documentStoreActions.setDocuments((prev) => [...prev, newDoc]);
documentStoreActions.setActiveDocumentId(newDocId);
uiStoreActions.setAppView('workspace');
- showToast(`Created ${name}`);
+ showToast(t('Created {name}', { name }));
},
[resetHistory, resetToNewCanvas, resetZoomAndCenter, showToast]
);
@@ -370,7 +389,7 @@ export function useDocumentLifecycle({
if (!activeLayer) return;
const copied = copyLayer(activeLayerId);
if (copied) {
- showToast(`Copied layer "${copied.name}"`);
+ showToast(t('Copied layer "{name}"', { name: copied.name }));
}
}, [activeLayer, activeLayerId, copyLayer, showToast]);
@@ -380,7 +399,7 @@ export function useDocumentLifecycle({
if (res.layerId && ((res.tileDeltas && res.tileDeltas.length > 0) || res.layerTreeDelta)) {
pushHistoryStep(
'selection-move',
- `Paste "${res.layerName}"`,
+ t('Paste "{name}"', { name: res.layerName }),
null,
null,
res.layerId,
@@ -394,21 +413,21 @@ export function useDocumentLifecycle({
);
}
onDeselectAfterPaste?.();
- showToast(`Pasted into "${res.layerName}"`);
+ showToast(t('Pasted into "{name}"', { name: res.layerName }));
} else {
- showToast('Clipboard is empty');
+ showToast(t('Clipboard is empty'));
}
}, [onDeselectAfterPaste, pasteLayer, pushHistoryStep, showToast]);
const handleDeleteSelectedLayer = useCallback(() => {
const rasterCount = layers.filter((l) => l.type === 'raster').length;
if (rasterCount <= 1) {
- showToast('Cannot delete the only raster layer');
+ showToast(t('Cannot delete the only raster layer'));
return;
}
- const layerName = activeLayer?.name || 'layer';
+ const layerName = activeLayer?.name || t('layer');
deleteLayer(activeLayerId);
- showToast(`Deleted layer "${layerName}"`);
+ showToast(t('Deleted layer "{name}"', { name: layerName }));
}, [activeLayer, activeLayerId, deleteLayer, layers, showToast]);
const handleTriggerPasteFromFile = useCallback(() => {
@@ -422,13 +441,13 @@ export function useDocumentLifecycle({
try {
const layerName = await pasteLayerFromFile(file);
documentStoreActions.markDocumentDirty(useDocumentStore.getState().activeDocumentId, true);
- showToast(`Pasted "${layerName}" from file`);
+ showToast(t('Pasted "{name}" from file', { name: layerName }));
} catch (err: unknown) {
console.error('Failed to paste from file:', err);
const errMsg = err instanceof Error ? err.message : String(err);
void uiStoreActions.alertDialog({
- title: 'Paste Image Failed',
- message: `Failed to paste image from file: ${errMsg}`,
+ title: t('Paste Image Failed'),
+ message: t('Failed to paste image from file: {error}', { error: errMsg }),
});
} finally {
if (pasteFileInputRef.current) {
@@ -450,7 +469,7 @@ export function useDocumentLifecycle({
if (file) {
toolStoreActions.selectTool('3d');
uiStoreActions.set3DLayerOpen(true, file);
- showToast(`Importing 3D model "${file.name}" into 3D stage...`);
+ showToast(t('Importing 3D model "{name}" into 3D stage...', { name: file.name }));
if (import3DFileInputRef.current) {
import3DFileInputRef.current.value = '';
}
@@ -459,33 +478,161 @@ export function useDocumentLifecycle({
[showToast]
);
+ const hasPagedTilesForLayers = (grid: SparseTileGrid | undefined, layerList: LayerItem[]) => {
+ if (!grid || !grid.getMemoryManager()) return false;
+ for (const layer of layerList) {
+ if (!hasTileBackedLayer(layer)) continue;
+ const tiles = grid.getLayerTiles(layer.id, 0);
+ for (const tile of tiles) {
+ if (tile.data === null && tile.isPagedToDisk) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
const handleResizeCanvas = useCallback(
(options: ResizeCanvasOptions) => {
if (multiplayerService.isConnected() && multiplayerService.getLocalRole() === 'viewer') {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
- const curDims = useDocumentStore.getState().dimensions;
- const newDims: CanvasDimensions = {
- width: options.width,
- height: options.height,
- dpi: options.dpi || curDims.dpi,
+
+ const executeResize = () => {
+ flushPendingHistoryTasks?.();
+
+ const storeState = useDocumentStore.getState();
+ const curDims = storeState.dimensions;
+ const activeId = storeState.activeDocumentId;
+ const newDims: CanvasDimensions = {
+ width: options.width,
+ height: options.height,
+ dpi: options.dpi || curDims.dpi,
+ };
+
+ const beforeDims: CanvasDimensions = { ...curDims };
+ const beforePersp = storeState.perspectiveRuler
+ ? {
+ ...storeState.perspectiveRuler,
+ grid: { ...storeState.perspectiveRuler.grid },
+ vps: storeState.perspectiveRuler.vps.map((vp) => ({ ...vp })),
+ }
+ : null;
+ const beforeStraight = storeState.straightRuler
+ ? { ...storeState.straightRuler }
+ : null;
+ const beforeSelection = cloneSelectionForHistory(getSelection?.() ?? null);
+
+ const resizeRes = resizeCanvas(newDims, options) as CanvasResizeResult | void;
+ if (clearSelectionWithoutHistory) {
+ clearSelectionWithoutHistory();
+ } else {
+ onDeselectAfterPaste?.();
+ }
+
+ const scaleContent = resizeRes ? resizeRes.scaleContent : Boolean(options.scaleContent);
+ const offsetX = resizeRes ? resizeRes.offsetX : 0;
+ const offsetY = resizeRes ? resizeRes.offsetY : 0;
+ const scaleX = resizeRes ? resizeRes.scaleX : newDims.width / Math.max(1, curDims.width);
+ const scaleY = resizeRes ? resizeRes.scaleY : newDims.height / Math.max(1, curDims.height);
+ const afterPersp = transformPerspectiveRulerForResize(
+ beforePersp,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ );
+ const afterStraight = transformStraightRulerForResize(
+ beforeStraight,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ );
+
+ documentStoreActions.setDimensions(newDims, activeId);
+ if (beforePersp) {
+ documentStoreActions.setPerspectiveRuler(afterPersp, { recordHistory: false });
+ }
+ if (beforeStraight) {
+ documentStoreActions.setStraightRuler(afterStraight, { recordHistory: false });
+ }
+ documentStoreActions.markDocumentDirty(activeId, true);
+
+ pendingFitDimsRef.current = newDims;
+ needsAdaptiveFitRef.current = true;
+ resetZoomAndCenter(newDims);
+
+ pushHistoryStep(
+ 'canvas-resize',
+ scaleContent
+ ? t('Resize Canvas ({width} × {height})', {
+ width: newDims.width,
+ height: newDims.height,
+ })
+ : t('Crop / Resize Canvas ({width} × {height})', {
+ width: newDims.width,
+ height: newDims.height,
+ }),
+ null,
+ null,
+ activeLayerId || layersRef.current[0]?.id || '',
+ { x: 0, y: 0, width: newDims.width, height: newDims.height },
+ resizeRes?.tileDeltas,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ resizeRes?.layerTreeDelta,
+ {
+ beforeDimensions: beforeDims,
+ afterDimensions: { ...newDims },
+ ...(beforePersp
+ ? { beforePerspectiveRuler: beforePersp, afterPerspectiveRuler: afterPersp }
+ : {}),
+ ...(beforeStraight
+ ? { beforeStraightRuler: beforeStraight, afterStraightRuler: afterStraight }
+ : {}),
+ ...(beforeSelection ? { beforeSelection, afterSelection: null } : {}),
+ }
+ );
+
+ if (multiplayerService.isConnected()) {
+ multiplayerService.sendCanvasResize(newDims, options);
+ }
+ showToast(
+ t('Canvas resized to {width} × {height} px', {
+ width: newDims.width,
+ height: newDims.height,
+ })
+ );
};
- resizeCanvas(newDims, options);
- onDeselectAfterPaste?.();
- documentStoreActions.setDimensions(newDims);
- documentStoreActions.markDocumentDirty(useDocumentStore.getState().activeDocumentId, true);
- pendingFitDimsRef.current = newDims;
- needsAdaptiveFitRef.current = true;
- resetZoomAndCenter(newDims);
- resetHistory();
- if (multiplayerService.isConnected()) {
- multiplayerService.sendCanvasResize(newDims, options);
+ const activeGrid = documentStore.getActiveTileGrid();
+ if (hasPagedTilesForLayers(activeGrid, layersRef.current)) {
+ void hydratePagedTilesForLayers(activeGrid, layersRef.current, false)
+ .catch((err) => {
+ console.warn('[ResizeCanvas] Failed hydrating paged tiles before resize:', err);
+ })
+ .then(executeResize);
+ } else {
+ executeResize();
}
- showToast(`Canvas resized to ${newDims.width} × ${newDims.height} px`);
},
- [onDeselectAfterPaste, resetHistory, resetZoomAndCenter, resizeCanvas, showToast]
+ [
+ activeLayerId,
+ clearSelectionWithoutHistory,
+ flushPendingHistoryTasks,
+ getSelection,
+ onDeselectAfterPaste,
+ pushHistoryStep,
+ resetZoomAndCenter,
+ resizeCanvas,
+ showToast,
+ ]
);
const handleUpdateSettings = useCallback((newSettings: AppSettings) => {
@@ -539,20 +686,25 @@ export function useDocumentLifecycle({
) {
toolStoreActions.selectTool('3d');
uiStoreActions.set3DLayerOpen(true, file);
- showToast(`Importing 3D model "${file.name}" into 3D stage...`);
+ showToast(t('Importing 3D model "{name}" into 3D stage...', { name: file.name }));
return;
}
if (lowerName.endsWith('.cls')) {
try {
- uiStoreActions.setLoading(true, `Importing Color Set: ${file.name}...`);
+ uiStoreActions.setLoading(true, t('Importing Color Set: {name}...', { name: file.name }));
const res = await colorSetsStoreActions.importSetFile(file);
if (res.ok) {
- showToast(`Imported color set "${res.set.name}" (${res.set.swatches.length} colors)`);
+ showToast(
+ t('Imported color set "{name}" ({count} colors)', {
+ name: res.set.name,
+ count: res.set.swatches.length,
+ })
+ );
} else {
showToast(res.error);
}
} catch {
- showToast('Failed to import color set file.');
+ showToast(t('Failed to import color set file.'));
} finally {
uiStoreActions.setLoading(false, '');
if (fileInputRef.current) {
@@ -564,20 +716,26 @@ export function useDocumentLifecycle({
if (isSupportedBrushFileName(file.name)) {
try {
- uiStoreActions.setLoading(true, `Importing Brush: ${file.name}...`);
+ uiStoreActions.setLoading(true, t('Importing Brush: {name}...', { name: file.name }));
const parsedBrush = await importBrushFile(file);
if (parsedBrush.importWarnings && parsedBrush.importWarnings.length > 0) {
const count = parsedBrush.importWarnings.length;
showToast(
count === 1
- ? `Imported "${parsedBrush.name}" (Notice: ${parsedBrush.importWarnings[0]})`
- : `Imported "${parsedBrush.name}" with ${count} CSP import notices — check inspector`
+ ? t('Imported "{name}" (Notice: {notice})', {
+ name: parsedBrush.name,
+ notice: parsedBrush.importWarnings[0],
+ })
+ : t('Imported "{name}" with {count} CSP import notices — check inspector', {
+ name: parsedBrush.name,
+ count,
+ })
);
} else {
- showToast(`Imported brush "${parsedBrush.name}"`);
+ showToast(t('Imported brush "{name}"', { name: parsedBrush.name }));
}
} catch (err: unknown) {
- const msg = err instanceof Error ? err.message : 'Failed to import brush file.';
+ const msg = err instanceof Error ? err.message : t('Failed to import brush file.');
showToast(msg);
} finally {
uiStoreActions.setLoading(false, '');
@@ -589,7 +747,7 @@ export function useDocumentLifecycle({
}
try {
- uiStoreActions.setLoading(true, `Loading ${file.name}...`);
+ uiStoreActions.setLoading(true, t('Loading {name}...', { name: file.name }));
const doc = await openFile(file);
const alreadyOpenId = options?.docId
@@ -641,7 +799,11 @@ export function useDocumentLifecycle({
if (frameTotal > 0) {
uiStoreActions.setLoading(
true,
- `Migrating time-lapse to local storage (${frameTotal} frame${frameTotal === 1 ? '' : 's'})...`
+ frameTotal === 1
+ ? t('Migrating time-lapse to local storage ({count} frame)...', { count: frameTotal })
+ : t('Migrating time-lapse to local storage ({count} frames)...', {
+ count: frameTotal,
+ })
);
}
restoredTimelapse = await globalTimelapseManager.attachOrRestoreSession(newDocId, {
@@ -655,7 +817,7 @@ export function useDocumentLifecycle({
if (frameTotal > 0 && total > 0) {
uiStoreActions.setLoading(
true,
- `Migrating time-lapse to local storage (${done}/${total})...`
+ t('Migrating time-lapse to local storage ({done}/{total})...', { done, total })
);
}
},
@@ -674,8 +836,10 @@ export function useDocumentLifecycle({
workTimeMs: restoredWorkTimeMs,
};
- documentStoreActions.setPerspectiveRuler(doc.perspectiveRuler ?? null);
- documentStoreActions.setStraightRuler(null);
+ documentStoreActions.setPerspectiveRuler(doc.perspectiveRuler ?? null, {
+ recordHistory: false,
+ });
+ documentStoreActions.setStraightRuler(null, { recordHistory: false });
if (doc.animationTimeline !== undefined) {
documentStoreActions.setAnimationTimeline(doc.animationTimeline);
}
@@ -726,20 +890,23 @@ export function useDocumentLifecycle({
showToast(
openedExt === '.sora'
- ? `Migrated legacy ${file.name} (read-only) — save as .ink`
+ ? t('Migrated legacy {name} (read-only) — save as .ink', { name: file.name })
: restoredTimelapse.enabled
? restoredTimelapse.frameCount > 0
- ? `Opened ${file.name} — time-lapse resumed (${restoredTimelapse.frameCount} frames)`
- : `Opened ${file.name} — time-lapse resumed`
- : `Opened ${file.name}`
+ ? t('Opened {name} — time-lapse resumed ({count} frames)', {
+ name: file.name,
+ count: restoredTimelapse.frameCount,
+ })
+ : t('Opened {name} — time-lapse resumed', { name: file.name })
+ : t('Opened {name}', { name: file.name })
);
} catch (err: unknown) {
console.error('Failed to open file:', err);
const errMsg = err instanceof Error ? err.message : String(err);
void uiStoreActions.alertDialog({
- title: 'Could Not Open File',
- message: `Could not open "${file.name}".`,
- detail: errMsg || 'Unsupported or corrupted file.',
+ title: t('Could Not Open File'),
+ message: t('Could not open "{name}".', { name: file.name }),
+ detail: errMsg || t('Unsupported or corrupted file.'),
});
} finally {
uiStoreActions.setLoading(false, '');
@@ -782,8 +949,10 @@ export function useDocumentLifecycle({
}
switchDocumentSession(id, doc.layers || [], doc.activeLayerId || '', doc.dimensions);
documentStoreActions.setActiveDocumentId(id);
- documentStoreActions.setPerspectiveRuler(doc.perspectiveRuler ?? null);
- documentStoreActions.setStraightRuler(doc.straightRuler ?? null);
+ documentStoreActions.setPerspectiveRuler(doc.perspectiveRuler ?? null, {
+ recordHistory: false,
+ });
+ documentStoreActions.setStraightRuler(doc.straightRuler ?? null, { recordHistory: false });
needsAdaptiveFitRef.current = true;
pendingFitDimsRef.current = doc.dimensions;
resetZoomAndCenter(doc.dimensions);
@@ -804,8 +973,12 @@ export function useDocumentLifecycle({
documentStoreActions.setDimensions(nextActive.dimensions);
documentStoreActions.setColorMode(nextActive.colorMode);
documentStoreActions.setDocumentName(nextActive.name);
- documentStoreActions.setPerspectiveRuler(nextActive.perspectiveRuler ?? null);
- documentStoreActions.setStraightRuler(nextActive.straightRuler ?? null);
+ documentStoreActions.setPerspectiveRuler(nextActive.perspectiveRuler ?? null, {
+ recordHistory: false,
+ });
+ documentStoreActions.setStraightRuler(nextActive.straightRuler ?? null, {
+ recordHistory: false,
+ });
if (nextActive.savedFileInfo && nextActive.savedFileInfo.extension) {
documentStoreActions.setSavedFileInfo({
name: nextActive.savedFileInfo.name,
@@ -837,8 +1010,8 @@ export function useDocumentLifecycle({
documentStoreActions.setDocumentName('');
documentStoreActions.setSavedFileInfo(null);
clearDocument();
- documentStoreActions.setPerspectiveRuler(null);
- documentStoreActions.setStraightRuler(null);
+ documentStoreActions.setPerspectiveRuler(null, { recordHistory: false });
+ documentStoreActions.setStraightRuler(null, { recordHistory: false });
uiStoreActions.setAppView('home');
}
}
@@ -918,7 +1091,7 @@ export function useDocumentLifecycle({
pushHistoryStep(
'initial',
- 'Session restored from crash',
+ t('Session restored from crash'),
null,
null,
manifest.activeLayerId || manifest.layers[0]?.id || ''
@@ -931,14 +1104,18 @@ export function useDocumentLifecycle({
prev.filter((s) => s.session_id !== session.session_id)
);
showToast(
- `Restored "${manifest.documentName}" (${replayedStrokesCount} strokes, ${replayedMutationsCount} mutations recovered)`
+ t('Restored "{name}" ({strokes} strokes, {mutations} mutations recovered)', {
+ name: manifest.documentName,
+ strokes: replayedStrokesCount,
+ mutations: replayedMutationsCount,
+ })
);
} catch (err: unknown) {
console.error('[Recovery] Restore error:', err);
const msg = err instanceof Error ? err.message : String(err);
void uiStoreActions.alertDialog({
- title: 'Recovery Failed',
- message: 'Failed to restore crashed session.',
+ title: t('Recovery Failed'),
+ message: t('Failed to restore crashed session.'),
detail: msg,
});
}
@@ -960,7 +1137,7 @@ export function useDocumentLifecycle({
if (remainingCount === 0) {
uiStoreActions.setRecoveryModal(false);
}
- showToast('Crashed session discarded');
+ showToast(t('Crashed session discarded'));
} catch (err: unknown) {
console.warn('[Recovery] Discard error:', err);
}
@@ -997,13 +1174,16 @@ export function useDocumentLifecycle({
if (failedIds.length > 0) {
showToast(
- `Discarded ${discardedIds.length} of ${sessionIds.length} crashed sessions`
+ t('Discarded {discarded} of {total} crashed sessions', {
+ discarded: discardedIds.length,
+ total: sessionIds.length,
+ })
);
} else {
showToast(
discardedIds.length === 1
- ? 'Crashed session discarded'
- : `Discarded all ${discardedIds.length} crashed sessions`
+ ? t('Crashed session discarded')
+ : t('Discarded all {count} crashed sessions', { count: discardedIds.length })
);
}
} catch (err: unknown) {
@@ -1031,7 +1211,10 @@ export function useDocumentLifecycle({
if (pickerWindow && typeof pickerWindow.showOpenFilePicker === 'function') {
void pickerWindow
.showOpenFilePicker({
- types: OPEN_FILE_PICKER_TYPES,
+ types: OPEN_FILE_PICKER_TYPES.map((item) => ({
+ ...item,
+ description: t(item.description),
+ })),
multiple: false,
})
.then(async ([handle]) => {
@@ -1063,37 +1246,36 @@ export function useDocumentLifecycle({
const buildSaveData = useCallback(
(onProgress?: (p: SaveProgress) => void): SaveDocumentData => {
- const cleanNameForSave = sanitizeDocumentStem(documentName, 'Untitled');
const docStoreState = useDocumentStore.getState();
- const tlMeta = globalTimelapseManager.getRecoveryMetadata(activeDocumentId);
- artworkTimeTracker.flush(activeDocumentId);
- const workTimeMs = artworkTimeTracker.getWorkTimeMs(activeDocumentId);
+ const curDocId = docStoreState.activeDocumentId || activeDocumentId;
+ const cleanNameForSave = sanitizeDocumentStem(
+ docStoreState.documentName || documentName,
+ 'Untitled'
+ );
+ const liveLayers = layersRef.current;
+ const tlMeta = globalTimelapseManager.getRecoveryMetadata(curDocId);
+ artworkTimeTracker.flush(curDocId);
+ const workTimeMs = artworkTimeTracker.getWorkTimeMs(curDocId);
return {
name: cleanNameForSave,
- dimensions,
- colorMode,
- layers,
- tileGrid: documentStore.getActiveTileGrid(),
- getEffectiveOpacity,
- isLayerEffectivelyVisible,
- tabId: activeDocumentId || undefined,
+ dimensions: docStoreState.dimensions,
+ colorMode: docStoreState.colorMode,
+ layers: liveLayers,
+ tileGrid:
+ (curDocId ? documentStore.getSession(curDocId)?.tileGrid : undefined) ??
+ documentStore.getActiveTileGrid(),
+ getEffectiveOpacity: (layer) => computeEffectiveOpacityForLayers(liveLayers, layer),
+ isLayerEffectivelyVisible: (layer) => computeLayerVisibleForLayers(liveLayers, layer),
+ tabId: curDocId || undefined,
perspectiveRuler: docStoreState.perspectiveRuler,
animationTimeline: docStoreState.animationTimeline,
timelapse: tlMeta,
- timelapseFrameProvider: globalTimelapseManager.createPersistenceProvider(activeDocumentId),
+ timelapseFrameProvider: globalTimelapseManager.createPersistenceProvider(curDocId),
workTimeMs,
onProgress,
};
},
- [
- activeDocumentId,
- colorMode,
- dimensions,
- documentName,
- getEffectiveOpacity,
- isLayerEffectivelyVisible,
- layers,
- ]
+ [activeDocumentId, documentName]
);
const handleSaveDocumentById = useCallback(
@@ -1109,6 +1291,8 @@ export function useDocumentLifecycle({
try {
const isActive = storeState.activeDocumentId === docId;
const docLayers = isActive ? layersRef.current : targetDoc.layers;
+ const docDims = isActive ? storeState.dimensions : targetDoc.dimensions;
+ const docColorMode = isActive ? storeState.colorMode : targetDoc.colorMode;
const docSavedInfo = isActive
? storeState.savedFileInfo ?? targetDoc.savedFileInfo ?? null
: targetDoc.savedFileInfo ?? null;
@@ -1128,8 +1312,8 @@ export function useDocumentLifecycle({
const docData: SaveDocumentData = {
name: cleanNameForSave,
- dimensions: targetDoc.dimensions,
- colorMode: targetDoc.colorMode,
+ dimensions: docDims,
+ colorMode: docColorMode,
layers: docLayers,
tileGrid: docTileGrid,
getEffectiveOpacity: (layer) => computeEffectiveOpacityForLayers(docLayers, layer),
@@ -1180,6 +1364,8 @@ export function useDocumentLifecycle({
? {
...d,
name: info.name,
+ dimensions: docDims,
+ colorMode: docColorMode,
...(updateHandle ? { savedFileInfo: info } : {}),
...(info.path ? { sourcePath: info.path } : {}),
isDirty: false,
@@ -1200,13 +1386,13 @@ export function useDocumentLifecycle({
coverUrl: info.previewDataUrl || docLayers[0]?.thumbnailUrl,
isStarred: false,
fileType: info.extension,
- width: targetDoc.dimensions?.width,
- height: targetDoc.dimensions?.height,
- dpi: targetDoc.dimensions?.dpi,
+ width: docDims?.width,
+ height: docDims?.height,
+ dpi: docDims?.dpi,
isSaved: true,
handle: info.handle,
}).catch(console.warn);
- showToast(`Saved to ${info.name}`);
+ showToast(t('Saved to {name}', { name: info.name }));
};
const hasDirectTarget = Boolean(
@@ -1223,8 +1409,8 @@ export function useDocumentLifecycle({
return 'canceled';
}
void uiStoreActions.alertDialog({
- title: 'Save Failed',
- message: 'Failed to save file.',
+ title: t('Save Failed'),
+ message: t('Failed to save file.'),
detail: msg,
});
return 'error';
@@ -1259,8 +1445,8 @@ export function useDocumentLifecycle({
return 'canceled';
}
void uiStoreActions.alertDialog({
- title: 'Save Failed',
- message: 'Failed to save file.',
+ title: t('Save Failed'),
+ message: t('Failed to save file.'),
detail: msg,
});
return 'error';
@@ -1310,6 +1496,8 @@ export function useDocumentLifecycle({
? {
...d,
name: info.name,
+ dimensions: docData.dimensions,
+ colorMode: docData.colorMode,
savedFileInfo: info,
...(info.path ? { sourcePath: info.path } : {}),
isDirty: false,
@@ -1327,22 +1515,22 @@ export function useDocumentLifecycle({
title: info.name,
path: info.path || `InkStudio\\${info.name}`,
size: info.size || 1572864,
- coverUrl: info.previewDataUrl || layers[0]?.thumbnailUrl,
+ coverUrl: info.previewDataUrl || layersRef.current[0]?.thumbnailUrl,
isStarred: false,
fileType: info.extension,
- width: dimensions.width,
- height: dimensions.height,
- dpi: dimensions.dpi,
+ width: docData.dimensions.width,
+ height: docData.dimensions.height,
+ dpi: docData.dimensions.dpi,
isSaved: true,
handle: info.handle,
}).catch(console.warn);
- showToast(`Saved as ${info.name}`);
+ showToast(t('Saved as {name}', { name: info.name }));
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg !== 'Save canceled') {
void uiStoreActions.alertDialog({
- title: 'Save Failed',
- message: 'Failed to save file.',
+ title: t('Save Failed'),
+ message: t('Failed to save file.'),
detail: msg,
});
}
@@ -1350,7 +1538,7 @@ export function useDocumentLifecycle({
if (currentId) savingDocIdsRef.current.delete(currentId);
uiStoreActions.setLoading(false, '');
}
- }, [activeDocumentId, buildSaveData, dimensions.dpi, dimensions.height, dimensions.width, layers, savedFileInfo, showToast]);
+ }, [activeDocumentId, buildSaveData, savedFileInfo, showToast]);
const handleExportImage = useCallback(async () => {
const cleanNameForSave = sanitizeDocumentStem(documentName, 'artwork');
@@ -1365,13 +1553,13 @@ export function useDocumentLifecycle({
try {
const exportedName = await promptExportPngImage(docData, cleanNameForSave, { initialDir });
- showToast(`Exported image to ${exportedName}`);
+ showToast(t('Exported image to {name}', { name: exportedName }));
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg !== 'Export canceled') {
void uiStoreActions.alertDialog({
- title: 'Export Failed',
- message: 'Failed to export image.',
+ title: t('Export Failed'),
+ message: t('Failed to export image.'),
detail: msg,
});
}
@@ -1410,7 +1598,7 @@ export function useDocumentLifecycle({
});
return;
}
- showToast(`Permission denied to open "${doc.title}"`);
+ showToast(t('Permission denied to open "{title}"', { title: doc.title }));
return;
} catch (err) {
console.warn('Direct FileSystemFileHandle read failed:', err);
@@ -1449,7 +1637,7 @@ export function useDocumentLifecycle({
}
}
- showToast(`Cannot reopen "${doc.title}" directly — select the file to open`);
+ showToast(t('Cannot reopen "{title}" directly — select the file to open', { title: doc.title }));
handleTriggerOpenFile();
},
[handleProcessFile, handleSelectDocument, handleTriggerOpenFile, showToast]
@@ -1471,7 +1659,7 @@ export function useDocumentLifecycle({
);
if (existing) {
handleSelectDocument(existing.id);
- showToast(`Switched to ${existing.name}`);
+ showToast(t('Switched to {name}', { name: existing.name }));
continue;
}
@@ -1482,9 +1670,9 @@ export function useDocumentLifecycle({
console.error('Failed to open file from OS path:', filePath, err);
const errMsg = err instanceof Error ? err.message : String(err);
void uiStoreActions.alertDialog({
- title: 'Could Not Open File',
- message: `Could not open "${filePath}".`,
- detail: errMsg || 'File could not be read.',
+ title: t('Could Not Open File'),
+ message: t('Could not open "{name}".', { name: filePath }),
+ detail: errMsg || t('File could not be read.'),
});
}
}
@@ -1797,12 +1985,12 @@ export const DocumentLifecycleManager: React.FC<DocumentLifecycleManagerProps> =
return {
sessionId: activeDocumentId,
documentName: doc?.name || cur.documentName || 'Untitled Document',
- width: doc?.dimensions.width || cur.dimensions.width,
- height: doc?.dimensions.height || cur.dimensions.height,
- dpi: doc?.dimensions.dpi || cur.dimensions.dpi || 600,
- colorMode: doc?.colorMode || cur.colorMode || 'color',
- layers: doc?.layers || cur.layers,
- activeLayerId: doc?.activeLayerId || cur.activeLayerId,
+ width: cur.dimensions.width || doc?.dimensions.width || 1920,
+ height: cur.dimensions.height || doc?.dimensions.height || 1080,
+ dpi: cur.dimensions.dpi || doc?.dimensions.dpi || 600,
+ colorMode: cur.colorMode || doc?.colorMode || 'color',
+ layers: cur.layers.length > 0 ? cur.layers : doc?.layers || [],
+ activeLayerId: cur.activeLayerId || doc?.activeLayerId || '',
timestamp: Date.now(),
workTimeMs: artworkTimeTracker.getWorkTimeMs(activeDocumentId),
timelapse: globalTimelapseManager.getRecoveryMetadata(activeDocumentId),
@@ -1811,9 +1999,9 @@ export const DocumentLifecycleManager: React.FC<DocumentLifecycleManagerProps> =
async () => {
const cur = recoveryStateRef.current;
const doc = cur.documents.find((d) => d.id === activeDocumentId);
- const targetLayerId = doc?.activeLayerId || cur.activeLayerId;
- const dims = doc?.dimensions || cur.dimensions;
- if (!targetLayerId || dims.width <= 0 || dims.height <= 0) return null;
+ const targetLayerId = cur.activeLayerId || doc?.activeLayerId;
+ const dims = cur.dimensions || doc?.dimensions;
+ if (!targetLayerId || !dims || dims.width <= 0 || dims.height <= 0) return null;
try {
const thumbW = 120;
const thumbH = Math.max(
@@ -1839,14 +2027,23 @@ export const DocumentLifecycleManager: React.FC<DocumentLifecycleManagerProps> =
);
}, [activeDocumentId]);
- // 5. Keep active document tab's metadata in sync
+ // 5. Keep active document tab's metadata (layers, activeLayerId, dimensions, colorMode) in sync
useEffect(() => {
if (!activeDocumentId) return;
documentStoreActions.setActiveLayerId(activeLayerId);
documentStoreActions.setDocuments((prev) => {
const curr = prev.find((d) => d.id === activeDocumentId);
if (!curr) return prev;
- if (curr.layers === layers && curr.activeLayerId === activeLayerId) {
+ const dimsSame =
+ curr.dimensions.width === dimensions.width &&
+ curr.dimensions.height === dimensions.height &&
+ curr.dimensions.dpi === dimensions.dpi;
+ if (
+ curr.layers === layers &&
+ curr.activeLayerId === activeLayerId &&
+ dimsSame &&
+ curr.colorMode === colorMode
+ ) {
return prev;
}
return prev.map((d) =>
@@ -1855,54 +2052,70 @@ export const DocumentLifecycleManager: React.FC<DocumentLifecycleManagerProps> =
...d,
layers,
activeLayerId,
+ dimensions: dimsSame ? d.dimensions : dimensions,
+ colorMode,
}
: d
);
});
- }, [layers, activeLayerId, activeDocumentId]);
+ }, [layers, activeLayerId, activeDocumentId, dimensions, colorMode]);
- // 6. Intercept OS/window close requests (Alt+F4, taskbar close, WM close) and show quit confirmation
+ // 6. Intercept OS/window close requests (Alt+F4, taskbar close, WM close) and protect
+ // against accidental page reloads (Ctrl+R, Cmd+R, F5, context-menu Reload, browser back/forward)
+ // in BOTH Tauri desktop and web browser environments.
useEffect(() => {
- if (isTauriEnvironment()) {
- let disposed = false;
- let unlisten: (() => void) | undefined;
-
- void import('@tauri-apps/api/window')
- .then(({ getCurrentWindow }) =>
- getCurrentWindow().onCloseRequested((event) => {
- if (isFinalizingAppClose()) return;
- event.preventDefault();
- requestAppClose();
- })
- )
- .then((fn) => {
- if (disposed) {
- fn();
- } else {
- unlisten = fn;
- }
- })
- .catch((err) => {
- console.warn('Failed to register Tauri close-requested guard:', err);
- });
+ const uninstallReloadGuard = installReloadGuard({
+ getDocuments: () => useDocumentStore.getState().documents,
+ isFinalizingClose: () => isFinalizingAppClose(),
+ isDrawingActive: () => recoveryService.getIsDrawingActive(),
+ shouldNotifyBlockedKey: (e) => {
+ const uiState = useUiStore.getState();
+ if (uiState.isSettingsModalOpen) return false;
+ const matched = shortcutManager.matchEvent(e, uiState.appSettings.shortcuts);
+ return !matched;
+ },
+ onBlockedReloadShortcut: () => {
+ const docs = useDocumentStore.getState().documents;
+ const hasDirty = docs.some((d) => Boolean(d.isDirty));
+ uiStoreActions.showToast(
+ hasDirty
+ ? t('Page reload blocked to protect unsaved artwork')
+ : t('Page reload is disabled in Ink Studio')
+ );
+ },
+ });
- return () => {
- disposed = true;
- if (unlisten) unlisten();
- };
+ if (!isTauriEnvironment()) {
+ return uninstallReloadGuard;
}
- // Browser fallback: warn via native beforeunload dialog when closing tab with unsaved work
- const handleBeforeUnload = (e: BeforeUnloadEvent) => {
- if (isFinalizingAppClose()) return;
- const hasDirty = useDocumentStore.getState().documents.some((d) => Boolean(d.isDirty));
- if (hasDirty) {
- e.preventDefault();
- e.returnValue = '';
- }
+ let disposed = false;
+ let unlisten: (() => void) | undefined;
+
+ void import('@tauri-apps/api/window')
+ .then(({ getCurrentWindow }) =>
+ getCurrentWindow().onCloseRequested((event) => {
+ if (isFinalizingAppClose()) return;
+ event.preventDefault();
+ requestAppClose();
+ })
+ )
+ .then((fn) => {
+ if (disposed) {
+ fn();
+ } else {
+ unlisten = fn;
+ }
+ })
+ .catch((err) => {
+ console.warn('Failed to register Tauri close-requested guard:', err);
+ });
+
+ return () => {
+ disposed = true;
+ if (unlisten) unlisten();
+ uninstallReloadGuard();
};
- window.addEventListener('beforeunload', handleBeforeUnload);
- return () => window.removeEventListener('beforeunload', handleBeforeUnload);
}, []);
// 7. Focus the canvas currently being confirmed during the per-canvas save prompt
diff --git a/src/components/DocumentTabBar.tsx b/src/components/DocumentTabBar.tsx
index 6d3e833..aaf2aa8 100644
--- a/src/components/DocumentTabBar.tsx
+++ b/src/components/DocumentTabBar.tsx
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { X, Plus, File } from 'lucide-react';
import { DocumentTab } from '../types/editor';
import { ThemePreset } from '../types/settings';
+import { isImeComposing, useI18n } from '../i18n';
export interface DocumentTabBarProps {
documents: DocumentTab[];
@@ -22,6 +23,7 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
onRenameDocument,
themePreset: _themePreset = 'modern',
}) => {
+ const { t } = useI18n();
const [editingId, setEditingId] = useState<string | null>(null);
const [editingName, setEditingName] = useState<string>('');
@@ -75,6 +77,7 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
onChange={(e) => setEditingName(e.target.value)}
onBlur={() => handleFinishRename(doc.id)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') handleFinishRename(doc.id);
if (e.key === 'Escape') setEditingId(null);
}}
@@ -89,7 +92,7 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
<span
data-testid={`dirty-indicator-${doc.id}`}
className="ml-0.5 text-ui-accent font-bold"
- title="Unsaved changes"
+ title={t('Unsaved changes')}
>
*
</span>
@@ -103,8 +106,8 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
e.stopPropagation();
onCloseDocument(doc.id);
}}
- aria-label={`Close ${doc.name}`}
- title="Close file"
+ aria-label={t('Close {name}', { name: doc.name })}
+ title={t('Close file')}
className={`p-0.5 rounded-ui-xs transition-colors cursor-pointer ${
isActive
? 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
@@ -125,8 +128,8 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
<button
type="button"
onClick={onNewDocument}
- aria-label="New Document"
- title="Create New File (Ctrl+N)"
+ aria-label={t('New Document')}
+ title={t('Create New File (Ctrl+N)')}
className="ml-1 p-1 rounded-ui-sm transition-colors flex items-center justify-center shrink-0 cursor-pointer text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover"
>
<Plus className="w-3.5 h-3.5" />
diff --git a/src/components/FilterModal.tsx b/src/components/FilterModal.tsx
index e12f0ca..99a193f 100644
--- a/src/components/FilterModal.tsx
+++ b/src/components/FilterModal.tsx
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { SlidersHorizontal, X } from 'lucide-react';
import { FilterType } from '../types/editor';
import { AnyFilterParams } from '../hooks/useTonalAndFilterActions';
+import { isImeComposing, useI18n } from '../i18n';
export interface FilterModalProps {
isOpen: boolean;
@@ -23,6 +24,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
onClose,
onApply,
}) => {
+ const { t, tc } = useI18n();
const [gaussianRadius, setGaussianRadius] = useState(5);
const [motionDistance, setMotionDistance] = useState(15);
const [motionAngle, setMotionAngle] = useState(0);
@@ -87,6 +89,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -136,14 +139,14 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="flex items-center gap-2 min-w-0">
<SlidersHorizontal className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span id="filter-modal-title" className="text-xs font-medium text-ui-primary truncate">
- {FILTER_TITLES[type]}
+ {t(FILTER_TITLES[type])}
</span>
</div>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={tc('action', 'Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -156,7 +159,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-gaussian-radius" className="text-[11px] text-ui-muted">
- Radius (px)
+ {t('Radius (px)')}
</label>
<input
id="filter-gaussian-radius"
@@ -188,7 +191,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-motion-distance" className="text-[11px] text-ui-muted">
- Distance (px)
+ {t('Distance (px)')}
</label>
<input
id="filter-motion-distance"
@@ -215,7 +218,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-motion-angle" className="text-[11px] text-ui-muted">
- Angle (°)
+ {t('Angle (°)')}
</label>
<input
id="filter-motion-angle"
@@ -246,7 +249,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-unsharp-radius" className="text-[11px] text-ui-muted">
- Radius (px)
+ {t('Radius (px)')}
</label>
<input
id="filter-unsharp-radius"
@@ -275,7 +278,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-unsharp-amount" className="text-[11px] text-ui-muted">
- Amount
+ {t('Amount')}
</label>
<input
id="filter-unsharp-amount"
@@ -304,7 +307,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-unsharp-threshold" className="text-[11px] text-ui-muted">
- Threshold
+ {t('Threshold')}
</label>
<input
id="filter-unsharp-threshold"
@@ -337,7 +340,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-grain-intensity" className="text-[11px] text-ui-muted">
- Intensity (%)
+ {t('Intensity (%)')}
</label>
<input
id="filter-grain-intensity"
@@ -364,7 +367,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor="filter-grain-size" className="text-[11px] text-ui-muted">
- Grain Size (px)
+ {t('Grain Size (px)')}
</label>
<input
id="filter-grain-size"
@@ -391,7 +394,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
</div>
<label className="flex items-center justify-between bg-ui-header border border-ui-subtle rounded-ui-sm px-3 py-2 cursor-pointer">
- <span className="text-[11px] text-ui-primary">Monochromatic Grain</span>
+ <span className="text-[11px] text-ui-primary">{t('Monochromatic Grain')}</span>
<input
type="checkbox"
checked={grainMono}
@@ -410,7 +413,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
onClick={resetCurrent}
className="text-[11px] text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
>
- Reset
+ {t('Reset')}
</button>
<div className="flex items-center gap-2">
@@ -419,7 +422,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-xs font-medium text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
@@ -427,7 +430,7 @@ export const FilterModal: React.FC<FilterModalProps> = ({
onClick={handleConfirm}
className="px-4 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-xs font-medium transition-opacity cursor-pointer"
>
- Apply
+ {t('Apply')}
</button>
</div>
</div>
diff --git a/src/components/FirstTimeNameModal.tsx b/src/components/FirstTimeNameModal.tsx
index 3821623..c942abf 100644
--- a/src/components/FirstTimeNameModal.tsx
+++ b/src/components/FirstTimeNameModal.tsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { User, Check } from 'lucide-react';
+import { isImeComposing, useI18n } from '../i18n';
interface FirstTimeNameModalProps {
isOpen: boolean;
@@ -10,13 +11,14 @@ export const FirstTimeNameModal: React.FC<FirstTimeNameModalProps> = ({
isOpen,
onSaveName,
}) => {
+ const { t } = useI18n();
const [name, setName] = useState('');
if (!isOpen) return null;
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
- const finalName = name.trim() || 'Artist';
+ const finalName = name.trim() || t('Artist');
onSaveName(finalName);
};
@@ -32,14 +34,14 @@ export const FirstTimeNameModal: React.FC<FirstTimeNameModalProps> = ({
<div className="h-10 px-4 bg-ui-header border-b border-ui-subtle flex items-center gap-2">
<User className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<h2 id="first-time-name-title" className="text-xs font-medium text-ui-primary tracking-wide">
- Artist Profile
+ {t('Artist Profile')}
</h2>
</div>
<form onSubmit={handleSubmit}>
<div className="p-4 space-y-2">
<label htmlFor="user-name-input" className="block text-[11px] font-medium text-ui-primary">
- Display Name
+ {t('Display Name')}
</label>
<input
id="user-name-input"
@@ -47,12 +49,17 @@ export const FirstTimeNameModal: React.FC<FirstTimeNameModalProps> = ({
autoFocus
value={name}
onChange={(e) => setName(e.target.value)}
- placeholder="Artist"
+ onKeyDown={(e) => {
+ if (isImeComposing(e) && e.key === 'Enter') {
+ e.preventDefault();
+ }
+ }}
+ placeholder={t('Artist')}
maxLength={40}
className="w-full px-3 py-2 bg-ui-input border border-ui-default rounded-ui-sm text-xs text-ui-primary placeholder:text-ui-muted/60 focus:border-ui-focus outline-none"
/>
<p className="text-[11px] text-ui-muted">
- Configures session metadata. Editable anytime in Preferences.
+ {t('Configures session metadata. Editable anytime in Preferences.')}
</p>
</div>
@@ -62,7 +69,7 @@ export const FirstTimeNameModal: React.FC<FirstTimeNameModalProps> = ({
className="inline-flex items-center gap-1.5 px-4 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:bg-ui-accent-hover text-xs font-medium transition-colors cursor-pointer"
>
<Check className="w-3.5 h-3.5" />
- <span>Continue</span>
+ <span>{t('Continue')}</span>
</button>
</div>
</form>
diff --git a/src/components/FloatingBrushPill.tsx b/src/components/FloatingBrushPill.tsx
index 0ff7451..844bbb6 100644
--- a/src/components/FloatingBrushPill.tsx
+++ b/src/components/FloatingBrushPill.tsx
@@ -2,6 +2,7 @@ import React, { useState, useRef, useCallback } from 'react';
import { ToolType, BrushSettings, FillSettings, LiquifySettings, RetouchSettings } from '../types/editor';
import { useUiStore, useWorkspaceStore } from '../stores';
import { clampNumber } from './ui/sliderMath';
+import { useI18n } from '../i18n';
interface FloatingBrushPillProps {
tool: ToolType;
@@ -60,6 +61,7 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
onSwapColors,
zoom = 1,
}) => {
+ const { t } = useI18n();
const sliderStyle = useUiStore((s) => s.appSettings.appearance.sliderStyle);
const leftHandedMode = useWorkspaceStore((s) => s.leftHandedMode);
const isTrackMode = sliderStyle === 'track';
@@ -316,7 +318,7 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
ref={sizeTrackRef}
role="slider"
tabIndex={0}
- aria-label="Brush Size"
+ aria-label={t('Brush Size')}
aria-orientation="vertical"
aria-valuemin={minSize}
aria-valuemax={maxSize}
@@ -333,7 +335,9 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
applySizeValue(defaultSize);
}}
onKeyDown={handleSizeKeyDown}
- title={`Brush Size: ${currentSize}px (Drag · Shift for fine · Double-click to reset)`}
+ title={t('Brush Size: {size}px (Drag · Shift for fine · Double-click to reset)', {
+ size: currentSize,
+ })}
className="relative w-4 h-28 flex items-center justify-center cursor-ns-resize touch-none group focus:outline-none"
>
{isTrackMode ? (
@@ -388,7 +392,7 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
} top-1/2 -translate-y-1/2 flex items-center gap-2.5`}
>
<div className="px-2 py-1 rounded-ui-sm bg-ui-elevated border border-ui-default shadow-ui-floating whitespace-nowrap flex items-center gap-1.5">
- <span className="text-[10px] text-ui-muted">Size</span>
+ <span className="text-[10px] text-ui-muted">{t('Size')}</span>
<span className="text-[11px] font-ui-mono tabular-nums text-ui-primary font-medium">
{currentSize}px
</span>
@@ -410,8 +414,8 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
<button
type="button"
onClick={onSwapColors}
- title="Active Color (Click to swap Primary/Secondary)"
- aria-label="Swap Primary and Secondary Colors"
+ title={t('Active Color (Click to swap Primary/Secondary)')}
+ aria-label={t('Swap Primary and Secondary Colors')}
className="my-2 w-3.5 h-3.5 rounded-ui-xs shrink-0 cursor-pointer border border-ui-strong hover:border-ui-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ui-focus"
style={{ backgroundColor: primaryColor }}
/>
@@ -421,7 +425,7 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
ref={opacityTrackRef}
role="slider"
tabIndex={0}
- aria-label={usesStrength ? 'Strength' : 'Opacity'}
+ aria-label={usesStrength ? t('Strength') : t('Opacity')}
aria-orientation="vertical"
aria-valuemin={1}
aria-valuemax={100}
@@ -438,7 +442,15 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
applyOpacityRatio(usesStrength ? 0.5 : 1);
}}
onKeyDown={handleOpacityKeyDown}
- title={`${usesStrength ? 'Strength' : 'Opacity'}: ${Math.round(opacityPct)}% (Drag · Shift for fine · Double-click to reset)`}
+ title={
+ usesStrength
+ ? t('Strength: {pct}% (Drag · Shift for fine · Double-click to reset)', {
+ pct: Math.round(opacityPct),
+ })
+ : t('Opacity: {pct}% (Drag · Shift for fine · Double-click to reset)', {
+ pct: Math.round(opacityPct),
+ })
+ }
className="relative w-4 h-28 flex items-center justify-center cursor-ns-resize touch-none group focus:outline-none"
>
{isTrackMode ? (
@@ -500,7 +512,7 @@ export const FloatingBrushPill: React.FC<FloatingBrushPillProps> = React.memo(({
} top-1/2 -translate-y-1/2 px-2 py-1 rounded-ui-sm bg-ui-elevated border border-ui-default shadow-ui-floating whitespace-nowrap flex items-center gap-1.5`}
>
<span className="text-[10px] text-ui-muted">
- {usesStrength ? 'Strength' : 'Opacity'}
+ {usesStrength ? t('Strength') : t('Opacity')}
</span>
<span className="text-[11px] font-ui-mono tabular-nums text-ui-primary font-medium">
{Math.round(opacityPct)}%
diff --git a/src/components/FloatingPanelWindow.tsx b/src/components/FloatingPanelWindow.tsx
index 83cdf4d..9eac047 100644
--- a/src/components/FloatingPanelWindow.tsx
+++ b/src/components/FloatingPanelWindow.tsx
@@ -19,6 +19,7 @@ import {
import { getFloatingSizeBounds } from '../utils/workspacePresets';
import { acquireWorkspaceInteractionLock } from '../utils/workspacePointerGuard';
import { useWorkspaceStore, workspaceStoreActions } from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
export const FLOATING_HEADER_HEIGHT = 28;
@@ -54,6 +55,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
onStartHeaderDrag,
onStartTabDrag,
}) => {
+ const { t, td } = useI18n();
const workspaceLocks = useWorkspaceStore((s) => s.workspaceLocks);
const { lockWidth, lockHeight, lockMove } = workspaceLocks;
const [menuOpen, setMenuOpen] = useState(false);
@@ -101,6 +103,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
setMenuOpen(false);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setMenuOpen(false);
};
const handleReposition = () => {
@@ -221,7 +224,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
data-chrome-floating="true"
data-collapsed={String(panel.collapsed)}
role="region"
- aria-label={`${activeMeta.title} Floating Panel`}
+ aria-label={t('{title} Floating Panel', { title: td(activeMeta.title) })}
onPointerDown={(e) => {
e.stopPropagation();
workspaceStoreActions.bringFloatingPanelToFront(panel.id);
@@ -263,8 +266,8 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
}}
title={
lockMove
- ? 'Position locked — Double-click to collapse/expand'
- : 'Drag to move or dock — Double-click to collapse/expand'
+ ? t('Position locked — Double-click to collapse/expand')
+ : t('Drag to move or dock — Double-click to collapse/expand')
}
className={`h-7 px-1.5 flex items-center justify-between gap-1 shrink-0 bg-ui-header ${
lockMove ? 'cursor-default' : 'cursor-grab active:cursor-grabbing'
@@ -290,8 +293,8 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
return false;
});
}}
- title="Panel Options"
- aria-label="Panel Options"
+ title={t('Panel Options')}
+ aria-label={t('Panel Options')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Menu className="w-3.5 h-3.5" />
@@ -321,8 +324,8 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
}}
title={
lockMove
- ? `${meta.title} (Position locked)`
- : `${meta.title} — Drag tab to split or dock`
+ ? t('{title} (Position locked)', { title: td(meta.title) })
+ : t('{title} — Drag tab to split or dock', { title: td(meta.title) })
}
className={`relative h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] shrink-0 transition-colors ${
lockMove ? 'cursor-pointer' : 'cursor-grab active:cursor-grabbing'
@@ -333,7 +336,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
}`}
>
{renderPanelIcon(pid, 'w-3 h-3 shrink-0')}
- <span className="truncate max-w-[72px]">{meta.shortTitle}</span>
+ <span className="truncate max-w-[72px]">{td(meta.shortTitle, 'panelShort')}</span>
{isActive && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -345,7 +348,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
<div className="flex-1 min-w-0 flex items-center justify-center gap-1.5 px-1 pointer-events-none">
{!isNarrow && renderPanelIcon(activePanelId, 'w-3 h-3 shrink-0 text-ui-icon-muted')}
<span className="text-[11px] font-medium text-ui-secondary truncate tracking-wide">
- {isNarrow ? activeMeta.shortTitle : activeMeta.title}
+ {isNarrow ? td(activeMeta.shortTitle, 'panelShort') : td(activeMeta.title)}
</span>
</div>
)}
@@ -360,8 +363,8 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
type="button"
data-testid={`floating-pin-btn-${activePanelId}`}
onClick={() => workspaceStoreActions.dockFloatingPanel(panel.id)}
- title="Reattach to Dock"
- aria-label={`Reattach ${activeMeta.title} to dock`}
+ title={t('Reattach to Dock')}
+ aria-label={t('Reattach {title} to dock', { title: td(activeMeta.title) })}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Pin className="w-3 h-3" />
@@ -371,8 +374,12 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
type="button"
data-testid={`floating-collapse-btn-${activePanelId}`}
onClick={() => workspaceStoreActions.toggleFloatingCollapsed(panel.id)}
- title={panel.collapsed ? 'Expand Panel' : 'Hide / Collapse Panel'}
- aria-label={panel.collapsed ? `Expand ${activeMeta.title}` : `Hide ${activeMeta.title}`}
+ title={panel.collapsed ? t('Expand Panel') : t('Hide / Collapse Panel')}
+ aria-label={
+ panel.collapsed
+ ? t('Expand {title}', { title: td(activeMeta.title) })
+ : t('Hide {title}', { title: td(activeMeta.title) })
+ }
aria-expanded={!panel.collapsed}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
panel.collapsed
@@ -386,8 +393,8 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
type="button"
data-testid={`floating-close-btn-${activePanelId}`}
onClick={() => workspaceStoreActions.closeFloatingPanel(panel.id)}
- title="Close Panel"
- aria-label={`Close ${activeMeta.title}`}
+ title={t('Close Panel')}
+ aria-label={t('Close {title}', { title: td(activeMeta.title) })}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3 h-3" />
@@ -409,7 +416,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
<div
data-testid={`floating-resize-right-${activePanelId}`}
onPointerDown={(e) => handleStartResize(e, 'right')}
- title={lockWidth ? 'Width locked' : 'Drag to resize width'}
+ title={lockWidth ? t('Width locked') : t('Drag to resize width')}
className={`absolute top-1 bottom-2 -right-[3px] w-[6px] z-20 ${
lockWidth ? 'cursor-default pointer-events-none' : 'cursor-ew-resize'
}`}
@@ -417,7 +424,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
<div
data-testid={`floating-resize-left-${activePanelId}`}
onPointerDown={(e) => handleStartResize(e, 'left')}
- title={lockWidth ? 'Width locked' : 'Drag to resize width'}
+ title={lockWidth ? t('Width locked') : t('Drag to resize width')}
className={`absolute top-1 bottom-2 -left-[3px] w-[6px] z-20 ${
lockWidth ? 'cursor-default pointer-events-none' : 'cursor-ew-resize'
}`}
@@ -427,7 +434,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
<div
data-testid={`floating-resize-bottom-${activePanelId}`}
onPointerDown={(e) => handleStartResize(e, 'bottom')}
- title={lockHeight ? 'Height locked' : 'Drag to resize height'}
+ title={lockHeight ? t('Height locked') : t('Drag to resize height')}
className={`absolute -bottom-[3px] left-2 right-2 h-[6px] z-20 ${
lockHeight ? 'cursor-default pointer-events-none' : 'cursor-ns-resize'
}`}
@@ -436,12 +443,12 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
onPointerDown={(e) => handleStartResize(e, 'bottom-left')}
title={
lockWidth && lockHeight
- ? 'Size locked'
+ ? t('Size locked')
: lockWidth
- ? 'Drag to resize height'
+ ? t('Drag to resize height')
: lockHeight
- ? 'Drag to resize width'
- : 'Drag to resize'
+ ? t('Drag to resize width')
+ : t('Drag to resize')
}
className={`absolute -bottom-[2px] -left-[2px] w-3 h-3 z-30 ${
lockWidth && lockHeight
@@ -457,12 +464,12 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
onPointerDown={(e) => handleStartResize(e, 'bottom-right')}
title={
lockWidth && lockHeight
- ? 'Size locked'
+ ? t('Size locked')
: lockWidth
- ? 'Drag to resize height'
+ ? t('Drag to resize height')
: lockHeight
- ? 'Drag to resize width'
- : 'Drag to resize'
+ ? t('Drag to resize width')
+ : t('Drag to resize')
}
className={`absolute bottom-0.5 right-0.5 w-3 h-3 transition-opacity z-30 ${
lockWidth && lockHeight
@@ -496,7 +503,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-48 rounded-ui-md shadow-ui-popover p-1 z-[1000] text-[11px] bg-ui-elevated border border-ui-default text-ui-primary"
>
<div className="px-2 py-0.5 text-[10px] text-ui-muted truncate">
- {activeMeta.title}
+ {td(activeMeta.title)}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -510,7 +517,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Pin className="w-3 h-3 text-ui-accent" />
- <span>Reattach to Dock</span>
+ <span>{t('Reattach to Dock')}</span>
</button>
<button
@@ -523,7 +530,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<ArrowLeftToLine className="w-3 h-3 text-ui-muted" />
- <span>Dock to Left</span>
+ <span>{t('Dock to Left')}</span>
</button>
<button
@@ -537,7 +544,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowRightToLine className="w-3 h-3 text-ui-muted" />
- <span>Dock to Right</span>
+ <span>{t('Dock to Right')}</span>
</button>
<button
@@ -551,7 +558,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowDownToLine className="w-3 h-3 text-ui-muted" />
- <span>Dock to Bottom</span>
+ <span>{t('Dock to Bottom')}</span>
</button>
<button
@@ -567,7 +574,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
) : (
<ChevronUp className="w-3 h-3 text-ui-muted" />
)}
- <span>{panel.collapsed ? 'Expand Panel' : 'Collapse Panel'}</span>
+ <span>{panel.collapsed ? t('Expand Panel') : t('Collapse Panel')}</span>
</button>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -581,7 +588,7 @@ export const FloatingPanelWindow: React.FC<FloatingPanelWindowProps> = React.mem
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<X className="w-3 h-3" />
- <span>Close Panel</span>
+ <span>{t('Close Panel')}</span>
</button>
</div>,
document.body
diff --git a/src/components/GlobalShortcutListener.tsx b/src/components/GlobalShortcutListener.tsx
index 8663bd5..6b80441 100644
--- a/src/components/GlobalShortcutListener.tsx
+++ b/src/components/GlobalShortcutListener.tsx
@@ -52,6 +52,7 @@ import {
workspaceStoreActions,
} from '../stores';
import { TextPlacementSession } from '../hooks/drawing/useShapeAndFillTools';
+import { isImeComposing, t, td } from '../i18n';
export interface GlobalShortcutListenerProps {
hasOpenDocument: boolean;
@@ -298,7 +299,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
if (!propsRef.current.textSession) {
const visible = workspaceStoreActions.toggleQuickBrushPanelVisible();
propsRef.current.showToast(
- visible ? 'Quick Brush Panel: Shown' : 'Quick Brush Panel: Hidden'
+ visible ? t('Quick Brush Panel: Shown') : t('Quick Brush Panel: Hidden')
);
}
},
@@ -315,7 +316,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
if (!propsRef.current.hasOpenDocument) return;
const enabled = documentStoreActions.toggleValueCheck();
propsRef.current.showToast(
- enabled ? 'Value Check (Live B/W): ON' : 'Value Check (Live B/W): OFF'
+ enabled ? t('Value Check (Live B/W): ON') : t('Value Check (Live B/W): OFF')
);
},
'view.navigatorValueMode': () => {
@@ -323,11 +324,11 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
const nextMode = workspaceStoreActions.cycleNavigatorPreviewMode();
const label =
nextMode === 'bw'
- ? 'Live B/W Tone'
+ ? t('Live B/W Tone')
: nextMode === 'split'
- ? 'Split View (Color | B/W)'
- : 'Color';
- propsRef.current.showToast(`Navigator Preview: ${label}`);
+ ? t('Split View (Color | B/W)')
+ : t('Color');
+ propsRef.current.showToast(t('Navigator Preview: {mode}', { mode: label }));
},
'anim.toggleTimeline': () => {
const p = propsRef.current;
@@ -515,18 +516,20 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
const p = propsRef.current;
if (!p.hasOpenDocument) return;
const next = documentStoreActions.toggleStraightRuler();
- p.showToast(next.enabled ? 'Straight Ruler: ON' : 'Straight Ruler: OFF');
+ p.showToast(next.enabled ? t('Straight Ruler: ON') : t('Straight Ruler: OFF'));
},
'view.perspectiveRuler': () => {
const p = propsRef.current;
documentStoreActions.setPerspectiveRuler((prev) => {
if (!prev) {
const next = createDefaultPerspectiveRuler('2-point', p.dimensions);
- p.showToast('2-Point Perspective Ruler added to canvas');
+ p.showToast(t('2-Point Perspective Ruler added to canvas'));
return next;
}
const next = { ...prev, enabled: !prev.enabled };
- p.showToast(next.enabled ? 'Perspective Ruler: Shown' : 'Perspective Ruler: Hidden');
+ p.showToast(
+ next.enabled ? t('Perspective Ruler: Shown') : t('Perspective Ruler: Hidden')
+ );
return next;
});
},
@@ -536,7 +539,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
if (!prev) return null;
const next = { ...prev, snapEnabled: !prev.snapEnabled };
p.showToast(
- next.snapEnabled ? 'Perspective Snapping: ON' : 'Perspective Snapping: OFF'
+ next.snapEnabled ? t('Perspective Snapping: ON') : t('Perspective Snapping: OFF')
);
return next;
});
@@ -550,27 +553,30 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
},
'tool.prevSubTool': () => {
const res = stepSubTool(-1, getCachedCustomBrushes());
- if (res) propsRef.current.showToast(`Sub Tool: ${res.name}`);
+ if (res) propsRef.current.showToast(t('Sub Tool: {name}', { name: td(res.name) }));
},
'tool.nextSubTool': () => {
const res = stepSubTool(1, getCachedCustomBrushes());
- if (res) propsRef.current.showToast(`Sub Tool: ${res.name}`);
+ if (res) propsRef.current.showToast(t('Sub Tool: {name}', { name: td(res.name) }));
},
'tool.prevTool': () => {
const res = stepMainTool(-1, propsRef.current.hasOpenDocument);
- propsRef.current.showToast(`Tool: ${res.label}`);
+ propsRef.current.showToast(t('Tool: {label}', { label: td(res.label) }));
},
'tool.nextTool': () => {
const res = stepMainTool(1, propsRef.current.hasOpenDocument);
- propsRef.current.showToast(`Tool: ${res.label}`);
+ propsRef.current.showToast(t('Tool: {label}', { label: td(res.label) }));
},
'tool.prevSubToolGroup': () => {
const res = stepSubToolGroup(-1, getCachedCustomBrushes());
if (res) {
propsRef.current.showToast(
res.activatedBrushName
- ? `Group: ${res.groupName} · ${res.activatedBrushName}`
- : `Group: ${res.groupName}`
+ ? t('Group: {group} · {brush}', {
+ group: td(res.groupName),
+ brush: td(res.activatedBrushName),
+ })
+ : t('Group: {group}', { group: td(res.groupName) })
);
}
},
@@ -579,8 +585,11 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
if (res) {
propsRef.current.showToast(
res.activatedBrushName
- ? `Group: ${res.groupName} · ${res.activatedBrushName}`
- : `Group: ${res.groupName}`
+ ? t('Group: {group} · {brush}', {
+ group: td(res.groupName),
+ brush: td(res.activatedBrushName),
+ })
+ : t('Group: {group}', { group: td(res.groupName) })
);
}
},
@@ -591,7 +600,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
'color.transparent': () => {
const next = toolStoreActions.toggleTransparentColor();
propsRef.current.showToast(
- next ? 'Transparent ink mode active' : 'Color ink mode active'
+ next ? t('Transparent ink mode active') : t('Color ink mode active')
);
},
});
@@ -670,7 +679,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
);
if (activated) {
const res = activateSubToolPreset(matched.subToolPresetId, getCachedCustomBrushes());
- if (res) p.showToast(`Sub Tool: ${res.name}`);
+ if (res) p.showToast(t('Sub Tool: {name}', { name: td(res.name) }));
}
return true;
}
@@ -684,8 +693,11 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
if (res) {
p.showToast(
res.activatedBrushName
- ? `Group: ${res.groupName} · ${res.activatedBrushName}`
- : `Group: ${res.groupName}`
+ ? t('Group: {group} · {brush}', {
+ group: td(res.groupName),
+ brush: td(res.activatedBrushName),
+ })
+ : t('Group: {group}', { group: td(res.groupName) })
);
}
return true;
@@ -717,6 +729,9 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
};
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) {
+ return;
+ }
const p = propsRef.current;
const uiState = useUiStore.getState();
const isModalOpen = selectIsAnyModalOpen(uiState, p.isHostModalOpen) || uiState.isLoadingFile;
@@ -858,9 +873,23 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
}
};
- const handlePointerDownMarkUsed = () => {
+ const handlePointerDownMarkUsed = (e: PointerEvent) => {
springControllerRef.current.markUsedWhileHeld();
subToolSpringControllerRef.current.markUsedWhileHeld();
+
+ // Self-heal stuck temporary modifier tool holds (e.g., Windows/WebView2 swallowed Alt keyup):
+ // if the modifier key is no longer physically pressed when the user clicks/touches down,
+ // restore the previous tool immediately in capture phase before canvas handlers dispatch.
+ const mod = activeModHoldRef.current;
+ if (mod) {
+ const stillHeld =
+ (mod.modKey === 'Alt' && e.altKey) ||
+ (mod.modKey === 'Control' && e.ctrlKey) ||
+ (mod.modKey === 'Shift' && e.shiftKey);
+ if (!stillHeld) {
+ clearModHold();
+ }
+ }
};
const handleWindowBlur = () => {
@@ -877,6 +906,12 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
clearModHold();
};
+ const handleVisibilityChange = () => {
+ if (typeof document !== 'undefined' && document.hidden) {
+ handleWindowBlur();
+ }
+ };
+
// Subscribe to native Windows OS-key (Win-key) hotkeys delivered by Tauri backend
const unsubNativeOsHotkeys = subscribeNativeOsHotkeys((ev) => {
if (ev.isRecording) return;
@@ -903,15 +938,17 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
});
window.addEventListener('keydown', handleKeyDown);
- window.addEventListener('keyup', handleKeyUp);
+ window.addEventListener('keyup', handleKeyUp, true);
window.addEventListener('pointerdown', handlePointerDownMarkUsed, true);
window.addEventListener('blur', handleWindowBlur);
+ document.addEventListener('visibilitychange', handleVisibilityChange);
return () => {
unsubNativeOsHotkeys();
window.removeEventListener('keydown', handleKeyDown);
- window.removeEventListener('keyup', handleKeyUp);
+ window.removeEventListener('keyup', handleKeyUp, true);
window.removeEventListener('pointerdown', handlePointerDownMarkUsed, true);
window.removeEventListener('blur', handleWindowBlur);
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
};
}, []);
@@ -928,12 +965,15 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
const file = e.dataTransfer.files[0];
if (isSupportedBrushFileName(file.name)) {
try {
- uiStoreActions.setLoading(true, `Importing Brush: ${file.name}...`);
+ uiStoreActions.setLoading(
+ true,
+ t('Importing Brush: {fileName}...', { fileName: file.name })
+ );
const parsedBrush = await importBrushFile(file);
- p.showToast(`Imported brush "${parsedBrush.name}"`);
+ p.showToast(t('Imported brush "{name}"', { name: parsedBrush.name }));
} catch (err: unknown) {
console.error('Failed to import brush:', err);
- const msg = err instanceof Error ? err.message : 'Failed to import brush file.';
+ const msg = err instanceof Error ? err.message : t('Failed to import brush file.');
p.showToast(msg);
} finally {
uiStoreActions.setLoading(false, '');
diff --git a/src/components/GradientOverlay.tsx b/src/components/GradientOverlay.tsx
index bd274ed..8bf0c91 100644
--- a/src/components/GradientOverlay.tsx
+++ b/src/components/GradientOverlay.tsx
@@ -11,6 +11,7 @@ import {
getSelectedMeshNodeIndices,
rasterizeMeshGradientToRgba,
} from '../utils/gradientEngine';
+import { useI18n } from '../i18n';
export interface GradientOverlayProps {
dimensions: CanvasDimensions;
@@ -44,6 +45,7 @@ export const GradientOverlay: React.FC<GradientOverlayProps> = React.memo(
onCancelMesh,
onStartRotateMesh,
}) => {
+ const { t } = useI18n();
const previewCanvasRef = useRef<HTMLCanvasElement | null>(null);
const invZoom = 1 / Math.max(0.05, zoom);
@@ -309,7 +311,7 @@ export const GradientOverlay: React.FC<GradientOverlayProps> = React.memo(
{mesh.nodes.length > 0 && onStartRotateMesh && (
<button
type="button"
- title="Drag to rotate all mesh vertices (Shift: 15° snap)"
+ title={t('Drag to rotate all mesh vertices (Shift: 15° snap)')}
onPointerDown={(e) => {
e.stopPropagation();
onStartRotateMesh(e);
@@ -362,8 +364,10 @@ export const GradientOverlay: React.FC<GradientOverlayProps> = React.memo(
}}
>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted px-1 whitespace-nowrap">
- Mesh ({mesh.cols}×{mesh.rows})
- {selectedIndices.length > 0 ? ` · ${selectedIndices.length} sel` : ''}
+ {t('Mesh ({cols}×{rows})', { cols: mesh.cols, rows: mesh.rows })}
+ {selectedIndices.length > 0
+ ? t(' · {count} sel', { count: selectedIndices.length })
+ : ''}
{rotationDeg !== 0 ? ` · ${rotationDeg}°` : ''}
</span>
<button
@@ -371,14 +375,14 @@ export const GradientOverlay: React.FC<GradientOverlayProps> = React.memo(
onClick={onApplyMesh}
className="px-2 py-0.5 rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[10px] font-medium transition-opacity cursor-pointer"
>
- Apply
+ {t('Apply')}
</button>
<button
type="button"
onClick={onCancelMesh}
className="px-2 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</div>
)}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 4015ea7..705d42c 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -25,6 +25,7 @@ import { formatRotationDegrees } from '../utils/canvasUtils';
import { MenuBar } from './MenuBar';
import { WindowControls } from './WindowControls';
import { CommandBar, WorkspaceCommandHandlers } from './CommandBar';
+import { useI18n } from '../i18n';
export interface HeaderProps {
canUndo: boolean;
@@ -106,6 +107,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
appView = 'workspace',
onSelectAppView,
}) => {
+ const { t } = useI18n();
const isRotated = Math.abs(rotation % 360) > 0.05;
const resolvedHandlers = useMemo<WorkspaceCommandHandlers>(
@@ -165,7 +167,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<div
role="tablist"
- aria-label="App View"
+ aria-label={t('App View')}
data-testid="header-view-switcher"
className="h-6 p-0.5 rounded-ui-sm bg-ui-input border border-ui-subtle flex items-center gap-0.5 shrink-0"
>
@@ -175,14 +177,14 @@ export const Header: React.FC<HeaderProps> = React.memo(({
aria-selected={appView === 'home'}
data-testid="header-view-home"
onClick={() => onSelectAppView?.('home')}
- title="Home & Recent Documents"
+ title={t('Home & Recent Documents')}
className={`h-full px-2 rounded-ui-xs text-[10.5px] leading-none flex items-center transition-colors cursor-pointer ${
appView === 'home'
? 'bg-ui-control-active text-ui-primary font-medium'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Home
+ {t('Home')}
</button>
<button
type="button"
@@ -190,14 +192,14 @@ export const Header: React.FC<HeaderProps> = React.memo(({
aria-selected={appView === 'workspace'}
data-testid="header-view-workspace"
onClick={() => onSelectAppView?.('workspace')}
- title="Drawing Workspace"
+ title={t('Drawing Workspace')}
className={`h-full px-2 rounded-ui-xs text-[10.5px] leading-none flex items-center transition-colors cursor-pointer ${
appView === 'workspace'
? 'bg-ui-control-active text-ui-primary font-medium'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Workspace
+ {t('Workspace')}
</button>
</div>
@@ -218,7 +220,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
>
{hasOpenDocument && colorMode !== 'color' && (
<span className="text-[10px] font-ui-mono uppercase px-1.5 py-0.5 rounded-ui-xs bg-ui-input border border-ui-subtle text-ui-muted">
- {colorMode === 'monochrome' ? '1-bit' : 'Gray'}
+ {colorMode === 'monochrome' ? t('1-bit') : t('Gray')}
</span>
)}
@@ -233,11 +235,11 @@ export const Header: React.FC<HeaderProps> = React.memo(({
type="button"
onClick={onToggleValueCheck}
data-testid="header-value-check-badge"
- title="Live 1-Click Value Check (B/W Tone Check) is active — display only, layer colors unchanged. Click or press Shift+Y to return to Color."
+ title={t('Live 1-Click Value Check (B/W Tone Check) is active — display only, layer colors unchanged. Click or press Shift+Y to return to Color.')}
className="h-6 px-1.5 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover text-[10px] font-ui-mono uppercase text-ui-accent border border-ui-accent-border flex items-center gap-1 transition-colors cursor-pointer"
>
<Contrast className="w-3 h-3" />
- <span>Value B/W</span>
+ <span>{t('Value B/W')}</span>
</button>
)}
@@ -246,11 +248,11 @@ export const Header: React.FC<HeaderProps> = React.memo(({
type="button"
onClick={onResetViewFlip}
data-testid="view-flip-badge"
- title="Non-destructive View Mirror active (display only — layer pixels unchanged). Click to reset view flip."
+ title={t('Non-destructive View Mirror active (display only — layer pixels unchanged). Click to reset view flip.')}
className="h-6 px-1.5 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover text-[10px] font-ui-mono uppercase text-ui-accent border border-ui-accent-border flex items-center gap-1 transition-colors cursor-pointer"
>
<span>
- {flipX && flipY ? 'View Flip H+V' : flipX ? 'View Flip H' : 'View Flip V'}
+ {flipX && flipY ? t('View Flip H+V') : flipX ? t('View Flip H') : t('View Flip V')}
</span>
</button>
)}
@@ -259,7 +261,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onResetRotation}
- title="Reset Canvas Rotation (Ctrl+Alt+0)"
+ title={t('Reset Canvas Rotation (Ctrl+Alt+0)')}
className="h-6 px-1.5 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[11px] font-ui-mono tabular-nums text-ui-muted hover:text-ui-primary flex items-center gap-1 transition-colors cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
@@ -276,7 +278,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onZoomOut}
- title="Zoom Out (Ctrl+-)"
+ title={t('Zoom Out (Ctrl+-)')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Minus className="w-3 h-3" />
@@ -284,7 +286,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={() => onResetZoom()}
- title="Reset Zoom & Center (Ctrl+0)"
+ title={t('Reset Zoom & Center (Ctrl+0)')}
className="h-5 px-1.5 rounded-ui-xs font-ui-mono tabular-nums text-[11px] text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer min-w-[42px] text-center"
>
{formatZoomPercent(zoom)}
@@ -292,7 +294,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onZoomIn}
- title="Zoom In (Ctrl++)"
+ title={t('Zoom In (Ctrl++)')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Plus className="w-3 h-3" />
@@ -311,9 +313,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
type="button"
data-testid="header-value-check-btn"
onClick={onToggleValueCheck}
- aria-label="1-Click Value Check (Live B/W)"
+ aria-label={t('1-Click Value Check (Live B/W)')}
aria-pressed={valueCheckEnabled}
- title="1-Click Value Check (Shift+Y) — Live B/W Tone Check (non-destructive)"
+ title={t('1-Click Value Check (Shift+Y) — Live B/W Tone Check (non-destructive)')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
valueCheckEnabled
? 'bg-ui-control-active text-ui-accent'
@@ -327,9 +329,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onToggleFlipHorizontal}
- aria-label="Flip View Horizontal"
+ aria-label={t('Flip View Horizontal')}
aria-pressed={flipX}
- title="Flip View Horizontal (Shift+H) — non-destructive view mirror"
+ title={t('Flip View Horizontal (Shift+H) — non-destructive view mirror')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
flipX
? 'bg-ui-control-active text-ui-accent'
@@ -343,9 +345,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onToggleFlipVertical}
- aria-label="Flip View Vertical"
+ aria-label={t('Flip View Vertical')}
aria-pressed={flipY}
- title="Flip View Vertical (Shift+V) — non-destructive view mirror"
+ title={t('Flip View Vertical (Shift+V) — non-destructive view mirror')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
flipY
? 'bg-ui-control-active text-ui-accent'
@@ -365,10 +367,10 @@ export const Header: React.FC<HeaderProps> = React.memo(({
onClick={onOpenCollabModal}
title={
isCollabReconnecting
- ? 'Collab: Reconnecting...'
+ ? t('Collab: Reconnecting...')
: isCollabConnected
- ? `Collab (${collabPeerCount} online)`
- : 'Collaborative Session'
+ ? t('Collab ({count} online)', { count: collabPeerCount })
+ : t('Collaborative Session')
}
className={`h-6 px-1.5 rounded-ui-sm flex items-center gap-1 text-[11px] transition-colors cursor-pointer ${
isCollabReconnecting
@@ -393,9 +395,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
type="button"
data-testid="header-focus-mode-btn"
onClick={onToggleFocusMode}
- aria-label={isFocusMode ? 'Exit Focus Mode (Tab)' : 'Enter Focus Mode (Tab)'}
+ aria-label={isFocusMode ? t('Exit Focus Mode (Tab)') : t('Enter Focus Mode (Tab)')}
aria-pressed={isFocusMode}
- title={isFocusMode ? 'Exit Focus Mode (Tab)' : 'Focus Mode — Hide Palettes (Tab)'}
+ title={isFocusMode ? t('Exit Focus Mode (Tab)') : t('Focus Mode — Hide Palettes (Tab)')}
className={`w-6 h-6 rounded-ui-sm flex items-center justify-center transition-colors cursor-pointer ${
isFocusMode
? 'bg-ui-control-active text-ui-accent border border-ui-accent-border'
@@ -416,9 +418,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
type="button"
data-testid="header-appearance-btn"
onClick={onToggleAppearanceStudio}
- aria-label="Live Appearance Studio"
+ aria-label={t('Live Appearance Studio')}
aria-pressed={isAppearanceStudioOpen}
- title="Live Appearance Studio"
+ title={t('Live Appearance Studio')}
className={`w-6 h-6 rounded-ui-sm flex items-center justify-center transition-colors cursor-pointer ${
isAppearanceStudioOpen
? 'bg-ui-control-active text-ui-accent border border-ui-accent-border'
@@ -434,7 +436,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<button
type="button"
onClick={onOpenSettings}
- title="Preferences (Ctrl+,)"
+ title={t('Preferences (Ctrl+,)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Settings className="w-3.5 h-3.5" />
diff --git a/src/components/HostModal.tsx b/src/components/HostModal.tsx
index 76ec1cd..1a32f57 100644
--- a/src/components/HostModal.tsx
+++ b/src/components/HostModal.tsx
@@ -29,6 +29,7 @@ import {
Paintbrush,
} from 'lucide-react';
import { peerIdEquals } from '../utils/collabPermissions';
+import { isImeComposing, t as translateStatic, useI18n } from '../i18n';
interface HostModalProps {
isOpen: boolean;
@@ -76,7 +77,9 @@ interface HostModalProps {
function defaultStudioName(name: string): string {
const clean = (name || '').trim();
- return clean ? `${clean}'s Studio` : 'Ink Studio Session';
+ return clean
+ ? translateStatic("{name}'s Studio", { name: clean })
+ : translateStatic('Ink Studio Session');
}
export const HostModal: React.FC<HostModalProps> = ({
@@ -107,6 +110,7 @@ export const HostModal: React.FC<HostModalProps> = ({
onGrabPeerBrush,
showToast,
}) => {
+ const { t, td } = useI18n();
const [activeTab, setActiveTab] = useState<'host' | 'join'>('host');
const [nickname, setNickname] = useState(myPeer.name || 'Artist');
const [roomName, setRoomName] = useState(() => defaultStudioName(myPeer.name));
@@ -157,6 +161,7 @@ export const HostModal: React.FC<HostModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -169,15 +174,21 @@ export const HostModal: React.FC<HostModalProps> = ({
if (!isOpen) return null;
+ const formatRoleLabel = (role?: string, isPeerHost?: boolean): string => {
+ if (isPeerHost || role === 'host') return t('Host');
+ if (role === 'viewer') return t('Viewer');
+ return t('Editor');
+ };
+
const handleCopyLink = async () => {
if (!hostInfo?.inviteUrl) return;
try {
await navigator.clipboard.writeText(hostInfo.inviteUrl);
setCopied(true);
- showToast('Invite link copied.');
+ showToast(t('Invite link copied.'));
setTimeout(() => setCopied(false), 2000);
} catch {
- showToast('Failed to copy to clipboard.');
+ showToast(t('Failed to copy to clipboard.'));
}
};
@@ -187,10 +198,10 @@ export const HostModal: React.FC<HostModalProps> = ({
try {
await navigator.clipboard.writeText(code);
setCopiedCode(true);
- showToast('Room code copied.');
+ showToast(t('Room code copied.'));
setTimeout(() => setCopiedCode(false), 2000);
} catch {
- showToast('Failed to copy to clipboard.');
+ showToast(t('Failed to copy to clipboard.'));
}
};
@@ -199,10 +210,10 @@ export const HostModal: React.FC<HostModalProps> = ({
try {
await navigator.clipboard.writeText(hostInfo.localInviteUrl);
setCopiedLocal(true);
- showToast('Local LAN link copied.');
+ showToast(t('Local LAN link copied.'));
setTimeout(() => setCopiedLocal(false), 2000);
} catch {
- showToast('Failed to copy to clipboard.');
+ showToast(t('Failed to copy to clipboard.'));
}
};
@@ -212,10 +223,10 @@ export const HostModal: React.FC<HostModalProps> = ({
setStartError(null);
setStartStatus(
mode === 'p2p'
- ? 'Opening Quick P2P Room...'
+ ? t('Opening Quick P2P Room...')
: mode === 'tunnel'
- ? 'Starting Worldwide Tunnel...'
- : 'Starting Local Server...'
+ ? t('Starting Worldwide Tunnel...')
+ : t('Starting Local Server...')
);
try {
const resolvedName = nickname.trim() || myPeer.name || 'Artist';
@@ -225,7 +236,7 @@ export const HostModal: React.FC<HostModalProps> = ({
const resolvedRoom = roomName.trim() || defaultStudioName(resolvedName);
if (mode === 'p2p') {
if (!onStartWebRtcHosting) {
- throw new Error('Quick P2P hosting is unavailable in this context.');
+ throw new Error(t('Quick P2P hosting is unavailable in this context.'));
}
await onStartWebRtcHosting(resolvedRoom, resolvedName, (status) => {
setStartStatus(status);
@@ -236,7 +247,7 @@ export const HostModal: React.FC<HostModalProps> = ({
});
}
} catch (err: any) {
- const msg = err?.message || (typeof err === 'string' ? err : 'Failed to start server');
+ const msg = err?.message || (typeof err === 'string' ? err : t('Failed to start server'));
setStartError(msg);
} finally {
setIsStarting(false);
@@ -248,7 +259,7 @@ export const HostModal: React.FC<HostModalProps> = ({
e.preventDefault();
const trimmedUrl = joinUrl.trim();
if (!trimmedUrl) {
- showToast('Enter a room code (INK-XXXX) or invite link first.');
+ showToast(t('Enter a room code (INK-XXXX) or invite link first.'));
return;
}
setIsJoining(true);
@@ -292,24 +303,26 @@ export const HostModal: React.FC<HostModalProps> = ({
<Users className="w-4 h-4 text-ui-accent shrink-0" />
<div className="min-w-0">
<h3 id="host-modal-title" className="text-xs font-medium text-ui-primary leading-tight">
- Collaborative Drawing
+ {t('Collaborative Drawing')}
</h3>
<p className="text-[10px] text-ui-muted truncate tabular-nums">
{connectionStatus === 'reconnecting'
- ? `Reconnecting (attempt ${reconnectAttempt || 1})...`
+ ? t('Reconnecting (attempt {count})...', { count: reconnectAttempt || 1 })
: isConnected
? isHost
- ? 'Hosting active session'
- : `Connected as ${myRole === 'viewer' ? 'Viewer (Read-Only)' : 'Editor'}`
- : 'Host or join a live canvas session'}
+ ? t('Hosting active session')
+ : t('Connected as {role}', {
+ role: myRole === 'viewer' ? t('Viewer (Read-Only)') : t('Editor'),
+ })
+ : t('Host or join a live canvas session')}
</p>
</div>
</div>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:bg-ui-control-hover hover:text-ui-primary transition-colors cursor-pointer shrink-0"
>
<X className="w-3.5 h-3.5" />
@@ -324,14 +337,16 @@ export const HostModal: React.FC<HostModalProps> = ({
<RefreshCw className="w-4 h-4 text-ui-warning shrink-0 mt-0.5 animate-spin" />
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-ui-warning">
- Reconnecting to Session...
+ {t('Reconnecting to Session...')}
</div>
<div className="text-[11px] text-ui-secondary mt-0.5 truncate tabular-nums">
- Room: <span className="text-ui-primary font-medium">{hostInfo?.roomName || 'Studio'}</span>{' '}
- (attempt {reconnectAttempt || 1})
+ {t('Room: {room} (attempt {count})', {
+ room: hostInfo?.roomName || t('Studio'),
+ count: reconnectAttempt || 1,
+ })}
</div>
<div className="text-[10px] text-ui-muted mt-1">
- Session state is preserved. Missed tiles and layer updates will catch up automatically.
+ {t('Session state is preserved. Missed tiles and layer updates will catch up automatically.')}
</div>
</div>
</div>
@@ -348,7 +363,7 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-full flex items-center justify-center gap-2 rounded-ui-sm border border-ui-danger/35 bg-ui-danger/15 hover:bg-ui-danger/25 py-2 text-xs font-medium text-ui-danger transition-colors cursor-pointer"
>
<LogOut className="w-3.5 h-3.5" />
- <span>{isHost ? 'Stop Session' : 'Cancel & Leave'}</span>
+ <span>{isHost ? t('Stop Session') : t('Cancel & Leave')}</span>
</button>
</div>
) : isConnected && isHost ? (
@@ -359,12 +374,13 @@ export const HostModal: React.FC<HostModalProps> = ({
<Radio className="w-4 h-4 text-ui-success shrink-0 mt-0.5" />
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-ui-success">
- Quick P2P Room Active (WebRTC)
+ {t('Quick P2P Room Active (WebRTC)')}
</div>
<div className="text-[11px] text-ui-secondary mt-0.5 tabular-nums">
- Room: <span className="text-ui-primary font-medium">{hostInfo?.roomName}</span>{' '}
- — Android tablets &amp; PCs can join worldwide with the short code below (up to{' '}
- {MAX_WEBRTC_PEERS} guests).
+ {t(
+ 'Room: {room} — Android tablets & PCs can join worldwide with the short code below (up to {max} guests).',
+ { room: hostInfo?.roomName || '', max: MAX_WEBRTC_PEERS }
+ )}
</div>
</div>
</div>
@@ -373,11 +389,13 @@ export const HostModal: React.FC<HostModalProps> = ({
<Globe className="w-4 h-4 text-ui-accent shrink-0 mt-0.5" />
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-ui-primary">
- Worldwide Cloudflare Tunnel Active
+ {t('Worldwide Cloudflare Tunnel Active')}
</div>
<div className="text-[11px] text-ui-muted mt-0.5">
- Room: <span className="text-ui-primary font-medium">{hostInfo?.roomName}</span> —
- anyone on any network can join via link in browser or desktop app.
+ {t(
+ 'Room: {room} — anyone on any network can join via link in browser or desktop app.',
+ { room: hostInfo?.roomName || '' }
+ )}
</div>
</div>
</div>
@@ -386,11 +404,13 @@ export const HostModal: React.FC<HostModalProps> = ({
<Wifi className="w-4 h-4 text-ui-success shrink-0 mt-0.5" />
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-ui-success">
- Local Wi-Fi Server Active
+ {t('Local Wi-Fi Server Active')}
</div>
<div className="text-[11px] text-ui-secondary mt-0.5 tabular-nums">
- Room: <span className="text-ui-primary font-medium">{hostInfo?.roomName}</span>{' '}
- (port {hostInfo?.port})
+ {t('Room: {room} (port {port})', {
+ room: hostInfo?.roomName || '',
+ port: hostInfo?.port ?? 30303,
+ })}
</div>
</div>
</div>
@@ -401,7 +421,7 @@ export const HostModal: React.FC<HostModalProps> = ({
<div className="space-y-3">
<div>
<label className="text-[11px] font-medium text-ui-muted mb-1.5 flex items-center justify-between">
- <span>Quick P2P Room Code (Android &amp; Desktop)</span>
+ <span>{t('Quick P2P Room Code (Android & Desktop)')}</span>
<span className="text-[10px] text-ui-success font-ui-mono flex items-center gap-1">
<span className="w-1.5 h-1.5 rounded-full bg-ui-success animate-pulse" />
<span>WEBRTC P2P</span>
@@ -425,7 +445,7 @@ export const HostModal: React.FC<HostModalProps> = ({
) : (
<Copy className="w-3.5 h-3.5" />
)}
- <span>{copiedCode ? 'Copied' : 'Copy Code'}</span>
+ <span>{copiedCode ? t('Copied') : t('Copy Code')}</span>
</button>
</div>
</div>
@@ -433,22 +453,20 @@ export const HostModal: React.FC<HostModalProps> = ({
{hostInfo?.inviteUrl && (
<div className="pt-2 border-t border-ui-subtle flex items-center justify-between text-[10px] text-ui-muted">
<span className="truncate">
- Invite Link:{' '}
- <span className="font-ui-mono text-ui-secondary">{hostInfo.inviteUrl}</span>
+ {t('Invite Link: {url}', { url: hostInfo.inviteUrl })}
</span>
<button
type="button"
onClick={handleCopyLink}
className="text-ui-secondary hover:text-ui-primary underline cursor-pointer ml-2 shrink-0"
>
- {copied ? 'Copied' : 'Copy Link'}
+ {copied ? t('Copied') : t('Copy Link')}
</button>
</div>
)}
<p className="text-[10px] text-ui-muted leading-relaxed">
- Share this Room Code with Android tablet or desktop users — no cloudflared
- required. Keep this app open while hosting.
+ {t('Share this Room Code with Android tablet or desktop users — no cloudflared required. Keep this app open while hosting.')}
</p>
</div>
) : (
@@ -456,8 +474,8 @@ export const HostModal: React.FC<HostModalProps> = ({
<label className="text-[11px] font-medium text-ui-muted mb-1.5 flex items-center justify-between">
<span>
{hostInfo?.isGlobal
- ? 'Worldwide Invite Link (Browser or Desktop App)'
- : 'Local Wi-Fi Invite Link'}
+ ? t('Worldwide Invite Link (Browser or Desktop App)')
+ : t('Local Wi-Fi Invite Link')}
</span>
{hostInfo?.isGlobal && (
<span className="text-[10px] text-ui-accent font-ui-mono flex items-center gap-1">
@@ -479,29 +497,27 @@ export const HostModal: React.FC<HostModalProps> = ({
className="flex items-center gap-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 px-3 py-1.5 text-xs font-medium transition-opacity shrink-0 cursor-pointer"
>
{copied ? <Check className="w-3.5 h-3.5" /> : <Copy className="w-3.5 h-3.5" />}
- <span>{copied ? 'Copied' : 'Copy'}</span>
+ <span>{copied ? t('Copied') : t('Copy')}</span>
</button>
</div>
{hostInfo?.isGlobal && hostInfo.localInviteUrl && (
<div className="mt-2 pt-2 border-t border-ui-subtle flex items-center justify-between text-[10px] text-ui-muted">
<span className="truncate">
- Local LAN:{' '}
- <span className="font-ui-mono text-ui-secondary">{hostInfo.localInviteUrl}</span>
+ {t('Local LAN: {url}', { url: hostInfo.localInviteUrl })}
</span>
<button
type="button"
onClick={handleCopyLocalLink}
className="text-ui-secondary hover:text-ui-primary underline cursor-pointer ml-2 shrink-0"
>
- {copiedLocal ? 'Copied' : 'Copy Local'}
+ {copiedLocal ? t('Copied') : t('Copy Local')}
</button>
</div>
)}
<p className="text-[10px] text-ui-muted mt-1.5 leading-relaxed">
- Share this link to open directly in a browser or paste it into the Join tab in the
- desktop app.
+ {t('Share this link to open directly in a browser or paste it into the Join tab in the desktop app.')}
</p>
</div>
)}
@@ -509,7 +525,7 @@ export const HostModal: React.FC<HostModalProps> = ({
{/* Connected Peers List */}
<div>
<div className="text-[11px] font-medium text-ui-muted mb-1.5 flex items-center justify-between tabular-nums">
- <span>Participants on Canvas ({peers.length + 1})</span>
+ <span>{t('Participants on Canvas ({count})', { count: peers.length + 1 })}</span>
</div>
<div className="rounded-ui-md border border-ui-subtle bg-ui-header max-h-36 overflow-y-auto divide-y divide-ui-subtle">
<div className="flex items-center justify-between px-3 py-2 text-xs">
@@ -518,10 +534,12 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-2.5 h-2.5 rounded-full shrink-0"
style={{ backgroundColor: myPeer.color }}
/>
- <span className="font-medium text-ui-primary">{myPeer.name} (You)</span>
+ <span className="font-medium text-ui-primary">
+ {t('{name} (You)', { name: myPeer.name })}
+ </span>
</div>
<span className="text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-warning/15 text-ui-warning">
- Host
+ {t('Host')}
</span>
</div>
@@ -548,8 +566,8 @@ export const HostModal: React.FC<HostModalProps> = ({
}}
title={
isFollowing
- ? `Stop following ${peer.name}'s camera`
- : `Follow ${peer.name}'s camera`
+ ? t("Stop following {name}'s camera", { name: peer.name })
+ : t("Follow {name}'s camera", { name: peer.name })
}
className="flex items-center gap-2 min-w-0 flex-1 text-left rounded-ui-xs py-0.5 px-1 -ml-1 hover:bg-ui-control-hover/60 transition-colors cursor-pointer"
>
@@ -566,7 +584,7 @@ export const HostModal: React.FC<HostModalProps> = ({
</div>
{peer.activeBrushName && (
<div className="text-[10px] text-ui-muted truncate">
- {peer.activeBrushName}
+ {td(peer.activeBrushName)}
</div>
)}
</div>
@@ -578,8 +596,8 @@ export const HostModal: React.FC<HostModalProps> = ({
data-testid={`host-modal-grab-brush-${peer.id}`}
onClick={() => onGrabPeerBrush(peer.id)}
disabled={isGrabbing}
- title={`Try ${peer.name}'s Brush`}
- aria-label={`Try ${peer.name}'s Brush`}
+ title={t("Try {name}'s Brush", { name: peer.name })}
+ aria-label={t("Try {name}'s Brush", { name: peer.name })}
className="flex items-center gap-1 rounded-ui-xs border border-ui-default bg-ui-control hover:bg-ui-control-hover hover:border-ui-accent-border disabled:opacity-50 px-1.5 py-0.5 text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
{isGrabbing ? (
@@ -587,12 +605,12 @@ export const HostModal: React.FC<HostModalProps> = ({
) : (
<Paintbrush className="w-3 h-3 text-ui-accent" />
)}
- <span>Try Brush</span>
+ <span>{t('Try Brush')}</span>
</button>
)}
{onSetPeerRole ? (
<select
- aria-label={`Role for ${peer.name}`}
+ aria-label={t('Role for {name}', { name: peer.name })}
value={peerRole}
onChange={(e) =>
onSetPeerRole(
@@ -602,19 +620,19 @@ export const HostModal: React.FC<HostModalProps> = ({
}
className="rounded-ui-xs border border-ui-default bg-ui-input px-1.5 py-0.5 text-[10px] text-ui-primary focus:outline-hidden cursor-pointer"
>
- <option value="editor">Editor</option>
- <option value="viewer">Viewer</option>
+ <option value="editor">{t('Editor')}</option>
+ <option value="viewer">{t('Viewer')}</option>
</select>
) : (
- <span className="text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-control text-ui-muted capitalize">
- {peerRole}
+ <span className="text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-control text-ui-muted">
+ {formatRoleLabel(peerRole)}
</span>
)}
{onKickPeer && (
<button
type="button"
onClick={() => onKickPeer(peer.id)}
- title={`Kick ${peer.name}`}
+ title={t('Kick {name}', { name: peer.name })}
className="p-1 rounded-ui-xs text-ui-muted hover:text-ui-warning hover:bg-ui-warning/15 transition-colors cursor-pointer"
>
<UserX className="w-3.5 h-3.5" />
@@ -624,7 +642,7 @@ export const HostModal: React.FC<HostModalProps> = ({
<button
type="button"
onClick={() => onBanPeer(peer.id)}
- title={`Ban ${peer.name}`}
+ title={t('Ban {name}', { name: peer.name })}
className="p-1 rounded-ui-xs text-ui-muted hover:text-ui-danger hover:bg-ui-danger/15 transition-colors cursor-pointer"
>
<Ban className="w-3.5 h-3.5" />
@@ -640,7 +658,7 @@ export const HostModal: React.FC<HostModalProps> = ({
{bannedPeerIds.length > 0 && (
<div>
<div className="text-[11px] font-medium text-ui-muted mb-1.5 tabular-nums">
- Banned Peers ({bannedPeerIds.length})
+ {t('Banned Peers ({count})', { count: bannedPeerIds.length })}
</div>
<div className="rounded-ui-md border border-ui-subtle bg-ui-header max-h-24 overflow-y-auto divide-y divide-ui-subtle">
{bannedPeerIds.map((pid) => (
@@ -655,7 +673,7 @@ export const HostModal: React.FC<HostModalProps> = ({
onClick={() => onUnbanPeer(pid)}
className="text-[10px] text-ui-accent hover:underline ml-2 shrink-0 cursor-pointer"
>
- Unban
+ {t('Unban')}
</button>
)}
</div>
@@ -675,7 +693,7 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-full flex items-center justify-center gap-2 rounded-ui-sm border border-ui-danger/35 bg-ui-danger/15 hover:bg-ui-danger/25 py-2 text-xs font-medium text-ui-danger transition-colors cursor-pointer"
>
<Power className="w-3.5 h-3.5" />
- <span>Stop Collaborative Session</span>
+ <span>{t('Stop Collaborative Session')}</span>
</button>
</div>
</div>
@@ -690,17 +708,14 @@ export const HostModal: React.FC<HostModalProps> = ({
)}
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-ui-primary">
- {isP2pSession ? 'Connected via WebRTC P2P' : 'Connected to Session'}
+ {isP2pSession ? t('Connected via WebRTC P2P') : t('Connected to Session')}
</div>
<div className="text-[11px] text-ui-muted mt-0.5 truncate">
- Room:{' '}
- <span className="text-ui-primary font-medium">
- {hostInfo?.roomName || 'Studio'}
- </span>
+ {t('Room: {room}', { room: hostInfo?.roomName || t('Studio') })}
</div>
{isP2pSession && hostInfo?.roomCode ? (
<div className="text-[10px] text-ui-muted font-ui-mono tabular-nums truncate mt-0.5">
- Code: {hostInfo.joinCode || hostInfo.roomCode}
+ {t('Code: {code}', { code: hostInfo.joinCode || hostInfo.roomCode })}
</div>
) : (
hostInfo?.localIp && (
@@ -714,7 +729,7 @@ export const HostModal: React.FC<HostModalProps> = ({
<div>
<div className="text-[11px] font-medium text-ui-muted mb-1.5 tabular-nums">
- Participants on Canvas ({peers.length + 1})
+ {t('Participants on Canvas ({count})', { count: peers.length + 1 })}
</div>
<div className="rounded-ui-md border border-ui-subtle bg-ui-header max-h-40 overflow-y-auto divide-y divide-ui-subtle">
<div className="flex items-center justify-between px-3 py-2 text-xs">
@@ -723,16 +738,18 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-2.5 h-2.5 rounded-full shrink-0"
style={{ backgroundColor: myPeer.color }}
/>
- <span className="font-medium text-ui-primary">{myPeer.name} (You)</span>
+ <span className="font-medium text-ui-primary">
+ {t('{name} (You)', { name: myPeer.name })}
+ </span>
</div>
<span
- className={`text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs capitalize ${
+ className={`text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs ${
myRole === 'viewer'
? 'bg-ui-control text-ui-muted'
: 'bg-ui-success/15 text-ui-success'
}`}
>
- {myRole}
+ {formatRoleLabel(myRole)}
</span>
</div>
{peers.map((peer) => {
@@ -757,8 +774,8 @@ export const HostModal: React.FC<HostModalProps> = ({
}}
title={
isFollowing
- ? `Stop following ${peer.name}'s camera`
- : `Follow ${peer.name}'s camera`
+ ? t("Stop following {name}'s camera", { name: peer.name })
+ : t("Follow {name}'s camera", { name: peer.name })
}
className="flex items-center gap-2 min-w-0 flex-1 text-left rounded-ui-xs py-0.5 px-1 -ml-1 hover:bg-ui-control-hover/60 transition-colors cursor-pointer"
>
@@ -775,7 +792,7 @@ export const HostModal: React.FC<HostModalProps> = ({
</div>
{peer.activeBrushName && (
<div className="text-[10px] text-ui-muted truncate">
- {peer.activeBrushName}
+ {td(peer.activeBrushName)}
</div>
)}
</div>
@@ -787,8 +804,8 @@ export const HostModal: React.FC<HostModalProps> = ({
data-testid={`host-modal-grab-brush-${peer.id}`}
onClick={() => onGrabPeerBrush(peer.id)}
disabled={isGrabbing}
- title={`Try ${peer.name}'s Brush`}
- aria-label={`Try ${peer.name}'s Brush`}
+ title={t("Try {name}'s Brush", { name: peer.name })}
+ aria-label={t("Try {name}'s Brush", { name: peer.name })}
className="flex items-center gap-1 rounded-ui-xs border border-ui-default bg-ui-control hover:bg-ui-control-hover hover:border-ui-accent-border disabled:opacity-50 px-1.5 py-0.5 text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
{isGrabbing ? (
@@ -796,11 +813,11 @@ export const HostModal: React.FC<HostModalProps> = ({
) : (
<Paintbrush className="w-3 h-3 text-ui-accent" />
)}
- <span>Try Brush</span>
+ <span>{t('Try Brush')}</span>
</button>
)}
- <span className="text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-control text-ui-muted capitalize">
- {peer.isHost ? 'Host' : peer.role || 'Editor'}
+ <span className="text-[10px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-control text-ui-muted">
+ {formatRoleLabel(peer.role, peer.isHost)}
</span>
</div>
</div>
@@ -819,7 +836,7 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-full flex items-center justify-center gap-2 rounded-ui-sm border border-ui-danger/35 bg-ui-danger/15 hover:bg-ui-danger/25 py-2 text-xs font-medium text-ui-danger transition-colors cursor-pointer"
>
<LogOut className="w-3.5 h-3.5" />
- <span>Leave Session</span>
+ <span>{t('Leave Session')}</span>
</button>
</div>
</div>
@@ -836,7 +853,7 @@ export const HostModal: React.FC<HostModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Host Session
+ {t('Host Session')}
</button>
<button
type="button"
@@ -847,14 +864,14 @@ export const HostModal: React.FC<HostModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Join Room
+ {t('Join Room')}
</button>
</div>
<div>
<label className="text-[11px] font-medium text-ui-secondary mb-1.5 flex items-center gap-1.5">
<User className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Your Nickname</span>
+ <span>{t('Your Nickname')}</span>
</label>
<input
type="text"
@@ -864,7 +881,7 @@ export const HostModal: React.FC<HostModalProps> = ({
setNickname(e.target.value);
}}
maxLength={40}
- placeholder="Your name"
+ placeholder={t('Your name')}
className="w-full rounded-ui-sm border border-ui-default bg-ui-input px-3 py-2 text-xs text-ui-primary placeholder:text-ui-muted/60 focus:border-ui-focus focus:outline-hidden"
/>
</div>
@@ -873,7 +890,7 @@ export const HostModal: React.FC<HostModalProps> = ({
<>
<div>
<label className="block text-[11px] font-medium text-ui-secondary mb-1.5">
- Room / Canvas Name
+ {t('Room / Canvas Name')}
</label>
<input
type="text"
@@ -882,7 +899,7 @@ export const HostModal: React.FC<HostModalProps> = ({
roomNameEditedRef.current = true;
setRoomName(e.target.value);
}}
- placeholder="Ink Studio Session"
+ placeholder={t('Ink Studio Session')}
className="w-full rounded-ui-sm border border-ui-default bg-ui-input px-3 py-2 text-xs text-ui-primary placeholder:text-ui-muted/60 focus:border-ui-focus focus:outline-hidden"
/>
</div>
@@ -890,7 +907,7 @@ export const HostModal: React.FC<HostModalProps> = ({
{/* Network Mode Switcher */}
<div>
<label className="block text-[11px] font-medium text-ui-secondary mb-1.5">
- Connection Mode
+ {t('Connection Mode')}
</label>
<div className="space-y-2">
{onStartWebRtcHosting && (
@@ -914,14 +931,14 @@ export const HostModal: React.FC<HostModalProps> = ({
<div className="min-w-0 flex-1">
<div className="flex items-center gap-1.5 flex-wrap">
<span className="text-xs font-medium text-ui-primary">
- Worldwide P2P (Room Code)
+ {t('Worldwide P2P (Room Code)')}
</span>
<span className="text-[9px] font-medium px-1.5 py-0.5 rounded-ui-xs bg-ui-success/15 text-ui-success border border-ui-success/30 leading-none">
- Recommended
+ {t('Recommended')}
</span>
</div>
<div className="text-[10px] text-ui-muted mt-0.5">
- Fast direct INK-XXXX code for PC &amp; Android tablets · No setup
+ {t('Fast direct INK-XXXX code for PC & Android tablets · No setup')}
</div>
</div>
</button>
@@ -947,10 +964,10 @@ export const HostModal: React.FC<HostModalProps> = ({
/>
<div className="min-w-0">
<div className="text-xs font-medium text-ui-primary leading-tight">
- Web Link (Cloudflare Tunnel)
+ {t('Web Link (Cloudflare Tunnel)')}
</div>
<div className="text-[10px] text-ui-muted mt-0.5">
- Browser guests &amp; up to 16 peers
+ {t('Browser guests & up to 16 peers')}
</div>
</div>
</button>
@@ -974,9 +991,11 @@ export const HostModal: React.FC<HostModalProps> = ({
/>
<div className="min-w-0">
<div className="text-xs font-medium text-ui-primary leading-tight">
- Local Network (LAN)
+ {t('Local Network (LAN)')}
+ </div>
+ <div className="text-[10px] text-ui-muted mt-0.5">
+ {t('Same Wi-Fi network')}
</div>
- <div className="text-[10px] text-ui-muted mt-0.5">Same Wi-Fi network</div>
</div>
</button>
</div>
@@ -986,7 +1005,7 @@ export const HostModal: React.FC<HostModalProps> = ({
{hostMode === 'lan' && (
<div>
<label className="block text-[11px] font-medium text-ui-secondary mb-1.5">
- Local Port
+ {t('Local Port')}
</label>
<input
type="number"
@@ -995,7 +1014,7 @@ export const HostModal: React.FC<HostModalProps> = ({
className="w-full rounded-ui-sm border border-ui-default bg-ui-input px-3 py-2 text-xs text-ui-primary focus:border-ui-focus focus:outline-hidden font-ui-mono tabular-nums"
/>
<p className="text-[10px] text-ui-muted mt-1">
- Default is 30303. Works over local Wi-Fi or virtual LAN (Tailscale).
+ {t('Default is 30303. Works over local Wi-Fi or virtual LAN (Tailscale).')}
</p>
</div>
)}
@@ -1017,7 +1036,7 @@ export const HostModal: React.FC<HostModalProps> = ({
}}
className="text-[11px] text-ui-primary underline hover:opacity-80 cursor-pointer"
>
- Start Quick P2P Room instead
+ {t('Start Quick P2P Room instead')}
</button>
)}
<button
@@ -1028,7 +1047,7 @@ export const HostModal: React.FC<HostModalProps> = ({
}}
className="text-[11px] text-ui-primary underline hover:opacity-80 cursor-pointer"
>
- Start Local Wi-Fi Server instead
+ {t('Start Local Wi-Fi Server instead')}
</button>
</div>
)}
@@ -1040,18 +1059,25 @@ export const HostModal: React.FC<HostModalProps> = ({
<Shield className="w-3.5 h-3.5 text-ui-icon-muted" />
<span>
{hostMode === 'p2p'
- ? 'Direct Encrypted WebRTC P2P'
+ ? t('Direct Encrypted WebRTC P2P')
: hostMode === 'tunnel'
- ? 'Encrypted Worldwide Tunnel'
- : 'Local Wi-Fi Access'}
+ ? t('Encrypted Worldwide Tunnel')
+ : t('Local Wi-Fi Access')}
</span>
</div>
<p className="leading-relaxed">
{hostMode === 'p2p'
- ? `Generates a short Room Code (INK-XXXX-XXXXXX) with zero server setup or cloudflared download. Android tablets and desktop apps connect directly over WebRTC (up to ${MAX_WEBRTC_PEERS} guests).`
+ ? t(
+ 'Generates a short Room Code (INK-XXXX-XXXXXX) with zero server setup or cloudflared download. Android tablets and desktop apps connect directly over WebRTC (up to {max} guests).',
+ { max: MAX_WEBRTC_PEERS }
+ )
: hostMode === 'tunnel'
- ? 'Launches a Cloudflare HTTPS/WSS tunnel (HTTP/2 over port 443) so friends on any network can join in a browser or desktop app.'
- : 'Reachable only by devices on the same Wi-Fi network or virtual LAN (e.g. Tailscale).'}
+ ? t(
+ 'Launches a Cloudflare HTTPS/WSS tunnel (HTTP/2 over port 443) so friends on any network can join in a browser or desktop app.'
+ )
+ : t(
+ 'Reachable only by devices on the same Wi-Fi network or virtual LAN (e.g. Tailscale).'
+ )}
</p>
</div>
@@ -1068,10 +1094,10 @@ export const HostModal: React.FC<HostModalProps> = ({
<span>
{startStatus ||
(hostMode === 'p2p'
- ? 'Opening P2P Room...'
+ ? t('Opening P2P Room...')
: hostMode === 'tunnel'
- ? 'Starting Worldwide Tunnel...'
- : 'Starting Server...')}
+ ? t('Starting Worldwide Tunnel...')
+ : t('Starting Server...'))}
</span>
</>
) : (
@@ -1085,8 +1111,8 @@ export const HostModal: React.FC<HostModalProps> = ({
)}
<span>
{hostMode === 'p2p'
- ? 'Start Room & Copy Code'
- : 'Start Server & Copy Link'}
+ ? t('Start Room & Copy Code')
+ : t('Start Server & Copy Link')}
</span>
</>
)}
@@ -1097,14 +1123,19 @@ export const HostModal: React.FC<HostModalProps> = ({
<div>
<label className="text-[11px] font-medium text-ui-secondary mb-1.5 flex items-center gap-1.5">
<Link2 className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Room Code (INK-XXXX...) or Invite Link</span>
+ <span>{t('Room Code (INK-XXXX...) or Invite Link')}</span>
</label>
<input
type="text"
data-testid="join-target-input"
value={joinUrl}
onChange={(e) => setJoinUrl(e.target.value)}
- placeholder="INK-7429-K8P2M9 or invite link (ws://, wss://, trycloudflare.com)"
+ onKeyDown={(e) => {
+ if (isImeComposing(e) && e.key === 'Enter') e.preventDefault();
+ }}
+ placeholder={t(
+ 'INK-7429-K8P2M9 or invite link (ws://, wss://, trycloudflare.com)'
+ )}
className="w-full rounded-ui-sm border border-ui-default bg-ui-input px-3 py-2 text-xs text-ui-primary placeholder:text-ui-muted/60 font-ui-mono focus:border-ui-focus focus:outline-hidden"
/>
{parsedJoinTarget && (
@@ -1116,7 +1147,9 @@ export const HostModal: React.FC<HostModalProps> = ({
<>
<Radio className="w-3 h-3 shrink-0" />
<span>
- WebRTC P2P Room detected ({parsedJoinTarget.roomCode})
+ {t('WebRTC P2P Room detected ({code})', {
+ code: parsedJoinTarget.roomCode,
+ })}
</span>
</>
) : (
@@ -1124,30 +1157,37 @@ export const HostModal: React.FC<HostModalProps> = ({
<Globe className="w-3 h-3 shrink-0" />
<span>
{parsedJoinTarget.isSecure
- ? 'Secure WebSocket (WSS)'
- : 'WebSocket (WS)'}{' '}
- detected ({parsedJoinTarget.host})
+ ? t('Secure WebSocket (WSS) detected ({host})', {
+ host: parsedJoinTarget.host,
+ })
+ : t('WebSocket (WS) detected ({host})', {
+ host: parsedJoinTarget.host,
+ })}
</span>
</>
)}
</div>
)}
<p className="text-[10px] text-ui-muted mt-1">
- Paste an Android/PC P2P Room Code (INK-XXXX-XXXXXX), P2P invite link, or
- Cloudflare / LAN WebSocket URL.
+ {t(
+ 'Paste an Android/PC P2P Room Code (INK-XXXX-XXXXXX), P2P invite link, or Cloudflare / LAN WebSocket URL.'
+ )}
</p>
</div>
{parsedJoinTarget?.kind === 'p2p' && !parsedJoinTarget.roomSecret && (
<div>
<label className="block text-[11px] font-medium text-ui-secondary mb-1.5">
- Room Passcode (if separate)
+ {t('Room Passcode (if separate)')}
</label>
<input
type="text"
value={manualSecret}
onChange={(e) => setManualSecret(e.target.value.toUpperCase())}
- placeholder="e.g. K8P2M9"
+ onKeyDown={(e) => {
+ if (isImeComposing(e) && e.key === 'Enter') e.preventDefault();
+ }}
+ placeholder={t('e.g. K8P2M9')}
className="w-full rounded-ui-sm border border-ui-default bg-ui-input px-3 py-2 text-xs text-ui-primary placeholder:text-ui-muted/60 font-ui-mono focus:border-ui-focus focus:outline-hidden"
/>
</div>
@@ -1161,7 +1201,7 @@ export const HostModal: React.FC<HostModalProps> = ({
{isJoining ? (
<>
<Loader2 className="w-3.5 h-3.5 animate-spin" />
- <span>Connecting...</span>
+ <span>{t('Connecting...')}</span>
</>
) : (
<>
@@ -1172,8 +1212,8 @@ export const HostModal: React.FC<HostModalProps> = ({
)}
<span>
{parsedJoinTarget?.kind === 'p2p'
- ? 'Join P2P Room'
- : 'Join Session'}
+ ? t('Join P2P Room')
+ : t('Join Session')}
</span>
</>
)}
diff --git a/src/components/InfoPanel.tsx b/src/components/InfoPanel.tsx
index d9e8c22..c2730a5 100644
--- a/src/components/InfoPanel.tsx
+++ b/src/components/InfoPanel.tsx
@@ -12,6 +12,7 @@ import {
formatWorkTimeClock,
formatWorkTimeHoursMinutes,
} from '../utils/artworkTimeTracker';
+import { useI18n } from '../i18n';
function rgbToHsv(r: number, g: number, b: number): { h: number; s: number; v: number } {
const rn = r / 255;
@@ -55,6 +56,7 @@ export interface InfoPanelProps {
export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
({ layers = [], colorMode: colorModeProp, themePreset = 'modern', tracker = artworkTimeTracker }) => {
+ const { t } = useI18n();
const activeDocumentId = useDocumentStore((s) => s.activeDocumentId);
const dimensions = useDocumentStore((s) => s.dimensions);
const storeColorMode = useDocumentStore((s) => s.colorMode);
@@ -179,12 +181,12 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
data-testid="info-work-time-section"
data-status={timeSnap.status}
className="rounded-ui-md bg-ui-input border border-ui-subtle px-2 py-1.5 flex flex-col gap-1"
- title="Automatically tracks active time spent drawing and editing this artwork"
+ title={t('Automatically tracks active time spent drawing and editing this artwork')}
>
<div className="flex items-center justify-between gap-2">
<span className="flex items-center gap-1 text-[10px] text-ui-muted">
<Clock className="w-3 h-3 text-ui-icon-muted" />
- <span>Work Time</span>
+ <span>{t('Work Time')}</span>
</span>
<span
data-testid="info-work-time-hm"
@@ -204,9 +206,9 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
<span
data-testid="info-session-time"
className="font-ui-mono tabular-nums text-[10px] text-ui-muted"
- title="Time spent in the current session"
+ title={t('Time spent in the current session')}
>
- Session {formatWorkTimeClock(timeSnap.sessionMs)}
+ {t('Session {time}', { time: formatWorkTimeClock(timeSnap.sessionMs) })}
</span>
</div>
</section>
@@ -216,10 +218,10 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
<div className="flex items-center justify-between text-[10px] text-ui-muted">
<div className="flex items-center gap-1 uppercase tracking-wider font-medium">
<Crosshair className="w-3 h-3 text-ui-icon-muted" />
- <span>Cursor</span>
+ <span>{t('Cursor')}</span>
</div>
<span className="font-ui-mono tabular-nums text-ui-muted">
- P: <span ref={pressureRef} className="text-ui-primary">0%</span>
+ {t('P:')} <span ref={pressureRef} className="text-ui-primary">0%</span>
</span>
</div>
@@ -243,7 +245,7 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
<div
className="w-6 h-6 rounded-ui-xs border border-ui-default shrink-0 shadow-inner"
style={{ backgroundColor: colorBreakdown.hex }}
- title={`Active Color: ${colorBreakdown.hex}`}
+ title={t('Active Color: {color}', { color: colorBreakdown.hex })}
/>
<div className="flex-1 min-w-0 grid grid-cols-2 gap-x-2 gap-y-0.5 font-ui-mono tabular-nums text-[10px]">
<div className="flex justify-between">
@@ -277,21 +279,21 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
{/* Canvas & Memory Info (CSP Info Palette Style) */}
<section className="rounded-ui-md bg-ui-input border border-ui-subtle p-2 flex flex-col gap-1">
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Canvas</span>
+ <span className="text-ui-muted">{t('Canvas')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{dimensions.width} × {dimensions.height} px
</span>
</div>
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Resolution</span>
+ <span className="text-ui-muted">{t('Resolution')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
- {dimensions.dpi ?? 300} dpi · {formatColorModeLabel(colorMode)}
+ {dimensions.dpi ?? 300} dpi · {t(formatColorModeLabel(colorMode))}
</span>
</div>
<div className="flex items-center justify-between text-[10px]">
<span className="text-ui-muted flex items-center gap-1">
<Layers className="w-2.5 h-2.5 text-ui-icon-muted" />
- <span>Layers</span>
+ <span>{t('Layers')}</span>
</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{visibleLayerCount} / {layers.length}
@@ -300,19 +302,19 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
<div className="flex items-center justify-between text-[10px]">
<span className="text-ui-muted flex items-center gap-1">
<Monitor className="w-2.5 h-2.5 text-ui-icon-muted" />
- <span>Engine</span>
+ <span>{t('Engine')}</span>
</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{memoryStats.backend === 'webgl2'
? `WebGL2${memoryStats.vramMb > 0 ? ` · ${memoryStats.vramMb} MB` : ''}`
- : 'Canvas 2D (CPU)'}
+ : t('Canvas 2D (CPU)')}
</span>
</div>
<div className="flex flex-col gap-1 pt-1 mt-0.5 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[10px]">
<span className="text-ui-muted flex items-center gap-1">
<Cpu className="w-2.5 h-2.5 text-ui-icon-muted" />
- <span>Tile RAM</span>
+ <span>{t('Tile RAM')}</span>
</span>
<div className="flex items-center gap-1.5">
<span className="font-ui-mono tabular-nums text-ui-primary">
@@ -324,12 +326,15 @@ export const InfoPanel: React.FC<InfoPanelProps> = React.memo(
const res = await performanceManager.purgeMemory('all');
uiStoreActions.showToast(
res.freedTileMb > 0 || res.offloadedUndoSteps > 0
- ? `Freed ${res.freedTileMb} MB tiles, ${res.offloadedUndoSteps} undo steps`
- : 'Memory & GPU caches flushed'
+ ? t('Freed {mb} MB tiles, {steps} undo steps', {
+ mb: res.freedTileMb,
+ steps: res.offloadedUndoSteps,
+ })
+ : t('Memory & GPU caches flushed')
);
}}
className="p-0.5 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Purge Tile, Undo & GPU Caches"
+ title={t('Purge Tile, Undo & GPU Caches')}
>
<Trash2 className="w-2.5 h-2.5" />
</button>
diff --git a/src/components/LTExtractionModal.tsx b/src/components/LTExtractionModal.tsx
index e12aa8b..44c7238 100644
--- a/src/components/LTExtractionModal.tsx
+++ b/src/components/LTExtractionModal.tsx
@@ -1,6 +1,7 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { X, Loader2, Layers, Eye } from 'lucide-react';
import { LTConversionSettings } from '../types/editor';
+import { isImeComposing, useI18n } from '../i18n';
export interface LTPreviewBuffers {
lineCanvas: HTMLCanvasElement;
@@ -29,8 +30,10 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
onExtract,
onClose,
}) => {
+ const { t, tc, td } = useI18n();
const cleanModelName = (modelName || '3D Model').replace(/\.[^/.]+$/, '').trim();
- const defaultFolderName = `3D Extraction [${cleanModelName}]`;
+ const localizedModelName = td(cleanModelName);
+ const defaultFolderName = t('3D Extraction [{name}]', { name: localizedModelName });
const [lineWidth, setLineWidth] = useState(1);
const [lineThreshold, setLineThreshold] = useState(0.28);
@@ -58,6 +61,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !isExtracting) {
e.preventDefault();
e.stopPropagation();
@@ -197,16 +201,17 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
<div className="flex items-center gap-2 min-w-0">
<Layers className="w-4 h-4 text-ui-accent shrink-0" />
<span className="text-xs font-semibold tracking-wide truncate text-ui-primary">
- Line & Tone Extraction (LT Conversion)
+ {t('Line & Tone Extraction (LT Conversion)')}
</span>
<span className="text-[10px] font-ui-mono text-ui-muted hidden sm:inline">
- · {cleanModelName}
+ · {localizedModelName}
</span>
</div>
<button
type="button"
disabled={isExtracting}
onClick={onClose}
+ aria-label={t('Close')}
className="p-1 rounded-ui-sm text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover disabled:opacity-40 transition-colors cursor-pointer"
>
<X className="w-4 h-4" />
@@ -237,7 +242,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {label}
+ {tc('lt', label)}
</button>
))}
</div>
@@ -248,11 +253,11 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
onClick={() =>
setPreviewBgMode((prev) => (prev === 'white' ? 'checker' : 'white'))
}
- title="Toggle Paper / Transparent Preview Background"
+ title={t('Toggle Paper / Transparent Preview Background')}
className="flex items-center gap-1 px-2 py-0.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary cursor-pointer transition-colors"
>
<Eye className="w-3 h-3 text-ui-accent" />
- <span>{previewBgMode === 'white' ? 'Paper' : 'Alpha'}</span>
+ <span>{previewBgMode === 'white' ? t('Paper') : t('Alpha')}</span>
</button>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted hidden sm:inline">
{docAspect}
@@ -283,7 +288,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
{isUpdatingPreview && (
<div className="absolute bottom-3 right-3 px-2.5 py-1 rounded-full bg-ui-floating border border-ui-default flex items-center gap-1.5 text-[10px] text-ui-primary shadow-ui-floating">
<Loader2 className="w-3 h-3 animate-spin text-ui-accent" />
- <span>Updating preview...</span>
+ <span>{t('Updating preview...')}</span>
</div>
)}
</div>
@@ -294,12 +299,12 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
{/* Line Extraction Section */}
<div className="space-y-2.5">
<div className="text-[10px] uppercase tracking-wider text-ui-muted font-medium">
- Line Extraction
+ {t('Line Extraction')}
</div>
<div className="space-y-1">
<div className="flex justify-between text-[11px]">
- <span className="text-ui-secondary">Line Width</span>
+ <span className="text-ui-secondary">{t('Line Width')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{lineWidth} px</span>
</div>
<input
@@ -315,7 +320,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
<div className="space-y-1">
<div className="flex justify-between text-[11px]">
- <span className="text-ui-secondary">Edge Sensitivity</span>
+ <span className="text-ui-secondary">{t('Edge Sensitivity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round((1 - lineThreshold) * 100)}%
</span>
@@ -332,7 +337,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
</div>
<label className="flex items-center justify-between text-[11px] text-ui-primary pt-0.5 cursor-pointer">
- <span>Anti-Aliasing</span>
+ <span>{t('Anti-Aliasing')}</span>
<input
type="checkbox"
checked={antiAliasing}
@@ -345,7 +350,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
<div className="space-y-2.5 pt-3 border-t border-ui-subtle">
<label className="flex items-center justify-between cursor-pointer">
<span className="text-[10px] uppercase tracking-wider text-ui-muted font-medium">
- Screentones
+ {t('Screentones')}
</span>
<input
type="checkbox"
@@ -358,7 +363,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
<>
<div className="space-y-1.5">
<div className="flex justify-between text-[11px]">
- <span className="text-ui-secondary">Shadow Bands</span>
+ <span className="text-ui-secondary">{t('Shadow Bands')}</span>
<span className="text-[10px] text-ui-muted font-ui-mono tabular-nums">
{toneFrequency} LPI
</span>
@@ -380,16 +385,16 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
))}
</div>
<p className="text-[10px] text-ui-muted font-ui-mono tabular-nums">
- {toneCount === 1 && 'Deep Shadow (45%)'}
- {toneCount === 2 && 'Light (20%) + Deep (45%)'}
- {toneCount === 3 && 'Light (15%) + Mid (30%) + Deep (50%)'}
- {toneCount === 4 && '4-step gradation (10% - 55%)'}
+ {toneCount === 1 && t('Deep Shadow (45%)')}
+ {toneCount === 2 && t('Light (20%) + Deep (45%)')}
+ {toneCount === 3 && t('Light (15%) + Mid (30%) + Deep (50%)')}
+ {toneCount === 4 && t('4-step gradation (10% - 55%)')}
</p>
</div>
<div className="space-y-1">
<div className="flex justify-between text-[11px]">
- <span className="text-ui-secondary">Frequency</span>
+ <span className="text-ui-secondary">{t('Frequency')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{toneFrequency} LPI</span>
</div>
<div className="grid grid-cols-3 gap-1">
@@ -415,11 +420,15 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
{/* Output Folder Section */}
<div className="space-y-1.5 pt-3 border-t border-ui-subtle">
- <label className="text-[11px] text-ui-secondary block">Output Folder</label>
+ <label className="text-[11px] text-ui-secondary block">{t('Output Folder')}</label>
<input
type="text"
value={folderName}
onChange={(e) => setFolderName(e.target.value)}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
placeholder={defaultFolderName}
className="w-full px-2.5 py-1.5 text-xs bg-ui-input border border-ui-default rounded-ui-sm text-ui-primary font-ui-mono outline-none focus:border-ui-focus"
/>
@@ -433,7 +442,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
onClick={onClose}
className="flex-1 py-2 rounded-ui-sm text-xs text-ui-primary bg-ui-control hover:bg-ui-control-hover border border-ui-default transition-colors cursor-pointer disabled:opacity-40"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
@@ -442,7 +451,7 @@ export const LTExtractionModal: React.FC<LTExtractionModalProps> = ({
className="flex-1 py-2 bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium rounded-ui-sm text-xs transition-opacity disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5"
>
{isExtracting && <Loader2 className="w-3.5 h-3.5 animate-spin" />}
- <span>{isExtracting ? 'Extracting...' : 'Extract'}</span>
+ <span>{isExtracting ? t('Extracting...') : t('Extract')}</span>
</button>
</div>
</div>
diff --git a/src/components/LayerStylesModal.tsx b/src/components/LayerStylesModal.tsx
index ae6a831..aadd0b0 100644
--- a/src/components/LayerStylesModal.tsx
+++ b/src/components/LayerStylesModal.tsx
@@ -6,6 +6,7 @@ import {
LayerStyleDropShadow,
LayerStyleOuterGlow,
} from '../types/editor';
+import { isImeComposing, useI18n } from '../i18n';
export interface LayerStylesModalProps {
isOpen: boolean;
@@ -46,10 +47,12 @@ type StyleTab = 'stroke' | 'dropShadow' | 'outerGlow';
export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
isOpen,
initialStyles,
- layerName = 'Layer',
+ layerName,
onClose,
onApply,
}) => {
+ const { t, tc, td } = useI18n();
+ const resolvedLayerName = layerName ? td(layerName) : t('Layer');
const [activeTab, setActiveTab] = useState<StyleTab>('stroke');
const [stroke, setStroke] = useState<LayerStyleStroke>(() => ({
@@ -212,6 +215,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
onClose();
} else if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
@@ -292,13 +296,13 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
className="h-10 flex items-center justify-between px-4 bg-ui-header border-b border-ui-subtle cursor-move text-xs font-medium"
>
<span id="layer-styles-modal-title" className="text-ui-primary">
- Layer Style — {layerName}
+ {t('Layer Style — {name}', { name: resolvedLayerName })}
</span>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={tc('action', 'Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-sm transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -311,7 +315,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
<div className="w-48 bg-ui-header border-r border-ui-subtle p-2 flex flex-col justify-between">
<div className="space-y-1">
<div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-ui-muted">
- Styles
+ {t('Styles')}
</div>
{/* Stroke Item */}
@@ -332,7 +336,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
}}
className="cursor-pointer"
/>
- <span className="flex-1 truncate">Stroke</span>
+ <span className="flex-1 truncate">{tc('layerStyle', 'Stroke')}</span>
</div>
{/* Drop Shadow Item */}
@@ -353,7 +357,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
}}
className="cursor-pointer"
/>
- <span className="flex-1 truncate">Drop Shadow</span>
+ <span className="flex-1 truncate">{tc('layerStyle', 'Drop Shadow')}</span>
</div>
{/* Outer Glow Item */}
@@ -374,13 +378,13 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
}}
className="cursor-pointer"
/>
- <span className="flex-1 truncate">Outer Glow</span>
+ <span className="flex-1 truncate">{tc('layerStyle', 'Outer Glow')}</span>
</div>
</div>
{/* Interactive Swatch Preview Canvas */}
<div className="pt-2 border-t border-ui-subtle flex flex-col items-center">
- <span className="text-[10px] text-ui-muted mb-1 font-ui-mono">Preview</span>
+ <span className="text-[10px] text-ui-muted mb-1 font-ui-mono">{t('Preview')}</span>
<canvas
ref={previewCanvasRef}
width={100}
@@ -396,21 +400,21 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{activeTab === 'stroke' && (
<div className="space-y-4">
<div className="flex items-center justify-between pb-2 border-b border-ui-subtle">
- <span className="font-medium text-ui-primary">Stroke Options</span>
+ <span className="font-medium text-ui-primary">{t('Stroke Options')}</span>
<label className="flex items-center space-x-1.5 cursor-pointer text-ui-secondary">
<input
type="checkbox"
checked={stroke.enabled}
onChange={(e) => setStroke((s) => ({ ...s, enabled: e.target.checked }))}
/>
- <span className="text-xs">Enable Stroke</span>
+ <span className="text-xs">{t('Enable Stroke')}</span>
</label>
</div>
{/* Structure / Size */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Size</span>
+ <span className="text-ui-muted">{t('Size')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{stroke.size} px</span>
</div>
<input
@@ -425,7 +429,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Position */}
<div className="space-y-1">
- <span className="text-ui-muted block">Position</span>
+ <span className="text-ui-muted block">{t('Position')}</span>
<div className="grid grid-cols-3 gap-1 bg-ui-input p-1 rounded-ui-sm border border-ui-subtle">
{(['outside', 'inside', 'center'] as const).map((pos) => (
<button
@@ -438,7 +442,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
: 'hover:bg-ui-control-hover text-ui-secondary hover:text-ui-primary'
}`}
>
- {pos}
+ {tc('strokePos', pos)}
</button>
))}
</div>
@@ -447,7 +451,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Opacity */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Opacity</span>
+ <span className="text-ui-muted">{t('Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{Math.round(stroke.opacity * 100)}%</span>
</div>
<input
@@ -463,7 +467,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Color */}
<div className="space-y-1">
- <span className="text-ui-muted block">Color</span>
+ <span className="text-ui-muted block">{t('Color')}</span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -486,21 +490,21 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{activeTab === 'dropShadow' && (
<div className="space-y-4">
<div className="flex items-center justify-between pb-2 border-b border-ui-subtle">
- <span className="font-medium text-ui-primary">Drop Shadow Options</span>
+ <span className="font-medium text-ui-primary">{t('Drop Shadow Options')}</span>
<label className="flex items-center space-x-1.5 cursor-pointer text-ui-secondary">
<input
type="checkbox"
checked={dropShadow.enabled}
onChange={(e) => setDropShadow((s) => ({ ...s, enabled: e.target.checked }))}
/>
- <span className="text-xs">Enable Shadow</span>
+ <span className="text-xs">{t('Enable Shadow')}</span>
</label>
</div>
{/* Color & Opacity */}
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1">
- <span className="text-ui-muted block">Color</span>
+ <span className="text-ui-muted block">{t('Color')}</span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -519,7 +523,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Opacity</span>
+ <span className="text-ui-muted">{t('Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{Math.round(dropShadow.opacity * 100)}%</span>
</div>
<input
@@ -537,7 +541,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Angle */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Angle</span>
+ <span className="text-ui-muted">{t('Angle')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{dropShadow.angle}°</span>
</div>
<input
@@ -553,7 +557,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Distance */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Distance</span>
+ <span className="text-ui-muted">{t('Distance')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{dropShadow.distance} px</span>
</div>
<input
@@ -569,7 +573,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Spread */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Spread</span>
+ <span className="text-ui-muted">{t('Spread')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{dropShadow.spread}%</span>
</div>
<input
@@ -585,7 +589,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Size / Blur */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Size (Blur)</span>
+ <span className="text-ui-muted">{t('Size (Blur)')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{dropShadow.blur} px</span>
</div>
<input
@@ -604,21 +608,21 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{activeTab === 'outerGlow' && (
<div className="space-y-4">
<div className="flex items-center justify-between pb-2 border-b border-ui-subtle">
- <span className="font-medium text-ui-primary">Outer Glow Options</span>
+ <span className="font-medium text-ui-primary">{t('Outer Glow Options')}</span>
<label className="flex items-center space-x-1.5 cursor-pointer text-ui-secondary">
<input
type="checkbox"
checked={outerGlow.enabled}
onChange={(e) => setOuterGlow((s) => ({ ...s, enabled: e.target.checked }))}
/>
- <span className="text-xs">Enable Glow</span>
+ <span className="text-xs">{t('Enable Glow')}</span>
</label>
</div>
{/* Color & Opacity */}
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1">
- <span className="text-ui-muted block">Color</span>
+ <span className="text-ui-muted block">{t('Color')}</span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -637,7 +641,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Opacity</span>
+ <span className="text-ui-muted">{t('Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{Math.round(outerGlow.opacity * 100)}%</span>
</div>
<input
@@ -655,7 +659,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Spread */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Spread</span>
+ <span className="text-ui-muted">{t('Spread')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{outerGlow.spread}%</span>
</div>
<input
@@ -671,7 +675,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Size / Blur */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Size (Blur)</span>
+ <span className="text-ui-muted">{t('Size (Blur)')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{outerGlow.blur} px</span>
</div>
<input
@@ -695,7 +699,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onClick={handleResetDefaults}
className="px-3 py-1.5 text-xs text-ui-secondary hover:text-ui-primary bg-ui-control hover:bg-ui-control-hover rounded-ui-sm border border-ui-subtle transition-colors cursor-pointer"
>
- Reset Category
+ {t('Reset Category')}
</button>
<div className="flex items-center gap-2">
@@ -704,14 +708,14 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 text-xs font-medium text-ui-primary bg-ui-control hover:bg-ui-control-hover border border-ui-default rounded-ui-sm transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
onClick={handleConfirm}
className="px-4 py-1.5 text-xs font-medium bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm transition-opacity cursor-pointer"
>
- OK
+ {t('OK')}
</button>
</div>
</div>
diff --git a/src/components/LeftPanel.tsx b/src/components/LeftPanel.tsx
index e743821..140d4e4 100644
--- a/src/components/LeftPanel.tsx
+++ b/src/components/LeftPanel.tsx
@@ -10,6 +10,7 @@ import { useToolStore, useUiStore, uiStoreActions } from '../stores';
import { ToolStrip } from './ToolStrip';
import { SubToolList } from './SubToolList';
import { ToolPropertyInspector } from './ToolPropertyInspector';
+import { useI18n } from '../i18n';
export interface LeftPanelProps {
onDeselect?: () => void;
@@ -43,6 +44,7 @@ export const LeftPanel: React.FC<LeftPanelProps> = React.memo(
onInvertSelection,
onToggleTransparentColor,
}) => {
+ const { t } = useI18n();
const currentTool = useToolStore((s) => s.tool);
const width = useUiStore((s) => s.leftPanelWidth);
const isHidden = useUiStore((s) => s.isLeftPanelHidden);
@@ -145,7 +147,7 @@ export const LeftPanel: React.FC<LeftPanelProps> = React.memo(
dragStartXRef.current = e.clientX;
dragStartWidthRef.current = width;
}}
- title="Resize brush panel"
+ title={t('Resize brush panel')}
className={`absolute right-0 top-0 bottom-0 w-1 cursor-col-resize transition-colors z-30 ${
isDraggingWidth
? 'bg-[var(--ui-accent-border)]'
diff --git a/src/components/LeftSidebar.tsx b/src/components/LeftSidebar.tsx
index 07c48f2..eb504e2 100644
--- a/src/components/LeftSidebar.tsx
+++ b/src/components/LeftSidebar.tsx
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
import { Paintbrush, Eraser, ArrowLeftRight, Pipette, Sparkles } from 'lucide-react';
import { ToolType } from '../types/editor';
import { LiquifyIcon } from './LiquifyIcon';
+import { isImeComposing, useI18n } from '../i18n';
interface LeftSidebarProps {
currentTool: ToolType;
@@ -22,9 +23,12 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
isTransparentColor = false,
onToggleTransparentColor,
}) => {
+ const { t } = useI18n();
+
// Keyboard shortcuts: B for Brush, E for Eraser, I for Pipette, J for Liquify, X for swap colors
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (['INPUT', 'TEXTAREA'].includes((e.target as HTMLElement).tagName)) {
return;
}
@@ -58,7 +62,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={() => onSelectTool('brush')}
- title="Brush Tool (B)"
+ title={t('Brush Tool (B)')}
className={`w-10 h-10 rounded-ui-sm flex items-center justify-center transition-colors relative group cursor-pointer ${
currentTool === 'brush'
? 'bg-ui-control-active border border-ui-default text-ui-accent'
@@ -68,7 +72,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<Paintbrush className="w-5 h-5" />
{/* Tooltip */}
<div className="absolute left-12 bg-ui-elevated text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default shadow-ui-floating opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity whitespace-nowrap z-50">
- Brush (B)
+ {t('Brush (B)')}
</div>
</button>
@@ -76,7 +80,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={() => onSelectTool('decoration')}
- title="Decoration Tool"
+ title={t('Decoration Tool')}
className={`w-10 h-10 rounded-ui-sm flex items-center justify-center transition-colors relative group cursor-pointer ${
currentTool === 'decoration'
? 'bg-ui-control-active border border-ui-default text-ui-accent'
@@ -85,7 +89,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
>
<Sparkles className="w-5 h-5" />
<div className="absolute left-12 bg-ui-elevated text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default shadow-ui-floating opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity whitespace-nowrap z-50">
- Decoration
+ {t('Decoration')}
</div>
</button>
@@ -93,7 +97,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={() => onSelectTool('eraser')}
- title="Eraser Tool (E)"
+ title={t('Eraser Tool (E)')}
className={`w-10 h-10 rounded-ui-sm flex items-center justify-center transition-colors relative group cursor-pointer ${
currentTool === 'eraser'
? 'bg-ui-control-active border border-ui-default text-ui-accent'
@@ -102,7 +106,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
>
<Eraser className="w-5 h-5" />
<div className="absolute left-12 bg-ui-elevated text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default shadow-ui-floating opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity whitespace-nowrap z-50">
- Eraser (E)
+ {t('Eraser (E)')}
</div>
</button>
@@ -110,7 +114,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={() => onSelectTool('pipette')}
- title="Pipette Tool (I / Hold Alt)"
+ title={t('Pipette Tool (I / Hold Alt)')}
className={`w-10 h-10 rounded-ui-sm flex items-center justify-center transition-colors relative group cursor-pointer ${
currentTool === 'pipette'
? 'bg-ui-control-active border border-ui-default text-ui-accent'
@@ -119,7 +123,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
>
<Pipette className="w-5 h-5" />
<div className="absolute left-12 bg-ui-elevated text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default shadow-ui-floating opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity whitespace-nowrap z-50">
- Pipette (I / Hold Alt)
+ {t('Pipette (I / Hold Alt)')}
</div>
</button>
@@ -127,7 +131,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={() => onSelectTool('liquify')}
- title="Liquify Tool (J)"
+ title={t('Liquify Tool (J)')}
className={`w-10 h-10 rounded-ui-sm flex items-center justify-center transition-colors relative group cursor-pointer ${
currentTool === 'liquify'
? 'bg-ui-control-active border border-ui-default text-ui-accent'
@@ -136,7 +140,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
>
<LiquifyIcon className="w-5 h-5" />
<div className="absolute left-12 bg-ui-elevated text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default shadow-ui-floating opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity whitespace-nowrap z-50">
- Liquify (J)
+ {t('Liquify (J)')}
</div>
</button>
</div>
@@ -149,7 +153,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
{/* Secondary Color Swatch (bottom-right) */}
<div
onClick={onSwapColors}
- title={`Secondary Color: ${secondaryColor} (Click or press X to swap)`}
+ title={t('Secondary Color: {color} (Click or press X to swap)', { color: secondaryColor })}
className="absolute bottom-0 right-0 w-6 h-6 rounded-ui-xs border border-ui-default cursor-pointer hover:border-ui-strong shadow-sm z-0"
style={{ backgroundColor: secondaryColor }}
/>
@@ -163,7 +167,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
onSwapColors();
}
}}
- title={`Primary Active Color: ${primaryColor} (Click to select/swap)`}
+ title={t('Primary Active Color: {color} (Click to select/swap)', { color: primaryColor })}
className={`absolute top-0 left-0 w-6 h-6 rounded-ui-xs cursor-pointer transition-all z-10 ${
!isTransparentColor
? 'border border-ui-accent ring-1 ring-ui-accent-border'
@@ -176,7 +180,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
{/* Transparent Color Swatch */}
<div
onClick={onToggleTransparentColor}
- title="Transparent Ink / Color (C) - Brush as textured eraser"
+ title={t('Transparent Ink / Color (C) - Brush as textured eraser')}
className={`w-7 h-3.5 rounded-ui-xs border cursor-pointer relative overflow-hidden transition-all ${
isTransparentColor
? 'border-ui-accent ring-1 ring-ui-accent-border'
@@ -195,7 +199,7 @@ export const LeftSidebar: React.FC<LeftSidebarProps> = ({
<button
type="button"
onClick={onSwapColors}
- title="Swap Colors (X)"
+ title={t('Swap Colors (X)')}
className="p-1 text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-sm transition-colors cursor-pointer"
>
<ArrowLeftRight className="w-3.5 h-3.5" />
diff --git a/src/components/LightSourceWidget.tsx b/src/components/LightSourceWidget.tsx
index 51c4fc6..e809f57 100644
--- a/src/components/LightSourceWidget.tsx
+++ b/src/components/LightSourceWidget.tsx
@@ -1,6 +1,7 @@
import React, { useRef, useEffect, useCallback, useState } from 'react';
import { RotateCcw } from 'lucide-react';
import { sphericalLightToVector } from '../utils/tool3DRules';
+import { useI18n } from '../i18n';
export interface LightSettings {
azimuth: number; // 0 to 360 degrees (horizontal)
@@ -26,6 +27,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
embedded = false,
compact = false,
}) => {
+ const { t, td } = useI18n();
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const sphereBufferRef = useRef<HTMLCanvasElement | null>(null);
const isDraggingRef = useRef<boolean>(false);
@@ -243,19 +245,19 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
onPointerDown={(e) => e.stopPropagation()}
>
<div className="flex items-center justify-between border-b border-ui-subtle pb-1.5 mb-2">
- <span className="text-[11px] font-medium text-ui-primary">Key Light</span>
+ <span className="text-[11px] font-medium text-ui-primary">{t('Key Light')}</span>
<div className="flex items-center space-x-1">
<button
type="button"
onClick={() => setActiveTab(activeTab === 'sphere' ? 'sliders' : 'sphere')}
className="text-[10px] px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- {activeTab === 'sphere' ? 'Sliders' : 'Sphere'}
+ {activeTab === 'sphere' ? t('Sliders') : t('Sphere')}
</button>
<button
type="button"
onClick={onReset}
- title="Reset Lighting to Studio Default"
+ title={t('Reset Lighting to Studio Default')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
@@ -276,7 +278,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
/>
<div className="absolute inset-0 pointer-events-none flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
<span className="text-[9px] bg-ui-floating border border-ui-default px-1.5 py-0.5 rounded-ui-xs text-ui-primary shadow-ui-floating">
- Drag light angle
+ {t('Drag light angle')}
</span>
</div>
</div>
@@ -291,7 +293,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
: 'bg-ui-control border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {settings.isBacklit ? 'Backlight' : 'Front Light'}
+ {settings.isBacklit ? t('Backlight') : t('Front Light')}
</button>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{settings.azimuth}° / {settings.elevation}°
@@ -301,7 +303,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
) : (
<div className="space-y-2 py-1">
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Azimuth</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Azimuth')}</span>
<input
type="range"
min="0"
@@ -315,7 +317,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Elevation</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Elevation')}</span>
<input
type="range"
min="-85"
@@ -333,7 +335,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
{/* Intensity, Fill & Color Controls */}
<div className="mt-2 pt-2 border-t border-ui-subtle space-y-1.5">
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-12">Power</span>
+ <span className="text-[10px] text-ui-muted w-12">{t('Power')}</span>
<input
type="range"
min="0"
@@ -349,7 +351,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-12">Ambient</span>
+ <span className="text-[10px] text-ui-muted w-12">{t('Ambient')}</span>
<input
type="range"
min="0"
@@ -366,14 +368,14 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
{/* Color Presets + Custom Picker */}
<div className="flex items-center justify-between pt-1 gap-1">
- <span className="text-[10px] text-ui-muted">Color</span>
+ <span className="text-[10px] text-ui-muted">{t('Color')}</span>
<div className="flex items-center space-x-1">
{colorPresets.map((preset) => (
<button
key={preset.label}
type="button"
onClick={() => onChange({ ...settings, color: preset.color })}
- title={preset.label}
+ title={td(preset.label)}
className={`w-3.5 h-3.5 rounded-full border transition-transform cursor-pointer ${
settings.color.toLowerCase() === preset.color.toLowerCase()
? 'scale-110 border-ui-accent ring-1 ring-ui-accent'
@@ -386,7 +388,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
type="color"
value={settings.color}
onChange={(e) => onChange({ ...settings, color: e.target.value })}
- title="Custom Light Color"
+ title={t('Custom Light Color')}
className="w-4 h-4 rounded-ui-xs bg-transparent border-0 cursor-pointer p-0"
/>
</div>
diff --git a/src/components/Local3DContainer.tsx b/src/components/Local3DContainer.tsx
index d6ac45d..c28cff7 100644
--- a/src/components/Local3DContainer.tsx
+++ b/src/components/Local3DContainer.tsx
@@ -60,6 +60,7 @@ import { Csp3DToolbar } from './Csp3DToolbar';
import { LTExtractionModal, LTPreviewBuffers } from './LTExtractionModal';
import { Primitive3DIcon } from './Primitive3DIcon';
import { Upload, Box } from 'lucide-react';
+import { isImeComposing, useI18n } from '../i18n';
export type ShadingMode = Shading3DMode;
export type GizmoMode = 'none' | 'rotate' | 'translate' | 'scale';
@@ -129,6 +130,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
perspectiveRuler,
onUpdatePerspectiveRuler,
}) => {
+ const { t, td } = useI18n();
const mountRef = useRef<HTMLDivElement | null>(null);
const canvasHostRef = useRef<HTMLDivElement | null>(null);
const canvasRef = useRef<HTMLCanvasElement | null>(null);
@@ -782,7 +784,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
preserveDrawingBuffer: true,
});
} catch (err) {
- const msg = err instanceof Error ? err.message : 'Unable to initialize 3D WebGL context.';
+ const msg = err instanceof Error ? err.message : t('Unable to initialize 3D WebGL context.');
console.error('[3D] Renderer initialization failed:', err);
setWebglError(msg);
return;
@@ -1634,7 +1636,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
const reportLoadError = (kindLabel: string, err: unknown) => {
console.error(`[3D] ${kindLabel} load error:`, err);
if (loadRequestIdRef.current === requestId) {
- uiStoreActions.showToast(`Failed to load 3D model "${file.name}".`);
+ uiStoreActions.showToast(t('Failed to load 3D model "{name}".', { name: file.name }));
}
};
@@ -1674,7 +1676,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
});
}
},
- [attachNormalizedObject, clearCurrentModel]
+ [attachNormalizedObject, clearCurrentModel, t]
);
// Select IK target limb (either from clicking sphere on canvas or clicking button in inspector)
@@ -1809,7 +1811,9 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
const modelDisplayName = s.loadedModelName
? s.loadedModelName.replace(/\.[^/.]+$/, '')
: '3D Model';
- const targetFolderName = settings?.folderName?.trim() || `3D Extraction [${modelDisplayName}]`;
+ const targetFolderName =
+ settings?.folderName?.trim() ||
+ t('3D Extraction [{name}]', { name: td(modelDisplayName) });
await bake3DToLineAndTone({
scene: sceneRef.current,
@@ -1846,7 +1850,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
}
}
},
- [dimensions, onClose, onInsertRasterLayer, setHelpersVisible]
+ [dimensions, onClose, onInsertRasterLayer, setHelpersVisible, t, td]
);
// Bake 3D view into a standard 2D Raster Layer
@@ -1863,7 +1867,9 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
camera: cameraRef.current,
dimensions,
activeRenderer: rendererRef.current,
- layerName: s.loadedModelName ? `3D (${s.loadedModelName})` : '3D Model',
+ layerName: s.loadedModelName
+ ? t('3D ({name})', { name: td(s.loadedModelName) })
+ : t('3D Model'),
opacity: s.opacity,
blendMode: 'normal',
disposeOnComplete: false,
@@ -1885,7 +1891,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
setHelpersVisible(true);
}
},
- [dimensions, onBakeSuccess, onClose, onInsertRasterLayer, setHelpersVisible]
+ [dimensions, onBakeSuccess, onClose, onInsertRasterLayer, setHelpersVisible, t, td]
);
// Register imperative bridge for ToolPropertyInspector & Global Ctrl+Z / Ctrl+Y
@@ -1989,6 +1995,7 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (activeToolRef.current !== '3d' || !modelRootRef.current) return;
const target = e.target as HTMLElement | null;
if (
@@ -2290,14 +2297,14 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
{webglError && (
<div className="absolute inset-0 flex items-center justify-center pointer-events-none">
<div className="bg-ui-floating border border-ui-danger/50 rounded-ui-lg px-5 py-4 flex flex-col items-center space-y-2.5 pointer-events-auto shadow-ui-popover text-center max-w-xs">
- <p className="text-xs font-medium text-ui-danger">3D Viewport Unavailable</p>
+ <p className="text-xs font-medium text-ui-danger">{t('3D Viewport Unavailable')}</p>
<p className="text-[11px] text-ui-muted break-words">{webglError}</p>
<button
type="button"
onClick={onClose}
className="px-3 py-1 bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary rounded-ui-sm text-xs transition-colors cursor-pointer"
>
- Close
+ {t('Close')}
</button>
</div>
</div>
@@ -2314,9 +2321,9 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
<Box className="w-5 h-5" />
</div>
<div>
- <p className="text-xs font-medium text-ui-primary">3D Reference Stage</p>
+ <p className="text-xs font-medium text-ui-primary">{t('3D Reference Stage')}</p>
<p className="text-[11px] text-ui-muted mt-1">
- Drag &amp; drop a .glb, .gltf, or .obj model onto the canvas, or create a primitive.
+ {t('Drag & drop a .glb, .gltf, or .obj model onto the canvas, or create a primitive.')}
</p>
</div>
<button
@@ -2325,11 +2332,11 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
className="w-full flex items-center justify-center gap-1.5 px-3 py-1.5 bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm text-xs font-medium transition-opacity cursor-pointer"
>
<Upload className="w-3.5 h-3.5" />
- <span>Import 3D Model</span>
+ <span>{t('Import 3D Model')}</span>
</button>
<div className="w-full pt-2 border-t border-ui-subtle space-y-1.5">
<p className="text-[10px] uppercase tracking-wider text-ui-muted">
- Create Primitive
+ {t('Create Primitive')}
</p>
<div className="grid grid-cols-5 gap-1">
{PRIMITIVE_3D_ITEMS.map((item) => (
@@ -2337,12 +2344,12 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
key={item.type}
type="button"
onClick={() => createPrimitive(item.type)}
- title={item.description}
+ title={td(item.description)}
data-testid={`empty-3d-primitive-${item.type}`}
className="flex flex-col items-center justify-center gap-1 py-1.5 px-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
<Primitive3DIcon type={item.type} className="w-4 h-4 text-ui-accent" />
- <span className="text-[9px] leading-none">{item.label}</span>
+ <span className="text-[9px] leading-none">{td(item.label)}</span>
</button>
))}
</div>
diff --git a/src/components/MangaEffectsModal.tsx b/src/components/MangaEffectsModal.tsx
index 29a44d1..b9590ff 100644
--- a/src/components/MangaEffectsModal.tsx
+++ b/src/components/MangaEffectsModal.tsx
@@ -6,6 +6,7 @@ import {
SaturatedLinesOptions,
StreamLinesOptions,
} from '../utils/mangaEffectsEngine';
+import { isImeComposing, useI18n } from '../i18n';
interface MangaEffectsModalProps {
isOpen: boolean;
@@ -22,6 +23,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
canvasHeight,
onApply,
}) => {
+ const { t } = useI18n();
const [activeTab, setActiveTab] = useState<'saturated' | 'stream'>('saturated');
// Saturated Lines State
@@ -101,6 +103,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
@@ -154,13 +157,13 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
{/* Header */}
<div className="h-10 px-4 bg-ui-header border-b border-ui-subtle flex items-center justify-between">
<h2 id="manga-effects-modal-title" className="text-xs font-medium text-ui-primary">
- Manga Effect Lines
+ {t('Manga Effect Lines')}
</h2>
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 flex items-center justify-center rounded-ui-sm text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -178,7 +181,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
: 'border-transparent text-ui-muted hover:text-ui-primary'
}`}
>
- Saturated Lines (Focus / Burst)
+ {t('Saturated Lines (Focus / Burst)')}
</button>
<button
type="button"
@@ -189,7 +192,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
: 'border-transparent text-ui-muted hover:text-ui-primary'
}`}
>
- Stream Lines (Parallel Speed)
+ {t('Stream Lines (Parallel Speed)')}
</button>
</div>
@@ -204,12 +207,12 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
height={Math.round((300 * canvasHeight) / canvasWidth)}
onClick={handlePreviewClick}
className="cursor-crosshair block"
- title={activeTab === 'saturated' ? 'Click on preview to move focus center' : undefined}
+ title={activeTab === 'saturated' ? t('Click on preview to move focus center') : undefined}
/>
</div>
{activeTab === 'saturated' && (
<span className="text-[10px] text-ui-muted mt-1.5">
- Click preview to reposition focus point
+ {t('Click preview to reposition focus point')}
</span>
)}
</div>
@@ -220,7 +223,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Center Cutout Radius</span>
+ <span className="text-ui-muted">{t('Center Cutout Radius')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{satOptions.innerRadius}px</span>
</div>
<input
@@ -237,8 +240,8 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Line Density</span>
- <span className="font-ui-mono tabular-nums text-ui-primary">{satOptions.density} lines</span>
+ <span className="text-ui-muted">{t('Line Density')}</span>
+ <span className="font-ui-mono tabular-nums text-ui-primary">{t('{count} lines', { count: satOptions.density })}</span>
</div>
<input
type="range"
@@ -254,7 +257,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Stroke Width</span>
+ <span className="text-ui-muted">{t('Stroke Width')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{satOptions.lineWidth}px</span>
</div>
<input
@@ -271,7 +274,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Spacing & Depth Jitter</span>
+ <span className="text-ui-muted">{t('Spacing & Depth Jitter')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{Math.round(satOptions.spacingJitter * 100)}%</span>
</div>
<input
@@ -291,7 +294,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
</div>
<div className="flex items-center space-x-2 pt-1">
- <span className="text-[11px] text-ui-muted">Taper Direction</span>
+ <span className="text-[11px] text-ui-muted">{t('Taper Direction')}</span>
<button
type="button"
onClick={() => setSatOptions((p) => ({ ...p, taper: 'in' }))}
@@ -301,7 +304,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Point to Center
+ {t('Point to Center')}
</button>
<button
type="button"
@@ -312,7 +315,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Uniform
+ {t('Uniform')}
</button>
</div>
</>
@@ -320,7 +323,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Angle</span>
+ <span className="text-ui-muted">{t('Angle')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{streamOptions.angle}°</span>
</div>
<div className="flex items-center space-x-2">
@@ -351,8 +354,8 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Density</span>
- <span className="font-ui-mono tabular-nums text-ui-primary">{streamOptions.density} lines</span>
+ <span className="text-ui-muted">{t('Density')}</span>
+ <span className="font-ui-mono tabular-nums text-ui-primary">{t('{count} lines', { count: streamOptions.density })}</span>
</div>
<input
type="range"
@@ -368,7 +371,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Streak Length</span>
+ <span className="text-ui-muted">{t('Streak Length')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{streamOptions.lineLength}px</span>
</div>
<input
@@ -385,7 +388,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Thickness</span>
+ <span className="text-ui-muted">{t('Thickness')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{streamOptions.thickness}px</span>
</div>
<input
@@ -402,7 +405,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-ui-muted">Thickness & Length Noise</span>
+ <span className="text-ui-muted">{t('Thickness & Length Noise')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round(streamOptions.thicknessNoise * 100)}%
</span>
@@ -459,7 +462,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
}}
className="text-xs text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
>
- Reset Defaults
+ {t('Reset Defaults')}
</button>
<div className="flex items-center gap-2">
@@ -468,14 +471,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary font-medium rounded-ui-sm text-xs transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
onClick={handleApplyClick}
className="px-4 py-1.5 bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm text-xs font-medium transition-opacity cursor-pointer"
>
- Apply Effect
+ {t('Apply Effect')}
</button>
</div>
</div>
diff --git a/src/components/MenuBar.tsx b/src/components/MenuBar.tsx
index a53eeab..7cc2c8a 100644
--- a/src/components/MenuBar.tsx
+++ b/src/components/MenuBar.tsx
@@ -2,6 +2,7 @@ import React, { useState, useRef, useEffect, useCallback } from 'react';
import { createPortal } from 'react-dom';
import { ChevronRight, Check } from 'lucide-react';
import { MenuSection, MenuItem } from '../types/editor';
+import { useI18n } from '../i18n';
export const DEFAULT_MENU_SECTIONS: MenuSection[] = [
{ id: 'file', label: 'File', items: [] },
@@ -25,6 +26,7 @@ interface FloatingPosition {
}
export const MenuBar: React.FC<MenuBarProps> = React.memo(({ sections = DEFAULT_MENU_SECTIONS }) => {
+ const { t, tc } = useI18n();
const [activeMenuId, setActiveMenuId] = useState<string | null>(null);
const [activeSubmenuId, setActiveSubmenuId] = useState<string | null>(null);
const [focusedIndex, setFocusedIndex] = useState<number>(-1);
@@ -324,7 +326,7 @@ export const MenuBar: React.FC<MenuBarProps> = React.memo(({ sections = DEFAULT_
ref={containerRef}
className="flex items-center gap-0.5 relative z-50 shrink-0"
role="menubar"
- aria-label="Application Menu"
+ aria-label={t('Application Menu')}
>
{sections.map((section) => {
const isOpen = activeMenuId === section.id;
@@ -348,7 +350,7 @@ export const MenuBar: React.FC<MenuBarProps> = React.memo(({ sections = DEFAULT_
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {section.label}
+ {sections === DEFAULT_MENU_SECTIONS ? t(section.label) : section.label}
</button>
</div>
);
@@ -367,7 +369,7 @@ export const MenuBar: React.FC<MenuBarProps> = React.memo(({ sections = DEFAULT_
className="fixed min-w-[216px] max-h-[calc(100vh-44px)] overflow-y-auto bg-ui-elevated border border-ui-default rounded-ui-md p-1 z-[9998] text-[11px] text-ui-primary shadow-ui-popover select-none"
>
{activeSection.items.length === 0 ? (
- <div className="px-2.5 py-1.5 text-ui-muted">Empty</div>
+ <div className="px-2.5 py-1.5 text-ui-muted">{tc('menu', 'Empty')}</div>
) : (
activeSection.items.map((item, idx) => {
if (item.divider) {
diff --git a/src/components/ModalHost.tsx b/src/components/ModalHost.tsx
index 6140724..3bea754 100644
--- a/src/components/ModalHost.tsx
+++ b/src/components/ModalHost.tsx
@@ -39,6 +39,7 @@ import { CloseConfirmModal } from './CloseConfirmModal';
import { ConfirmDialogModal } from './ConfirmDialogModal';
import { FilterModal } from './FilterModal';
import { SaveDocumentResult } from '../utils/appCloseFlow';
+import { useI18n } from '../i18n';
export type InviteLinkPayload = ParsedCollabTarget;
@@ -189,6 +190,7 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
handleSaveDocumentById,
showToast,
}) => {
+ const { t } = useI18n();
const dimensions = useDocumentStore((s) => s.dimensions);
const documents = useDocumentStore((s) => s.documents);
const activeDocumentId = useDocumentStore((s) => s.activeDocumentId);
@@ -265,7 +267,7 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
initialHeight={activeDoc ? dimensions.height : (appSettings.defaultHeight || 1080)}
initialDpi={activeDoc ? (dimensions.dpi || 300) : (appSettings.defaultDpi || 300)}
initialColorMode={activeDoc ? colorMode : (appSettings.defaultColorMode || 'color')}
- initialName="Untitled*"
+ initialName={`${t('Untitled')}*`}
/>
<ResizeCanvasModal
@@ -333,7 +335,7 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
<LayerStylesModal
isOpen={layerStylesModalState.isOpen}
layerName={
- layers.find((l) => l.id === layerStylesModalState.layerId)?.name || 'Layer'
+ layers.find((l) => l.id === layerStylesModalState.layerId)?.name || t('Layer')
}
initialStyles={layers.find((l) => l.id === layerStylesModalState.layerId)?.styles}
onClose={() => uiStoreActions.setLayerStylesModalState({ isOpen: false })}
@@ -424,12 +426,12 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
<Loader2 className="w-4 h-4 text-ui-accent animate-spin" />
<div className="flex flex-col">
<span className="font-medium text-xs">
- {loadingStatus || 'Opening Document...'}
+ {loadingStatus || t('Opening Document...')}
</span>
<span className="text-ui-muted text-[10px]">
- {loadingStatus && /sav|export|composit|encod/i.test(loadingStatus)
- ? 'Processing layers and tile data'
- : 'Extracting layers and pixel data'}
+ {loadingStatus && /sav|export|composit|encod|保存|書き出|合成|エンコード/i.test(loadingStatus)
+ ? t('Processing layers and tile data')
+ : t('Extracting layers and pixel data')}
</span>
</div>
</div>
diff --git a/src/components/ModernPropertyBar.tsx b/src/components/ModernPropertyBar.tsx
index f95d708..2231c5c 100644
--- a/src/components/ModernPropertyBar.tsx
+++ b/src/components/ModernPropertyBar.tsx
@@ -8,6 +8,7 @@ import {
Blend,
} from 'lucide-react';
import { ToolType, BrushSettings } from '../types/editor';
+import { useI18n } from '../i18n';
interface ModernPropertyBarProps {
tool: ToolType;
@@ -37,10 +38,11 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
onOpenPresets,
isBrushEditorOpen = false,
}) => {
+ const { t, tc, td } = useI18n();
const currentSize = Math.round(brushSettings.size);
const currentOpacity = Math.round((brushSettings.opacity ?? 1) * 100);
const currentFlow = Math.round((brushSettings.flow ?? 1) * 100);
- const brushDisplayName = brushSettings.brushName || (brushSettings.preset as string) || 'Brush';
+ const brushDisplayName = td(brushSettings.brushName || (brushSettings.preset as string) || 'Brush');
return (
<div className="h-9 px-3 flex items-center justify-between text-xs select-none z-20 shrink-0 bg-ui-panel border-b border-ui-subtle text-ui-primary">
@@ -49,17 +51,17 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Presets Button */}
<button
onClick={onOpenPresets || onToggleBrushEditor}
- title="Browse Brush Presets"
+ title={t('Browse Brush Presets')}
className="flex items-center space-x-1 px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer text-xs"
>
<BookOpen className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Presets</span>
+ <span>{t('Presets')}</span>
</button>
{/* Active Brush Preset Pill */}
<button
onClick={onToggleBrushEditor}
- title="Current Brush Preset (Click to Toggle Editor)"
+ title={t('Current Brush Preset (Click to Toggle Editor)')}
className={`flex items-center space-x-1.5 px-2.5 py-1 rounded-ui-sm border text-xs transition-colors cursor-pointer ${
isBrushEditorOpen
? 'bg-ui-control-active border-ui-default text-ui-primary'
@@ -74,7 +76,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Brush Editor Button */}
<button
onClick={onToggleBrushEditor}
- title="Toggle Detailed Brush Settings & Dynamics"
+ title={t('Toggle Detailed Brush Settings & Dynamics')}
className={`flex items-center space-x-1 px-2.5 py-1 rounded-ui-sm border text-xs transition-colors cursor-pointer ${
isBrushEditorOpen
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -82,7 +84,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
}`}
>
<Sliders className="w-3.5 h-3.5" />
- <span>Brush Editor</span>
+ <span>{t('Brush Editor')}</span>
</button>
<span className="text-ui-disabled">|</span>
@@ -90,15 +92,15 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Mode Dropdown */}
<div className="flex items-center space-x-1.5 bg-ui-input border border-ui-subtle rounded-ui-sm px-2 py-0.5">
<Blend className="w-3.5 h-3.5 text-ui-muted" />
- <span className="text-[11px] text-ui-muted">Mode:</span>
+ <span className="text-[11px] text-ui-muted">{t('Mode:')}</span>
<select
defaultValue="source-over"
className="bg-transparent text-ui-primary text-xs font-medium outline-none cursor-pointer pr-1"
- title="Brush Blending Mode"
+ title={t('Brush Blending Mode')}
>
{BLEND_MODES.map((bm) => (
<option key={bm.value} value={bm.value} className="bg-ui-elevated text-ui-primary">
- {bm.label}
+ {tc('blendMode', bm.label)}
</option>
))}
</select>
@@ -106,7 +108,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Size Input */}
<div className="flex items-center space-x-1 bg-ui-input border border-ui-subtle rounded-ui-sm px-2 py-0.5">
- <span className="text-[11px] text-ui-muted">Size:</span>
+ <span className="text-[11px] text-ui-muted">{t('Size:')}</span>
<input
type="number"
min={1}
@@ -120,7 +122,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Opacity Input */}
<div className="flex items-center space-x-1 bg-ui-input border border-ui-subtle rounded-ui-sm px-2 py-0.5">
- <span className="text-[11px] text-ui-muted">Opacity:</span>
+ <span className="text-[11px] text-ui-muted">{t('Opacity:')}</span>
<input
type="number"
min={1}
@@ -138,7 +140,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
{/* Flow Input */}
<div className="flex items-center space-x-1 bg-ui-input border border-ui-subtle rounded-ui-sm px-2 py-0.5">
- <span className="text-[11px] text-ui-muted">Flow:</span>
+ <span className="text-[11px] text-ui-muted">{t('Flow:')}</span>
<input
type="number"
min={1}
@@ -159,7 +161,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
<div className="flex items-center space-x-1.5">
<button
onClick={onToggleBrushEditor}
- title="Tool Options & Presets"
+ title={t('Tool Options & Presets')}
className="p-1 rounded-ui-sm text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Settings className="w-3.5 h-3.5" />
diff --git a/src/components/NavigatorPanel.tsx b/src/components/NavigatorPanel.tsx
index 3378f92..d65ee78 100644
--- a/src/components/NavigatorPanel.tsx
+++ b/src/components/NavigatorPanel.tsx
@@ -37,6 +37,7 @@ import {
formatZoomPercent,
} from '../hooks/useCanvasNavigation';
import { IconButton, ScrubSlider, SegmentedControl, type ScrubSliderHandle } from './ui';
+import { useI18n } from '../i18n';
export const NAVIGATOR_PREVIEW_THROTTLE_MS = 120;
const PREVIEW_PADDING = 8;
@@ -268,6 +269,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
themePreset = 'modern',
throttleMs = NAVIGATOR_PREVIEW_THROTTLE_MS,
}) => {
+ const { t } = useI18n();
const storePreviewMode = useWorkspaceStore((s) => s.navigatorPreviewMode);
const storeSplitRatio = useWorkspaceStore((s) => s.navigatorSplitRatio);
const storeValueCheckEnabled = useDocumentStore((s) => s.valueCheckEnabled);
@@ -963,7 +965,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
? 'cursor-grabbing'
: 'cursor-grab'
}`}
- title="Click or drag red viewport frame to pan canvas"
+ title={t('Click or drag red viewport frame to pan canvas')}
>
<canvas
ref={previewCanvasRef}
@@ -990,7 +992,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
data-testid="nav-bw-badge"
className="pointer-events-none absolute top-1.5 left-1.5 z-10 px-1.5 py-0.5 rounded-ui-xs bg-ui-floating border border-ui-default shadow-ui-floating text-[9px] font-ui-mono uppercase tracking-wider text-ui-primary"
>
- B/W Tone
+ {t('B/W Tone')}
</span>
)}
@@ -1006,7 +1008,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
}}
className="pointer-events-none absolute z-10 px-1 py-[1px] rounded-ui-xs bg-ui-floating border border-ui-default text-[8px] font-ui-mono uppercase tracking-wider text-ui-primary"
>
- CLR
+ {t('CLR')}
</span>
)}
{splitRightWidth >= 28 && (
@@ -1018,14 +1020,14 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
}}
className="pointer-events-none absolute z-10 px-1 py-[1px] rounded-ui-xs bg-ui-floating border border-ui-default text-[8px] font-ui-mono uppercase tracking-wider text-ui-primary"
>
- B/W
+ {t('B/W')}
</span>
)}
<div
role="slider"
tabIndex={0}
data-testid="nav-split-handle"
- aria-label="Color and B/W Split Position"
+ aria-label={t('Color and B/W Split Position')}
aria-valuemin={5}
aria-valuemax={95}
aria-valuenow={Math.round(activeSplitRatio * 100)}
@@ -1035,7 +1037,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
onPointerCancel={finishSplitDrag}
onDoubleClick={handleSplitDoubleClick}
onKeyDown={handleSplitKeyDown}
- title="Drag to compare Color | B/W tones (Double-click to center 50%)"
+ title={t('Drag to compare Color | B/W tones (Double-click to center 50%)')}
style={{
left: `${splitLineLeft}px`,
top: `${m.offsetY}px`,
@@ -1073,10 +1075,10 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
data-testid="nav-canvas-value-badge"
onPointerDown={(e) => e.stopPropagation()}
onClick={handleToggleValueCheck}
- title="Main Canvas Value Check (Live B/W) is ON — Click to return main canvas to Color"
+ title={t('Main Canvas Value Check (Live B/W) is ON — Click to return main canvas to Color')}
className="absolute top-1.5 right-1.5 z-20 px-1.5 py-0.5 rounded-ui-xs bg-ui-floating hover:bg-ui-elevated border border-ui-accent-border shadow-ui-floating text-[9px] font-ui-mono uppercase tracking-wider text-ui-accent cursor-pointer transition-colors"
>
- Canvas B/W
+ {t('Canvas B/W')}
</button>
)}
</div>
@@ -1089,13 +1091,13 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
size="xs"
data-testid="nav-zoom-out"
onClick={onZoomOut}
- title="Zoom Out"
+ title={t('Zoom Out')}
icon={<ZoomOut className="w-3 h-3" />}
/>
<ScrubSlider
liveRef={zoomSliderRef}
data-testid="nav-zoom-slider"
- aria-label="Zoom"
+ aria-label={t('Zoom')}
min={MIN_ZOOM * 100}
max={MAX_ZOOM * 100}
step={1}
@@ -1114,7 +1116,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
size="xs"
data-testid="nav-zoom-in"
onClick={onZoomIn}
- title="Zoom In"
+ title={t('Zoom In')}
icon={<ZoomIn className="w-3 h-3" />}
/>
<span
@@ -1133,14 +1135,14 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
size="xs"
data-testid="nav-fit-screen"
onClick={onFitToScreen}
- title="Fit to Screen (Ctrl+0)"
+ title={t('Fit to Screen (Ctrl+0)')}
icon={<Maximize className="w-3 h-3" />}
/>
<IconButton
size="xs"
data-testid="nav-zoom-100"
onClick={onZoomActualSize}
- title="Reset Zoom to 100% (Ctrl+1)"
+ title={t('Reset Zoom to 100% (Ctrl+1)')}
label="100%"
className="px-1 font-ui-mono tabular-nums"
/>
@@ -1151,14 +1153,14 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
size="xs"
data-testid="nav-rotate-left"
onClick={onRotateLeft}
- title="Rotate Left (-15°)"
+ title={t('Rotate Left (-15°)')}
icon={<RotateCcw className="w-3 h-3" />}
/>
<IconButton
size="xs"
data-testid="nav-reset-rotation"
onClick={onResetRotation}
- title="Reset Canvas Angle (0°)"
+ title={t('Reset Canvas Angle (0°)')}
icon={<Compass className="w-2.5 h-2.5 opacity-70" />}
label={
<span ref={angleLabelRef} data-testid="nav-angle-readout">
@@ -1171,7 +1173,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
size="xs"
data-testid="nav-rotate-right"
onClick={onRotateRight}
- title="Rotate Right (+15°)"
+ title={t('Rotate Right (+15°)')}
icon={<RotateCw className="w-3 h-3" />}
/>
</div>
@@ -1182,7 +1184,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
data-testid="nav-flip-h"
active={flipX}
onClick={onToggleFlipHorizontal}
- title="Flip Horizontal View (Shift+H)"
+ title={t('Flip Horizontal View (Shift+H)')}
icon={<FlipHorizontal className="w-3 h-3" />}
/>
<IconButton
@@ -1190,7 +1192,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
data-testid="nav-flip-v"
active={flipY}
onClick={onToggleFlipVertical}
- title="Flip Vertical View (Shift+V)"
+ title={t('Flip Vertical View (Shift+V)')}
icon={<FlipVertical className="w-3 h-3" />}
/>
</div>
@@ -1201,29 +1203,30 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
<SegmentedControl<NavigatorPreviewMode>
size="xs"
selectionRole="button"
- aria-label="Navigator Preview Mode"
+ aria-label={t('Navigator Preview Mode')}
value={activePreviewMode}
onChange={handleSelectPreviewMode}
options={[
{
value: 'color',
- label: 'Color',
- title: 'Color Navigator Preview',
+ label: t('Color'),
+ title: t('Color Navigator Preview'),
'data-testid': 'nav-mode-color',
},
{
value: 'split',
- label: 'Split',
+ label: t('Split'),
icon: <Columns2 className="w-2.5 h-2.5" />,
- title: 'Split View — Compare Color & Live B/W Tones in Navigator (Alt+Shift+Y)',
+ title: t('Split View — Compare Color & Live B/W Tones in Navigator (Alt+Shift+Y)'),
accentOnActive: true,
'data-testid': 'nav-mode-split',
},
{
value: 'bw',
- label: 'B/W',
- title:
- 'Live B/W Preview in Navigator — Paint in color on main canvas while monitoring B/W values in real time',
+ label: t('B/W'),
+ title: t(
+ 'Live B/W Preview in Navigator — Paint in color on main canvas while monitoring B/W values in real time'
+ ),
accentOnActive: true,
className: 'font-ui-mono',
'data-testid': 'nav-mode-bw',
@@ -1237,9 +1240,9 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
data-testid="nav-value-check"
active={isValueCheckEnabled}
onClick={handleToggleValueCheck}
- title="1-Click Value Check — Toggle Live B/W Tone Check on Main Canvas (Shift+Y)"
+ title={t('1-Click Value Check — Toggle Live B/W Tone Check on Main Canvas (Shift+Y)')}
icon={<Contrast className="w-3 h-3" />}
- label="Value"
+ label={t('Value')}
className="font-medium"
/>
</div>
diff --git a/src/components/NewCanvasModal.tsx b/src/components/NewCanvasModal.tsx
index b994ee3..d521fa3 100644
--- a/src/components/NewCanvasModal.tsx
+++ b/src/components/NewCanvasModal.tsx
@@ -11,6 +11,7 @@ import {
AlertTriangle,
} from 'lucide-react';
import { CanvasColorMode, NewCanvasOptions } from '../types/editor';
+import { isImeComposing, useI18n } from '../i18n';
export type ProjectCategory = 'illustration' | 'manga' | 'webtoon' | 'custom';
type PresetTabCategory = Exclude<ProjectCategory, 'custom'>;
@@ -373,6 +374,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
initialColorMode = 'color',
initialName = 'Untitled*',
}) => {
+ const { t, tc, td } = useI18n();
const titleId = useId();
const nameInputId = useId();
const widthInputId = useId();
@@ -644,6 +646,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
onClose();
@@ -689,15 +692,15 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<div className="flex items-center gap-2">
<FilePlus className="w-3.5 h-3.5 text-ui-accent" />
<h2 id={titleId} className="text-xs font-medium text-ui-primary">
- New Canvas
+ {t('New Canvas')}
</h2>
</div>
<button
type="button"
onClick={onClose}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Close (Esc)"
- aria-label="Close new canvas dialog"
+ title={t('Close (Esc)')}
+ aria-label={t('Close new canvas dialog')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -724,7 +727,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
}`}
>
<span className={active ? 'text-ui-accent' : ''}>{tab.icon}</span>
- <span className="truncate">{tab.label}</span>
+ <span className="truncate">{td(tab.label)}</span>
</button>
);
})}
@@ -748,10 +751,10 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
>
<div className="min-w-0">
<div className="flex items-center gap-1.5">
- <span className="text-xs font-medium truncate">{preset.name}</span>
+ <span className="text-xs font-medium truncate">{td(preset.name)}</span>
{preset.defaultMode === 'monochrome' && (
<span className="text-[9px] font-ui-mono px-1 py-0.25 rounded-ui-xs bg-ui-input border border-ui-subtle text-ui-muted shrink-0">
- MONO
+ {t('MONO')}
</span>
)}
</div>
@@ -819,14 +822,14 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
{/* Document Name */}
<section className="space-y-1.5">
<label htmlFor={nameInputId} className="text-[11px] font-medium text-ui-muted block">
- Document Name
+ {t('Document Name')}
</label>
<input
id={nameInputId}
type="text"
value={documentName}
onChange={(e) => setDocumentName(e.target.value)}
- placeholder="Untitled"
+ placeholder={t('Untitled')}
className="w-full px-2.5 py-1.5 text-xs bg-ui-input border border-ui-default rounded-ui-sm text-ui-primary placeholder:text-ui-muted/60"
/>
</section>
@@ -834,7 +837,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
{/* Dimensions + Unit + Orientation */}
<section className="space-y-2">
<div className="flex items-center justify-between gap-2">
- <span className="text-[11px] font-medium text-ui-muted">Dimensions</span>
+ <span className="text-[11px] font-medium text-ui-muted">{t('Dimensions')}</span>
<div className="inline-flex bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm gap-0.5">
{UNITS.map((u) => (
<button
@@ -856,7 +859,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<div className="flex items-end gap-1.5">
<div className="flex-1 space-y-1">
<label htmlFor={widthInputId} className="text-[10px] text-ui-muted block">
- Width ({unit})
+ {t('Width ({unit})', { unit })}
</label>
<input
id={widthInputId}
@@ -875,7 +878,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
type="button"
onClick={handleToggleLockRatio}
aria-pressed={lockRatio}
- title={lockRatio ? 'Aspect ratio locked' : 'Lock aspect ratio'}
+ title={lockRatio ? t('Aspect ratio locked') : t('Lock aspect ratio')}
className={`h-[30px] w-[30px] shrink-0 rounded-ui-sm border flex items-center justify-center transition-colors cursor-pointer ${
lockRatio
? 'bg-ui-accent-subtle border-ui-accent-border text-ui-accent'
@@ -887,7 +890,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<div className="flex-1 space-y-1">
<label htmlFor={heightInputId} className="text-[10px] text-ui-muted block">
- Height ({unit})
+ {t('Height ({unit})', { unit })}
</label>
<input
id={heightInputId}
@@ -908,8 +911,8 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
type="button"
onClick={() => handleSetOrientation('portrait')}
disabled={width === height}
- title="Portrait orientation"
- aria-label="Portrait orientation"
+ title={t('Portrait orientation')}
+ aria-label={t('Portrait orientation')}
aria-pressed={isPortrait}
className={`h-full px-2 rounded-ui-xs flex items-center justify-center transition-colors ${
width === height
@@ -925,8 +928,8 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
type="button"
onClick={() => handleSetOrientation('landscape')}
disabled={width === height}
- title="Landscape orientation"
- aria-label="Landscape orientation"
+ title={t('Landscape orientation')}
+ aria-label={t('Landscape orientation')}
aria-pressed={isLandscape}
className={`h-full px-2 rounded-ui-xs flex items-center justify-center transition-colors ${
width === height
@@ -944,7 +947,9 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
{isLargeCanvas && (
<div className="flex items-center gap-1.5 text-[11px] text-ui-warning pt-0.5 tabular-nums">
<AlertTriangle className="w-3 h-3 shrink-0" />
- <span>Large canvas ({megapixels} MP) — may increase memory usage.</span>
+ <span>
+ {t('Large canvas ({mp} MP) — may increase memory usage.', { mp: megapixels })}
+ </span>
</div>
)}
</section>
@@ -953,10 +958,16 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<section className="space-y-1.5">
<div className="flex items-center justify-between">
<label htmlFor={dpiInputId} className="text-[11px] font-medium text-ui-muted">
- Resolution (DPI)
+ {t('Resolution (DPI)')}
</label>
<span className="text-[10px] font-ui-mono text-ui-muted">
- {dpi <= 96 ? 'Screen' : dpi < 300 ? 'Draft' : dpi < 600 ? 'Print' : 'Manga / Hi-Res'}
+ {dpi <= 96
+ ? tc('dpiPreset', 'Screen')
+ : dpi < 300
+ ? t('Draft')
+ : dpi < 600
+ ? t('Print')
+ : t('Manga / Hi-Res')}
</span>
</div>
@@ -989,7 +1000,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
value={dpiDraft}
onChange={(e) => handleDpiInputChange(e.target.value)}
onBlur={handleDpiBlur}
- aria-label="Custom DPI"
+ aria-label={t('Custom DPI')}
className="w-full px-2 py-1.5 bg-ui-input border border-ui-default rounded-ui-sm font-ui-mono tabular-nums text-xs text-center text-ui-primary"
/>
</div>
@@ -998,7 +1009,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
{/* Color Mode */}
<section className="space-y-2">
- <span className="text-[11px] font-medium text-ui-muted block">Color Mode</span>
+ <span className="text-[11px] font-medium text-ui-muted block">{t('Color Mode')}</span>
<div className="grid grid-cols-3 gap-1.5">
{(
@@ -1035,7 +1046,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<span
className={`w-2.5 h-2.5 rounded-full shrink-0 border border-ui-default ${item.swatch}`}
/>
- <span>{item.label}</span>
+ <span>{td(item.label)}</span>
</button>
);
})}
@@ -1045,7 +1056,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<div className="bg-ui-header border border-ui-subtle rounded-ui-md p-2.5 space-y-2">
<div className="flex items-center justify-between">
<label htmlFor={freqInputId} className="text-[11px] text-ui-muted">
- Screentone Frequency
+ {t('Screentone Frequency')}
</label>
<span className="text-[11px] font-ui-mono tabular-nums text-ui-primary">
{defaultFrequency} LPI
@@ -1102,9 +1113,9 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
{/* Paper Background */}
<section className="space-y-1.5">
<div className="flex items-center justify-between">
- <span className="text-[11px] font-medium text-ui-muted">Background</span>
+ <span className="text-[11px] font-medium text-ui-muted">{t('Background')}</span>
<span className="text-[10px] font-ui-mono text-ui-muted">
- {isTransparent ? 'Transparent' : backgroundColor.toUpperCase()}
+ {isTransparent ? t('Transparent') : backgroundColor.toUpperCase()}
</span>
</div>
@@ -1141,7 +1152,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
}}
/>
)}
- <span>{swatch.label}</span>
+ <span>{td(swatch.label)}</span>
</button>
);
})}
@@ -1162,8 +1173,8 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
setBackgroundColor(hex);
}}
className="w-4 h-4 cursor-pointer bg-transparent border-0 p-0 rounded-ui-xs shrink-0"
- title="Pick custom background color"
- aria-label="Custom background color picker"
+ title={t('Pick custom background color')}
+ aria-label={t('Custom background color picker')}
/>
<input
type="text"
@@ -1181,7 +1192,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
setCustomHex(backgroundColor);
}
}}
- aria-label="Custom background hex color"
+ aria-label={t('Custom background hex color')}
className="w-[58px] bg-ui-input font-ui-mono text-[11px] text-ui-primary px-1 py-0.5 rounded-ui-xs"
/>
</div>
@@ -1196,7 +1207,7 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
<kbd className="px-1.5 py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary font-ui-mono text-[10px]">
Enter
</kbd>{' '}
- to create
+ {t('to create')}
</span>
<div className="flex items-center gap-2 ml-auto">
@@ -1205,14 +1216,14 @@ export const NewCanvasModal: React.FC<NewCanvasModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary text-xs font-medium transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
onClick={handleCreate}
className="px-4 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-xs font-medium transition-opacity hover:opacity-90 cursor-pointer flex items-center gap-1.5"
>
- <span>Create Canvas</span>
+ <span>{t('Create Canvas')}</span>
</button>
</div>
</div>
diff --git a/src/components/PenPathOverlay.tsx b/src/components/PenPathOverlay.tsx
index dd5da95..e218325 100644
--- a/src/components/PenPathOverlay.tsx
+++ b/src/components/PenPathOverlay.tsx
@@ -5,6 +5,7 @@ import type {
PenToolSettings,
} from '../types/editor';
import { buildBezierSvgPath } from '../utils/bezierEngine';
+import { useI18n } from '../i18n';
export interface PenPathOverlayProps {
dimensions: CanvasDimensions;
@@ -34,6 +35,7 @@ export const PenPathOverlay: React.FC<PenPathOverlayProps> = React.memo(
onCancel,
onToggleClose,
}) => {
+ const { t, tc } = useI18n();
const { knots, closed, selectedAnchorIndex, hoverPoint } = session;
if (knots.length === 0) return null;
@@ -185,7 +187,9 @@ export const PenPathOverlay: React.FC<PenPathOverlayProps> = React.memo(
}}
>
<span className="text-[10px] text-ui-muted px-1 font-ui-mono tabular-nums">
- {knots.length}pt{closed ? ' · Closed' : ''}
+ {closed
+ ? t('{count}pt · Closed', { count: knots.length })
+ : t('{count}pt', { count: knots.length })}
</span>
{knots.length >= 2 && (
<button
@@ -193,7 +197,7 @@ export const PenPathOverlay: React.FC<PenPathOverlayProps> = React.memo(
onClick={onToggleClose}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] transition-colors cursor-pointer"
>
- {closed ? 'Open' : 'Close'}
+ {closed ? tc('action', 'Open') : tc('action', 'Close')}
</button>
)}
{knots.length >= 2 && (
@@ -202,7 +206,7 @@ export const PenPathOverlay: React.FC<PenPathOverlayProps> = React.memo(
onClick={onCommit}
className="px-2 py-0.5 rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[10px] font-medium transition-opacity cursor-pointer"
>
- Commit
+ {t('Commit')}
</button>
)}
<button
@@ -210,7 +214,7 @@ export const PenPathOverlay: React.FC<PenPathOverlayProps> = React.memo(
onClick={onCancel}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</div>
</>
diff --git a/src/components/PerformanceSettingsTab.tsx b/src/components/PerformanceSettingsTab.tsx
index 19ee7e5..a83b8f1 100644
--- a/src/components/PerformanceSettingsTab.tsx
+++ b/src/components/PerformanceSettingsTab.tsx
@@ -38,6 +38,7 @@ import {
memoryPercentToMb,
performanceManager,
} from '../utils/performanceManager';
+import { useI18n } from '../i18n';
interface PerformanceSettingsTabProps {
settings: AppSettings;
@@ -72,6 +73,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
onUpdateSettings,
onShowToast,
}) => {
+ const { t, tc, td, lang } = useI18n();
// Defensive merge so hot-reloaded or legacy partial settings objects never have undefined fields
const settings: AppSettings = useMemo(
() => ({
@@ -106,8 +108,8 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}, []);
const refreshTelemetry = useCallback(async () => {
- const t = await performanceManager.getMemoryTelemetry();
- setTelemetry(t);
+ const memTelemetry = await performanceManager.getMemoryTelemetry();
+ setTelemetry(memTelemetry);
}, []);
useEffect(() => {
@@ -140,7 +142,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
},
}
),
- [hwInfo, totalRamMb, cpuCores]
+ [hwInfo, totalRamMb, cpuCores, lang]
);
const currentBudgetMb = Math.max(
@@ -167,7 +169,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
autoOptimizePerformance: true,
});
if (showFeedback) {
- onShowToast(`Automatic optimization enabled (${rec.summary})`);
+ onShowToast(t('Automatic optimization enabled ({summary})', { summary: rec.summary }));
}
};
@@ -186,7 +188,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
...presetPatch,
autoOptimizePerformance: false,
});
- onShowToast(`Switched to "${label}" mode`);
+ onShowToast(t('Switched to "{mode}" mode', { mode: t(label) }));
};
const handlePercentSliderChange = (nextPct: number) => {
@@ -214,12 +216,18 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
const res = await performanceManager.purgeMemory(scope);
await refreshTelemetry();
const parts: string[] = [];
- if (res.freedTileMb > 0) parts.push(`${res.freedTileMb} MB tiles`);
- if (res.offloadedUndoSteps > 0) parts.push(`${res.offloadedUndoSteps} undo steps`);
- if (res.flushedGpuTextures) parts.push('GPU cache');
- if (res.freedScratchDiskMb > 0) parts.push(`${res.freedScratchDiskMb} MB scratch`);
+ if (res.freedTileMb > 0) parts.push(t('{mb} MB tiles', { mb: res.freedTileMb }));
+ if (res.offloadedUndoSteps > 0) {
+ parts.push(t('{n} undo steps', { n: res.offloadedUndoSteps }));
+ }
+ if (res.flushedGpuTextures) parts.push(t('GPU cache'));
+ if (res.freedScratchDiskMb > 0) {
+ parts.push(t('{mb} MB scratch', { mb: res.freedScratchDiskMb }));
+ }
onShowToast(
- parts.length > 0 ? `Freed ${parts.join(', ')}` : 'Memory caches are already clean'
+ parts.length > 0
+ ? t('Freed {items}', { items: parts.join(', ') })
+ : t('Memory caches are already clean')
);
} finally {
setIsPurging(false);
@@ -233,7 +241,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
const candidate: AppSettings = { ...settings, scratchDiskPath: nextPath.trim() };
const result = await performanceManager.syncDesktopBackendConfig(candidate);
if (!result.ok) {
- setScratchError(result.error || 'Unable to validate scratch disk directory');
+ setScratchError(result.error || t('Unable to validate scratch disk directory'));
return;
}
if (result.info) {
@@ -242,8 +250,8 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
onUpdateSettings(candidate);
onShowToast(
nextPath.trim()
- ? 'Scratch disk location updated'
- : 'Scratch disk reset to system temporary folder'
+ ? t('Scratch disk location updated')
+ : t('Scratch disk reset to system temporary folder')
);
} finally {
setIsApplyingScratch(false);
@@ -258,14 +266,16 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
await relaunch();
} catch (err) {
onShowToast(
- err instanceof Error ? `Restart failed: ${err.message}` : 'Please restart Ink Studio manually'
+ err instanceof Error
+ ? t('Restart failed: {message}', { message: err.message })
+ : t('Please restart Ink Studio manually')
);
}
};
const needsRestart = performanceManager.needsRestartForDesktopGpuFlags(settings);
const activeRendererName =
- telemetry?.compositor?.rendererName || hwInfo?.activeWebGl?.renderer || 'Detecting...';
+ telemetry?.compositor?.rendererName || hwInfo?.activeWebGl?.renderer || t('Detecting...');
const activeRendererLower = activeRendererName.toLowerCase();
const activePoolSpec =
GPU_TEXTURE_POOL_CONFIGS[settings.gpuTexturePoolPreset] ?? GPU_TEXTURE_POOL_CONFIGS.high;
@@ -291,17 +301,19 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<Sparkles className="w-4 h-4 text-ui-accent mt-0.5 shrink-0" />
<div className="min-w-0">
<div className="flex items-center gap-2">
- <h3 className="text-xs font-medium text-ui-primary">Automatic Settings</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Automatic Settings')}</h3>
{isAutoMode && (
<span className="text-[10px] px-1.5 py-0.5 rounded-ui-xs bg-ui-success/15 text-ui-success border border-ui-success/30 font-medium">
- Active
+ {tc('status', 'Active')}
</span>
)}
</div>
<p className="text-[11px] text-ui-muted mt-0.5">
{isAutoMode
- ? `Automatically tuned for your hardware: ${recommended.summary}`
- : 'Custom settings active. Turn on to let Ink Studio tune RAM, GPU, and caches automatically.'}
+ ? t('Automatically tuned for your hardware: {summary}', {
+ summary: recommended.summary,
+ })
+ : t('Custom settings active. Turn on to let Ink Studio tune RAM, GPU, and caches automatically.')}
</p>
</div>
</div>
@@ -309,7 +321,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<label className="flex items-center gap-2 shrink-0 cursor-pointer pt-0.5">
<input
type="checkbox"
- aria-label="Automatic performance settings"
+ aria-label={t('Automatic performance settings')}
checked={isAutoMode}
onChange={(e) => handleToggleAuto(e.target.checked)}
/>
@@ -327,7 +339,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Auto
+ {t('Auto')}
</button>
<button
type="button"
@@ -338,7 +350,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Performance
+ {t('Performance')}
</button>
<button
type="button"
@@ -349,7 +361,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Battery
+ {t('Battery')}
</button>
<button
type="button"
@@ -360,20 +372,20 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- CPU Safe
+ {t('CPU Safe')}
</button>
</div>
{/* Compact System Strip */}
<div className="flex items-center justify-between gap-2 pt-2 border-t border-ui-subtle text-[10px] text-ui-muted font-ui-mono tabular-nums">
<div className="flex items-center gap-2 min-w-0 truncate">
- <span>{formatMb(totalRamMb)} RAM</span>
+ <span>{t('{ram} RAM', { ram: formatMb(totalRamMb) })}</span>
<span>·</span>
- <span>{cpuCores} threads</span>
+ <span>{t('{count} threads', { count: cpuCores })}</span>
<span>·</span>
<span className="truncate text-ui-secondary" title={activeRendererName}>
{telemetry?.compositor?.backend === 'canvas2d'
- ? 'Canvas 2D (CPU)'
+ ? t('Canvas 2D (CPU)')
: activeRendererName}
</span>
</div>
@@ -385,7 +397,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}}
disabled={isRefreshingHw}
className="p-1 rounded-ui-xs hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary cursor-pointer shrink-0 disabled:opacity-50"
- title="Refresh hardware & memory telemetry"
+ title={t('Refresh hardware & memory telemetry')}
>
<RefreshCw className={`w-3 h-3 ${isRefreshingHw ? 'animate-spin' : ''}`} />
</button>
@@ -397,12 +409,12 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-2">
<MemoryStick className="w-3.5 h-3.5 text-ui-accent" />
- <h3 className="text-xs font-medium text-ui-primary">Memory Usage (Max RAM)</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Memory Usage (Max RAM)')}</h3>
</div>
<div className="flex items-center gap-1.5 shrink-0">
<input
type="number"
- aria-label="Maximum RAM in MB"
+ aria-label={t('Maximum RAM in MB')}
min={memLimits.minMb}
max={memLimits.maxMb}
step={128}
@@ -419,7 +431,10 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div
className="absolute top-0 bottom-0 bg-ui-success/20 border-x border-ui-success/45"
style={{ left: `${idealLeftPct}%`, width: `${idealWidthPct}%` }}
- title={`Ideal range: ${formatMb(memLimits.idealMinMb)} – ${formatMb(memLimits.idealMaxMb)}`}
+ title={t('Ideal range: {min} – {max}', {
+ min: formatMb(memLimits.idealMinMb),
+ max: formatMb(memLimits.idealMaxMb),
+ })}
/>
<div
className="h-full rounded-full transition-all duration-150"
@@ -432,7 +447,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<input
type="range"
- aria-label="RAM allocation percentage"
+ aria-label={t('RAM allocation percentage')}
min={20}
max={85}
step={1}
@@ -444,7 +459,10 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center justify-between text-[10px] font-ui-mono tabular-nums text-ui-muted">
<span>{formatMb(memLimits.minMb)}</span>
<span className="text-ui-success">
- Ideal: {formatMb(memLimits.idealMinMb)} – {formatMb(memLimits.idealMaxMb)}
+ {t('Ideal: {min} – {max}', {
+ min: formatMb(memLimits.idealMinMb),
+ max: formatMb(memLimits.idealMaxMb),
+ })}
</span>
<span>{formatMb(memLimits.maxMb)}</span>
</div>
@@ -453,7 +471,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{isOverIdeal && (
<div className="flex items-center gap-1.5 text-[10px] text-ui-warning bg-ui-warning/15 border border-ui-warning/35 rounded-ui-sm px-2 py-1">
<AlertTriangle className="w-3 h-3 shrink-0" />
- <span>Above 70% of system RAM may slow down other apps.</span>
+ <span>{t('Above 70% of system RAM may slow down other apps.')}</span>
</div>
)}
@@ -461,18 +479,22 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center justify-between gap-2 pt-2 border-t border-ui-subtle">
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted truncate">
{telemetry
- ? `In use: ${telemetry.activeTileMb} MB tiles · ${telemetry.ramUndoSteps} undo · ~${telemetry.compositor.estimatedVramMb} MB VRAM`
- : 'Measuring memory usage...'}
+ ? t('In use: {tileMb} MB tiles · {undoSteps} undo · ~{vramMb} MB VRAM', {
+ tileMb: telemetry.activeTileMb,
+ undoSteps: telemetry.ramUndoSteps,
+ vramMb: telemetry.compositor.estimatedVramMb,
+ })
+ : t('Measuring memory usage...')}
</div>
<button
type="button"
disabled={isPurging}
onClick={() => void handlePurge('all')}
className="flex items-center gap-1 px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary font-medium cursor-pointer shrink-0 disabled:opacity-50 transition-colors"
- title="Offload inactive tiles & undo states and flush GPU texture cache"
+ title={t('Offload inactive tiles & undo states and flush GPU texture cache')}
>
<Trash2 className="w-3 h-3 text-ui-accent" />
- <span>Free Memory</span>
+ <span>{t('Free Memory')}</span>
</button>
</div>
</section>
@@ -481,7 +503,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<section className="rounded-ui-md bg-ui-header p-3.5 space-y-3 border border-ui-subtle">
<div className="flex items-center gap-2">
<Monitor className="w-3.5 h-3.5 text-ui-accent" />
- <h3 className="text-xs font-medium text-ui-primary">Graphics & Rendering</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Graphics & Rendering')}</h3>
</div>
<div className="grid grid-cols-3 gap-1.5">
@@ -504,16 +526,16 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {opt.label}
+ {t(opt.label)}
</button>
);
})}
</div>
<div className="flex items-center justify-between gap-3 pt-2 border-t border-ui-subtle">
- <span className="text-xs text-ui-primary">Graphics Card</span>
+ <span className="text-xs text-ui-primary">{t('Graphics Card')}</span>
<select
- aria-label="Graphics Card Preference"
+ aria-label={t('Graphics Card Preference')}
disabled={settings.renderBackend === 'canvas2d'}
value={settings.gpuPowerPreference}
onChange={(e) =>
@@ -521,9 +543,9 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}
className="bg-ui-input text-ui-primary text-xs px-2.5 py-1.5 rounded-ui-sm border border-ui-default cursor-pointer disabled:opacity-40"
>
- <option value="high-performance">High-Performance (Dedicated)</option>
- <option value="low-power">Power-Saving (Integrated)</option>
- <option value="default">System Default</option>
+ <option value="high-performance">{t('High-Performance (Dedicated)')}</option>
+ <option value="low-power">{t('Power-Saving (Integrated)')}</option>
+ <option value="default">{t('System Default')}</option>
</select>
</div>
@@ -531,7 +553,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{hwInfo && Array.isArray(hwInfo.gpus) && hwInfo.gpus.length > 0 && (
<div className="space-y-1 pt-2 border-t border-ui-subtle">
{hwInfo.gpus.map((gpu) => {
- const gpuName = gpu.name || 'Graphics Adapter';
+ const gpuName = gpu.name || t('Graphics Adapter');
const isActive =
telemetry?.compositor?.backend === 'webgl2' &&
gpuName.length > 0 &&
@@ -548,14 +570,14 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center gap-1.5 min-w-0">
<span className="text-ui-primary truncate">{gpuName}</span>
<span className="text-[9px] px-1.5 py-0.5 rounded-ui-xs bg-ui-header border border-ui-subtle text-ui-muted font-ui-mono tabular-nums shrink-0">
- {formatGpuKindLabel(gpu.kind)}
+ {t(formatGpuKindLabel(gpu.kind))}
{gpu.vramMb > 0 ? ` · ${formatMb(gpu.vramMb)}` : ''}
</span>
</div>
{isActive && (
<span className="flex items-center gap-1 text-[10px] font-medium text-ui-success shrink-0">
<Check className="w-3 h-3" />
- Active
+ {t('Active')}
</span>
)}
</div>
@@ -567,7 +589,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{needsRestart && (
<div className="flex items-center justify-between gap-2 p-2 rounded-ui-sm bg-ui-warning/15 border border-ui-warning/35 text-[11px]">
<span className="text-ui-warning">
- Restart Ink Studio to apply the OS-level GPU preference.
+ {t('Restart Ink Studio to apply the OS-level GPU preference.')}
</span>
<button
type="button"
@@ -575,7 +597,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
className="flex items-center gap-1 px-2.5 py-1 rounded-ui-xs bg-ui-accent text-ui-accent-contrast font-medium shrink-0 cursor-pointer hover:opacity-90"
>
<RotateCw className="w-3 h-3" />
- <span>Restart</span>
+ <span>{t('Restart')}</span>
</button>
</div>
)}
@@ -592,9 +614,9 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center gap-2">
<SlidersHorizontal className="w-3.5 h-3.5 text-ui-icon-muted" />
<div>
- <span className="text-xs font-medium text-ui-primary">Advanced Settings</span>
+ <span className="text-xs font-medium text-ui-primary">{t('Advanced Settings')}</span>
<span className="ml-2 text-[10px] text-ui-muted">
- VRAM Cache, HiDPI, Undo, CPU Threads & Scratch Disk
+ {t('VRAM Cache, HiDPI, Undo, CPU Threads & Scratch Disk')}
</span>
</div>
</div>
@@ -610,14 +632,14 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{/* GPU & Display Tuning */}
<div className="space-y-2.5">
<div className="text-[10px] uppercase tracking-wider text-ui-muted font-medium">
- GPU & Display
+ {t('GPU & Display')}
</div>
<div className="space-y-1.5">
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-primary">GPU Tile Cache (VRAM)</span>
+ <span className="text-xs text-ui-primary">{t('GPU Tile Cache (VRAM)')}</span>
<span className="font-ui-mono tabular-nums text-[10px] text-ui-muted">
- {activePoolSpec.arrayLayers} slices
+ {t('{count} slices', { count: activePoolSpec.arrayLayers })}
</span>
</div>
<div className="grid grid-cols-4 gap-1.5">
@@ -636,7 +658,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {spec.label}
+ {td(spec.label)}
</button>
);
})}
@@ -644,9 +666,9 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
</div>
<div className="flex items-center justify-between gap-3">
- <span className="text-xs text-ui-primary">Viewport Resolution (HiDPI)</span>
+ <span className="text-xs text-ui-primary">{t('Viewport Resolution (HiDPI)')}</span>
<select
- aria-label="Viewport Resolution Scaling"
+ aria-label={t('Viewport Resolution Scaling')}
value={settings.viewportResolutionScale}
onChange={(e) =>
patchManual({
@@ -655,17 +677,17 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}
className="bg-ui-input text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default cursor-pointer"
>
- <option value="native">Native Display DPI</option>
- <option value="capped-2x">Capped 2× (Recommended)</option>
- <option value="1x">Standard 1× (High FPS)</option>
- <option value="0.75x">Performance 0.75×</option>
+ <option value="native">{t('Native Display DPI')}</option>
+ <option value="capped-2x">{t('Capped 2× (Recommended)')}</option>
+ <option value="1x">{t('Standard 1× (High FPS)')}</option>
+ <option value="0.75x">{t('Performance 0.75×')}</option>
</select>
</div>
<div className="flex items-center justify-between gap-3">
- <span className="text-xs text-ui-primary">Zoom Texture Filtering</span>
+ <span className="text-xs text-ui-primary">{t('Zoom Texture Filtering')}</span>
<select
- aria-label="Canvas Texture Filtering"
+ aria-label={t('Canvas Texture Filtering')}
value={settings.canvasFilteringQuality}
onChange={(e) =>
patchManual({
@@ -674,34 +696,34 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}
className="bg-ui-input text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default cursor-pointer"
>
- <option value="auto">Auto (Crisp ≥200%)</option>
- <option value="smooth">Always Smooth</option>
- <option value="pixelated">Always Sharp (Nearest)</option>
+ <option value="auto">{t('Auto (Crisp ≥200%)')}</option>
+ <option value="smooth">{t('Always Smooth')}</option>
+ <option value="pixelated">{t('Always Sharp (Nearest)')}</option>
</select>
</div>
{isDesktopTauri && (
<div className="flex items-center justify-between gap-3">
- <span className="text-xs text-ui-primary">Desktop Graphics API (ANGLE)</span>
+ <span className="text-xs text-ui-primary">{t('Desktop Graphics API (ANGLE)')}</span>
<select
- aria-label="Desktop Graphics API"
+ aria-label={t('Desktop Graphics API')}
value={settings.desktopGraphicsApi}
onChange={(e) =>
patchManual({ desktopGraphicsApi: e.target.value as DesktopGraphicsApi })
}
className="bg-ui-input text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default cursor-pointer"
>
- <option value="auto">Auto (OS Default)</option>
+ <option value="auto">{t('Auto (OS Default)')}</option>
<option value="d3d11">Direct3D 11</option>
<option value="vulkan">Vulkan</option>
<option value="gl">OpenGL</option>
- <option value="warp">WARP (Software)</option>
+ <option value="warp">{t('WARP (Software)')}</option>
</select>
</div>
)}
<label className="flex items-center justify-between py-0.5 cursor-pointer">
- <span className="text-xs text-ui-primary">GPU Brush Acceleration</span>
+ <span className="text-xs text-ui-primary">{t('GPU Brush Acceleration')}</span>
<input
type="checkbox"
disabled={settings.renderBackend === 'canvas2d'}
@@ -711,7 +733,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
</label>
<label className="flex items-center justify-between py-0.5 cursor-pointer">
- <span className="text-xs text-ui-primary">Baked Layer Stack Cache</span>
+ <span className="text-xs text-ui-primary">{t('Baked Layer Stack Cache')}</span>
<input
type="checkbox"
disabled={settings.renderBackend === 'canvas2d'}
@@ -724,12 +746,12 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{/* Undo & Multi-Tab Memory */}
<div className="space-y-2.5 pt-3 border-t border-ui-subtle">
<div className="text-[10px] uppercase tracking-wider text-ui-muted font-medium">
- Undo & Multi-Document Memory
+ {t('Undo & Multi-Document Memory')}
</div>
<div className="space-y-1">
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-primary">Max History States</span>
+ <span className="text-xs text-ui-primary">{t('Max History States')}</span>
<span className="font-ui-mono tabular-nums text-[11px] text-ui-primary">
{settings.maxHistorySteps}
</span>
@@ -754,14 +776,14 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="space-y-1">
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-primary">In-RAM Undo Steps</span>
+ <span className="text-xs text-ui-primary">{t('In-RAM Undo Steps')}</span>
<span className="font-ui-mono tabular-nums text-[11px] text-ui-primary">
- {settings.undoRamSteps} steps
+ {t('{n} steps', { n: settings.undoRamSteps })}
</span>
</div>
<input
type="range"
- aria-label="In-RAM undo steps"
+ aria-label={t('In-RAM undo steps')}
min={4}
max={50}
step={1}
@@ -772,7 +794,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
</div>
<label className="flex items-center justify-between py-0.5 cursor-pointer">
- <span className="text-xs text-ui-primary">Offload Inactive Document Tabs</span>
+ <span className="text-xs text-ui-primary">{t('Offload Inactive Document Tabs')}</span>
<input
type="checkbox"
checked={settings.offloadInactiveTabs}
@@ -781,7 +803,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
</label>
<div className="flex items-center justify-between gap-2 pt-1">
- <span className="text-[10px] text-ui-muted">Granular Cache Purge</span>
+ <span className="text-[10px] text-ui-muted">{t('Granular Cache Purge')}</span>
<div className="flex items-center gap-1.5">
<button
type="button"
@@ -789,7 +811,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
onClick={() => void handlePurge('tiles')}
className="px-2 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer disabled:opacity-50 transition-colors"
>
- Tiles
+ {t('Tiles')}
</button>
<button
type="button"
@@ -797,7 +819,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
onClick={() => void handlePurge('undo')}
className="px-2 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer disabled:opacity-50 transition-colors"
>
- Undo
+ {t('Undo')}
</button>
<button
type="button"
@@ -814,14 +836,14 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
{/* 3D & CPU Threading */}
<div className="space-y-2.5 pt-3 border-t border-ui-subtle">
<div className="text-[10px] uppercase tracking-wider text-ui-muted font-medium">
- 3D & CPU
+ {t('3D & CPU')}
</div>
<div className="flex items-center justify-between gap-3">
- <span className="text-xs text-ui-primary">3D Preview Resolution</span>
+ <span className="text-xs text-ui-primary">{t('3D Preview Resolution')}</span>
<div className="flex items-center gap-2">
<select
- aria-label="3D Preview Resolution Cap"
+ aria-label={t('3D Preview Resolution Cap')}
value={settings.preview3DMaxResolution}
onChange={(e) =>
patchManual({
@@ -849,16 +871,16 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<>
<div className="space-y-1">
<div className="flex items-center justify-between">
- <span className="text-xs text-ui-primary">CPU Worker Threads</span>
+ <span className="text-xs text-ui-primary">{t('CPU Worker Threads')}</span>
<span className="font-ui-mono tabular-nums text-[11px] text-ui-primary">
{workerThreadsValue === 0
- ? `Auto (${cpuCores})`
+ ? t('Auto ({cores})', { cores: cpuCores })
: `${workerThreadsValue} / ${cpuCores}`}
</span>
</div>
<input
type="range"
- aria-label="CPU worker threads"
+ aria-label={t('CPU worker threads')}
min={0}
max={cpuCores}
step={1}
@@ -869,7 +891,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
</div>
<label className="flex items-center justify-between py-0.5 cursor-pointer">
- <span className="text-xs text-ui-primary">Native Rust Acceleration</span>
+ <span className="text-xs text-ui-primary">{t('Native Rust Acceleration')}</span>
<input
type="checkbox"
checked={settings.useNativeRustAcceleration}
@@ -887,15 +909,15 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
<div className="flex items-center justify-between">
<span className="text-[10px] uppercase tracking-wider text-ui-muted font-medium flex items-center gap-1.5">
<HardDrive className="w-3 h-3" />
- <span>Scratch Disk</span>
+ <span>{t('Scratch Disk')}</span>
</span>
<span
className="font-ui-mono tabular-nums text-[10px] text-ui-muted truncate max-w-[260px]"
- title={hwInfo?.scratchDiskPath}
+ title={hwInfo?.scratchDiskPath ? td(hwInfo.scratchDiskPath) : undefined}
>
- {hwInfo?.scratchDiskPath || 'System Temp'}
+ {hwInfo?.scratchDiskPath ? td(hwInfo.scratchDiskPath) : t('System Temp')}
{isDesktopTauri && hwInfo && hwInfo.scratchDiskFreeMb > 0
- ? ` · ${formatMb(hwInfo.scratchDiskFreeMb)} free`
+ ? t(' · {size} free', { size: formatMb(hwInfo.scratchDiskFreeMb) })
: ''}
</span>
</div>
@@ -910,7 +932,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
setScratchPathInput(e.target.value);
setScratchError(null);
}}
- placeholder="Custom folder (optional, e.g. secondary SSD)"
+ placeholder={t('Custom folder (optional, e.g. secondary SSD)')}
className="flex-1 bg-ui-input px-2.5 py-1 rounded-ui-sm font-ui-mono text-[11px] text-ui-primary placeholder:text-ui-muted/60 border border-ui-default"
/>
<button
@@ -919,7 +941,7 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
onClick={() => void handleApplyScratchPath(scratchPathInput)}
className="px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] text-ui-primary font-medium cursor-pointer shrink-0 disabled:opacity-50 transition-colors"
>
- Apply
+ {t('Apply')}
</button>
{settings.scratchDiskPath && (
<button
@@ -931,16 +953,16 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}}
className="px-2 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary cursor-pointer shrink-0 transition-colors"
>
- Reset
+ {t('Reset')}
</button>
)}
</div>
{scratchError && <div className="text-[10px] text-ui-danger">{scratchError}</div>}
<div className="flex items-center justify-between gap-3">
- <span className="text-xs text-ui-primary">Scratch Compression</span>
+ <span className="text-xs text-ui-primary">{t('Scratch Compression')}</span>
<select
- aria-label="Scratch Disk Compression"
+ aria-label={t('Scratch Disk Compression')}
value={settings.scratchDiskCompression}
onChange={(e) =>
patchManual({
@@ -949,8 +971,8 @@ export const PerformanceSettingsTab: React.FC<PerformanceSettingsTabProps> = ({
}
className="bg-ui-input text-ui-primary text-xs px-2 py-1 rounded-ui-sm border border-ui-default cursor-pointer"
>
- <option value="lz4">LZ4 Fast (Recommended)</option>
- <option value="none">Uncompressed</option>
+ <option value="lz4">{t('LZ4 Fast (Recommended)')}</option>
+ <option value="none">{t('Uncompressed')}</option>
</select>
</div>
</>
diff --git a/src/components/PerspectiveRulerOverlay.tsx b/src/components/PerspectiveRulerOverlay.tsx
index bb796aa..79f0118 100644
--- a/src/components/PerspectiveRulerOverlay.tsx
+++ b/src/components/PerspectiveRulerOverlay.tsx
@@ -21,6 +21,7 @@ import {
ChevronDown,
X,
} from 'lucide-react';
+import { useI18n } from '../i18n';
interface PerspectiveRulerOverlayProps {
ruler: PerspectiveRuler;
@@ -79,6 +80,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
viewportRef,
activeLockedAxis = null,
}) => {
+ const { t, tc, td } = useI18n();
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const [isPresetsOpen, setIsPresetsOpen] = useState<boolean>(false);
const [activeDragTarget, setActiveDragTarget] = useState<string | null>(null);
@@ -406,7 +408,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{/* Horizon Line / Eye Level Pill Handle in Canvas Center */}
<div
onPointerDown={startHorizonDrag}
- title="Drag vertically to adjust Eye Level height"
+ title={t('Drag vertically to adjust Eye Level height')}
className="pointer-events-auto absolute -translate-x-1/2 -translate-y-1/2 cursor-ns-resize z-30 group"
style={{
left: `${horizonCenterScreen.x}px`,
@@ -416,7 +418,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<div className="flex items-center space-x-1.5 px-3 py-1 bg-ui-floating text-ui-primary border border-ui-default rounded-full shadow-ui-floating transition-transform hover:scale-105 active:scale-95">
<div className="w-1.5 h-1.5 rounded-full bg-ui-accent" />
<span className="text-[10px] font-ui-mono tabular-nums font-bold tracking-tight whitespace-nowrap">
- Eye Level {Math.round(horizon.angle)}°
+ {t('Eye Level {angle}°', { angle: Math.round(horizon.angle) })}
</span>
</div>
</div>
@@ -440,13 +442,14 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
sPos.x <= vRect.width - 28 &&
sPos.y >= 28 &&
sPos.y <= vRect.height - 28;
+ const localizedVpLabel = td(vp.label);
if (isInside) {
return (
<div
key={`handle-vp-${vp.id}`}
onPointerDown={(e) => startVpDrag(e, vp.id)}
- title={`Drag ${vp.label} Vanishing Point`}
+ title={t('Drag {label} Vanishing Point', { label: localizedVpLabel })}
className="pointer-events-auto absolute -translate-x-1/2 -translate-y-1/2 cursor-grab active:cursor-grabbing z-30"
style={{ left: `${sPos.x}px`, top: `${sPos.y}px` }}
>
@@ -454,7 +457,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<div className="w-2 h-2 rounded-full bg-black" />
</div>
<div className="absolute top-full left-1/2 -translate-x-1/2 mt-1 px-1.5 py-0.5 bg-ui-floating border border-ui-default text-ui-primary shadow-ui-floating rounded-ui-xs text-[9px] font-ui-mono whitespace-nowrap pointer-events-none">
- {vp.label}
+ {localizedVpLabel}
</div>
</div>
);
@@ -475,12 +478,15 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<div
key={`edge-vp-${vp.id}`}
onPointerDown={(e) => startVpDrag(e, vp.id)}
- title={`Drag to reposition ${vp.label} (${Math.round(dist)}px off-screen)`}
+ title={t('Drag to reposition {label} ({dist}px off-screen)', {
+ label: localizedVpLabel,
+ dist: Math.round(dist),
+ })}
className="pointer-events-auto absolute -translate-x-1/2 -translate-y-1/2 cursor-grab active:cursor-grabbing z-30"
style={{ left: `${edgePos.x}px`, top: `${edgePos.y}px` }}
>
<div className="flex items-center space-x-1 px-2 py-0.5 bg-ui-floating text-ui-primary border border-ui-default rounded-ui-sm shadow-ui-floating text-[10px] font-ui-mono tabular-nums font-semibold hover:bg-ui-control-hover transition-transform hover:scale-105 active:scale-95">
- <span>{vp.label}</span>
+ <span>{localizedVpLabel}</span>
<span className="text-[9px] text-ui-muted font-normal">
{Math.round(dist)}px
</span>
@@ -499,7 +505,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{/* Toggle Ruler Visibility */}
<button
onClick={() => onUpdateRuler({ ...ruler, enabled: !ruler.enabled })}
- title={ruler.enabled ? 'Hide Perspective Ruler' : 'Show Perspective Ruler'}
+ title={ruler.enabled ? t('Hide Perspective Ruler') : t('Show Perspective Ruler')}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
ruler.enabled
? 'bg-ui-accent-subtle text-ui-accent'
@@ -512,14 +518,18 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{/* Snap to Perspective Toggle */}
<button
onClick={() => onUpdateRuler({ ...ruler, snapEnabled: !ruler.snapEnabled })}
- title={`Perspective Snapping: ${ruler.snapEnabled ? 'ENABLED' : 'DISABLED'} (Hold Alt to freehand)`}
+ title={
+ ruler.snapEnabled
+ ? t('Perspective Snapping: ENABLED (Hold Alt to freehand)')
+ : t('Perspective Snapping: DISABLED (Hold Alt to freehand)')
+ }
className={`px-2 py-1 rounded-ui-xs font-medium transition-colors cursor-pointer ${
ruler.snapEnabled
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-ui-accent-border'
: 'bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- Snap {ruler.snapEnabled ? 'ON' : 'OFF'}
+ {ruler.snapEnabled ? t('Snap ON') : t('Snap OFF')}
</button>
<div className="w-px h-4 bg-ui-subtle" />
@@ -528,19 +538,25 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<div className="flex bg-ui-input p-0.5 rounded-ui-sm border border-ui-subtle">
{(['1-point', '2-point', '3-point'] as PerspectiveType[]).map((mode) => {
const label = mode === '1-point' ? '1P' : mode === '2-point' ? '2P' : '3P';
+ const modeTitle =
+ mode === '1-point'
+ ? t('1P Perspective')
+ : mode === '2-point'
+ ? t('2P Perspective')
+ : t('3P Perspective');
const isActive = ruler.type === mode;
return (
<button
key={mode}
onClick={() => handleSwitchType(mode)}
- title={`${label} Perspective`}
+ title={modeTitle}
className={`px-2 py-0.5 text-[11px] font-medium rounded-ui-xs transition-colors cursor-pointer ${
isActive
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {label}
+ {tc('perspective', label)}
</button>
);
})}
@@ -549,9 +565,9 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{/* Ray Count Stepper */}
<div
className="flex items-center space-x-1 px-1.5 py-0.5 rounded-ui-sm bg-ui-input border border-ui-subtle text-ui-primary text-[11px]"
- title="Number of Guide Rays per Vanishing Point"
+ title={t('Number of Guide Rays per Vanishing Point')}
>
- <span className="text-[10px] text-ui-muted select-none">Lines</span>
+ <span className="text-[10px] text-ui-muted select-none">{tc('perspective', 'Lines')}</span>
<button
onClick={() =>
onUpdateRuler({
@@ -561,7 +577,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
}
disabled={(ruler.guideRayCount || 6) <= 2}
className="w-4 h-4 flex items-center justify-center rounded-ui-xs bg-ui-control hover:bg-ui-control-hover disabled:opacity-30 disabled:pointer-events-none text-ui-primary font-ui-mono text-xs cursor-pointer"
- title="Decrease Guide Rays"
+ title={t('Decrease Guide Rays')}
>
-
</button>
@@ -577,7 +593,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
}
disabled={(ruler.guideRayCount || 6) >= 16}
className="w-4 h-4 flex items-center justify-center rounded-ui-xs bg-ui-control hover:bg-ui-control-hover disabled:opacity-30 disabled:pointer-events-none text-ui-primary font-ui-mono text-xs cursor-pointer"
- title="Increase Guide Rays"
+ title={t('Increase Guide Rays')}
>
+
</button>
@@ -588,8 +604,8 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
onClick={() => onUpdateRuler({ ...ruler, locked: !ruler.locked })}
title={
ruler.locked
- ? 'Ruler Locked (Handles frozen to prevent misclicks while inking)'
- : 'Ruler Unlocked (Drag handles or eye level to adjust perspective)'
+ ? t('Ruler Locked (Handles frozen to prevent misclicks while inking)')
+ : t('Ruler Unlocked (Drag handles or eye level to adjust perspective)')
}
className={`px-2 py-1 rounded-ui-xs font-medium transition-colors cursor-pointer ${
ruler.locked
@@ -597,17 +613,17 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
: 'bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {ruler.locked ? 'Locked' : 'Edit'}
+ {ruler.locked ? t('Locked') : t('Edit')}
</button>
{/* Presets Dropdown */}
<div className="relative">
<button
onClick={() => setIsPresetsOpen((prev) => !prev)}
- title="Preset Perspective Angles"
+ title={t('Preset Perspective Angles')}
className="flex items-center space-x-1 px-2 py-1 rounded-ui-xs bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
- <span>Presets</span>
+ <span>{t('Presets')}</span>
<ChevronDown className="w-3 h-3" />
</button>
@@ -617,29 +633,29 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
onClick={() => handleApplyPreset('1p-center')}
className="w-full text-left px-3 py-1.5 hover:bg-ui-control-hover text-ui-primary flex items-center justify-between cursor-pointer"
>
- <span>1-Point Center</span>
- <span className="text-[10px] text-ui-muted">1 VP</span>
+ <span>{t('1-Point Center')}</span>
+ <span className="text-[10px] text-ui-muted">{t('1 VP')}</span>
</button>
<button
onClick={() => handleApplyPreset('2p-wide')}
className="w-full text-left px-3 py-1.5 hover:bg-ui-control-hover text-ui-primary flex items-center justify-between cursor-pointer"
>
- <span>2-Point Street (Wide)</span>
- <span className="text-[10px] text-ui-muted">2 VPs</span>
+ <span>{t('2-Point Street (Wide)')}</span>
+ <span className="text-[10px] text-ui-muted">{t('2 VPs')}</span>
</button>
<button
onClick={() => handleApplyPreset('3p-birds')}
className="w-full text-left px-3 py-1.5 hover:bg-ui-control-hover text-ui-primary flex items-center justify-between cursor-pointer"
>
- <span>3-Point Bird's-Eye</span>
- <span className="text-[10px] text-ui-muted">High Angle</span>
+ <span>{t("3-Point Bird's-Eye")}</span>
+ <span className="text-[10px] text-ui-muted">{t('High Angle')}</span>
</button>
<button
onClick={() => handleApplyPreset('3p-worms')}
className="w-full text-left px-3 py-1.5 hover:bg-ui-control-hover text-ui-primary flex items-center justify-between cursor-pointer"
>
- <span>3-Point Worm's-Eye</span>
- <span className="text-[10px] text-ui-muted">Low Angle</span>
+ <span>{t("3-Point Worm's-Eye")}</span>
+ <span className="text-[10px] text-ui-muted">{t('Low Angle')}</span>
</button>
</div>
)}
@@ -649,7 +665,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{onRemoveRuler && (
<button
onClick={onRemoveRuler}
- title="Remove Perspective Ruler from Canvas"
+ title={t('Remove Perspective Ruler from Canvas')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-danger hover:bg-ui-danger/15 transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
diff --git a/src/components/PigmentBlendControl.tsx b/src/components/PigmentBlendControl.tsx
index b6a4955..83b20c2 100644
--- a/src/components/PigmentBlendControl.tsx
+++ b/src/components/PigmentBlendControl.tsx
@@ -5,6 +5,7 @@ import {
rgbToHex,
} from '../utils/colorMixingEngine';
import { ScrubSlider } from './ui';
+import { useI18n } from '../i18n';
export interface PigmentBlendControlProps {
/** Whether physical spectral pigment blending is active (false = Regular RGB). */
@@ -79,6 +80,7 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
variant = 'compact',
showPreview = true,
}) => {
+ const { t } = useI18n();
const [pairIndex, setPairIndex] = useState<number>(0);
const pairs = useMemo<SwatchPair[]>(() => {
@@ -111,6 +113,9 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
);
const isStudio = variant === 'studio';
+ const translatedLabel = t(label);
+ const translatedStrengthLabel = t(strengthLabel);
+ const translatedPairLabel = t(activePair.label);
return (
<div className={isStudio ? 'space-y-2.5' : 'space-y-1.5'}>
@@ -123,7 +128,7 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
: 'text-[11px] text-ui-muted truncate'
}
>
- {label}
+ {translatedLabel}
</span>
<span
className={`px-1.5 py-[1px] rounded-full text-[9px] font-medium tracking-wide border transition-colors ${
@@ -132,14 +137,14 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
: 'bg-ui-control text-ui-muted border-ui-subtle'
}`}
>
- {enabled ? 'Pigment' : 'RGB'}
+ {enabled ? t('Pigment') : 'RGB'}
</span>
</div>
{/* Regular vs Pigment segmented switch */}
<div
role="radiogroup"
- aria-label={label}
+ aria-label={translatedLabel}
className="grid grid-cols-2 gap-0.5 rounded-ui-sm p-0.5 border bg-ui-input border-ui-subtle"
>
<button
@@ -162,7 +167,7 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
opacity: !enabled ? 0.9 : 0.45,
}}
/>
- <span>Regular</span>
+ <span>{t('Regular')}</span>
</button>
<button
@@ -185,7 +190,7 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
opacity: enabled ? 1 : 0.55,
}}
/>
- <span>Pigment</span>
+ <span>{t('Pigment')}</span>
</button>
</div>
@@ -194,7 +199,16 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
<button
type="button"
onClick={() => setPairIndex((i) => (i + 1) % pairs.length)}
- title={`${activePair.label} (${enabled ? `Pigment ${strengthPct}%` : 'Regular RGB'}) — Click to cycle preview colors`}
+ title={
+ enabled
+ ? t('{pair} (Pigment {pct}%) — Click to cycle preview colors', {
+ pair: translatedPairLabel,
+ pct: strengthPct,
+ })
+ : t('{pair} (Regular RGB) — Click to cycle preview colors', {
+ pair: translatedPairLabel,
+ })
+ }
className="group relative w-full rounded-ui-sm overflow-hidden border border-ui-default hover:border-ui-strong transition-colors cursor-pointer block focus:outline-none focus:ring-1 focus:ring-ui-focus"
style={{ height: isStudio ? 22 : 17 }}
>
@@ -204,10 +218,10 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
/>
<div className="pointer-events-none absolute inset-x-1.5 inset-y-0 flex items-center justify-between">
<span className="text-[9px] font-medium text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.85)] opacity-85 group-hover:opacity-100 transition-opacity">
- {activePair.label}
+ {translatedPairLabel}
</span>
<span className="text-[8.5px] font-ui-mono uppercase tracking-wider text-white/95 bg-black/50 px-1 rounded-ui-xs opacity-90 group-hover:opacity-100 transition-opacity">
- {enabled ? 'Pigment' : 'Regular'}
+ {enabled ? t('Pigment') : t('Regular')}
</span>
</div>
</button>
@@ -217,7 +231,7 @@ export const PigmentBlendControl: React.FC<PigmentBlendControlProps> = React.mem
{enabled && onStrengthChange && (
<div className="pt-0.5">
<ScrubSlider
- label={strengthLabel}
+ label={translatedStrengthLabel}
value={strengthPct}
min={0}
max={100}
diff --git a/src/components/PressureCurveEditor.tsx b/src/components/PressureCurveEditor.tsx
index e74a184..a8d5f25 100644
--- a/src/components/PressureCurveEditor.tsx
+++ b/src/components/PressureCurveEditor.tsx
@@ -8,6 +8,7 @@ import {
samplePressureCurve,
sanitizePressureCurvePoints,
} from '../utils/pressureCurve';
+import { useI18n } from '../i18n';
interface PressureCurveEditorProps {
value: PressureCurveSettings;
@@ -43,6 +44,7 @@ function fromClientToNorm(
}
export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value, onChange }) => {
+ const { t, tc } = useI18n();
const svgRef = useRef<SVGSVGElement | null>(null);
const testCanvasRef = useRef<HTMLCanvasElement | null>(null);
const draggingIdxRef = useRef<number | null>(null);
@@ -299,9 +301,9 @@ export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value,
<section className="space-y-3">
<div className="flex items-center justify-between">
<div>
- <h3 className="text-xs font-medium text-ui-primary">Global Pen Pressure Curve</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Global Pen Pressure Curve')}</h3>
<p className="text-[11px] text-ui-muted">
- Click curve to add point, drag to adjust, double-click interior point to remove
+ {t('Click curve to add point, drag to adjust, double-click interior point to remove')}
</p>
</div>
<label className="flex items-center gap-1.5 text-[11px] text-ui-primary cursor-pointer">
@@ -310,7 +312,7 @@ export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value,
checked={value.enabled}
onChange={(e) => onChange({ ...value, enabled: e.target.checked })}
/>
- <span>Enabled</span>
+ <span>{t('Enabled')}</span>
</label>
</div>
@@ -329,13 +331,16 @@ export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value,
: 'bg-ui-header text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {preset}
+ {tc('pressure', preset)}
</button>
);
})}
{liveSample && (
<span className="ml-auto font-ui-mono tabular-nums text-[10px] text-ui-muted">
- In {Math.round(liveSample.input * 100)}% {'->'} Out {Math.round(liveSample.output * 100)}%
+ {t('In {inPct}% -> Out {outPct}%', {
+ inPct: Math.round(liveSample.input * 100),
+ outPct: Math.round(liveSample.output * 100),
+ })}
</span>
)}
</div>
@@ -449,8 +454,8 @@ export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value,
})}
</svg>
<div className="w-full flex justify-between px-2 pt-0.5 text-[9px] font-ui-mono tabular-nums text-ui-muted">
- <span>Input 0%</span>
- <span>Output Y / Input X</span>
+ <span>{t('Input 0%')}</span>
+ <span>{t('Output Y / Input X')}</span>
<span>100%</span>
</div>
</div>
@@ -459,19 +464,19 @@ export const PressureCurveEditor: React.FC<PressureCurveEditorProps> = ({ value,
<div className="bg-ui-header border border-ui-subtle rounded-ui-md p-2.5 flex flex-col justify-between gap-2">
<div className="flex items-center justify-between">
<div>
- <div className="text-[11px] font-medium text-ui-primary">Live Stylus Test Strip</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Live Stylus Test Strip')}</div>
<div className="text-[10px] text-ui-muted">
- Draw with pen (or drag left-to-right with mouse) to test size & opacity
+ {t('Draw with pen (or drag left-to-right with mouse) to test size & opacity')}
</div>
</div>
<button
type="button"
onClick={clearTestCanvas}
className="flex items-center gap-1 px-2 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
- title="Clear test strip"
+ title={t('Clear test strip')}
>
<Trash2 className="w-3 h-3" />
- <span>Clear</span>
+ <span>{t('Clear')}</span>
</button>
</div>
<canvas
diff --git a/src/components/QuickAccessPanel.tsx b/src/components/QuickAccessPanel.tsx
index 56cc1b8..341dc24 100644
--- a/src/components/QuickAccessPanel.tsx
+++ b/src/components/QuickAccessPanel.tsx
@@ -45,6 +45,7 @@ import {
renderCommandIcon,
} from './CommandBar';
import { LiquifyIcon } from './LiquifyIcon';
+import { useI18n } from '../i18n';
const QUICK_TOOL_CATALOG: Array<{ id: ToolType; label: string }> = [
{ id: 'brush', label: 'Brush' },
@@ -115,6 +116,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
handlers,
themePreset = 'modern',
}) => {
+ const { t, td } = useI18n();
const items = useWorkspaceStore((s) => s.quickAccessItems);
const viewMode = useWorkspaceStore((s) => s.quickAccessViewMode);
const palettesHidden = useWorkspaceStore((s) => s.palettesHidden);
@@ -196,7 +198,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<button
type="button"
onClick={() => workspaceStoreActions.setQuickAccessViewMode('grid')}
- title="Grid View"
+ title={t('Grid View')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
viewMode === 'grid'
? 'bg-ui-control-active text-ui-accent'
@@ -208,7 +210,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<button
type="button"
onClick={() => workspaceStoreActions.setQuickAccessViewMode('list')}
- title="List View"
+ title={t('List View')}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
viewMode === 'list'
? 'bg-ui-control-active text-ui-accent'
@@ -223,7 +225,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<button
type="button"
onClick={handleAddCurrentColor}
- title={`Pin Primary Color (${primaryColor})`}
+ title={t('Pin Primary Color ({color})', { color: primaryColor })}
className="h-5 px-1 rounded-ui-xs flex items-center gap-1 text-[10px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer transition-colors"
>
<span
@@ -236,7 +238,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<button
type="button"
onClick={() => setIsEditing((v) => !v)}
- title="Customize Quick Access"
+ title={t('Customize Quick Access')}
className={`h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] border transition-colors cursor-pointer ${
isEditing
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -244,7 +246,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
}`}
>
<SlidersHorizontal className="w-3 h-3" />
- <span>{isEditing ? 'Done' : 'Edit'}</span>
+ <span>{isEditing ? t('Done') : t('Edit')}</span>
</button>
</div>
</div>
@@ -253,7 +255,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<div className="flex-1 min-h-0 overflow-y-auto p-1.5">
{items.length === 0 ? (
<div className="p-3 text-center text-[11px] text-ui-muted">
- No shortcuts. Click Edit to add tools, commands, brushes, or colors.
+ {t('No shortcuts. Click Edit to add tools, commands, brushes, or colors.')}
</div>
) : viewMode === 'grid' && !isEditing ? (
<div className="grid grid-cols-[repeat(auto-fill,minmax(46px,1fr))] gap-1">
@@ -272,6 +274,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
migrateLegacyPresetId(item.brushPresetId) === activePresetId &&
isPaintTool(activeTool)) ||
(item.kind === 'color' && item.color?.toLowerCase() === primaryColor.toLowerCase());
+ const displayLabel = td(item.label);
return (
<button
@@ -279,7 +282,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
type="button"
disabled={disabled}
onClick={() => handleActivateItem(item)}
- title={item.label}
+ title={displayLabel}
className={`h-11 px-1 rounded-ui-sm flex flex-col items-center justify-center gap-1 transition-colors ${
disabled
? 'opacity-35 cursor-not-allowed bg-ui-input text-ui-disabled border border-ui-subtle'
@@ -298,7 +301,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
)}
{item.kind === 'brush' && <Paintbrush className="w-3.5 h-3.5 shrink-0" />}
<span className="text-[9px] leading-tight truncate max-w-full">
- {item.label}
+ {displayLabel}
</span>
</button>
);
@@ -322,6 +325,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
migrateLegacyPresetId(item.brushPresetId) === activePresetId &&
isPaintTool(activeTool)) ||
(item.kind === 'color' && item.color?.toLowerCase() === primaryColor.toLowerCase()));
+ const displayLabel = td(item.label);
return (
<div
@@ -349,7 +353,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
/>
)}
{item.kind === 'brush' && <Paintbrush className="w-3.5 h-3.5 shrink-0" />}
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{displayLabel}</span>
</button>
{isEditing && (
@@ -358,7 +362,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
type="button"
disabled={idx === 0}
onClick={() => workspaceStoreActions.moveQuickAccessItem(item.id, -1)}
- title="Move Up"
+ title={t('Move Up')}
className="p-0.5 text-ui-icon-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronUp className="w-3 h-3" />
@@ -367,7 +371,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
type="button"
disabled={idx === items.length - 1}
onClick={() => workspaceStoreActions.moveQuickAccessItem(item.id, 1)}
- title="Move Down"
+ title={t('Move Down')}
className="p-0.5 text-ui-icon-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronDown className="w-3 h-3" />
@@ -375,7 +379,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<button
type="button"
onClick={() => workspaceStoreActions.removeQuickAccessItem(item.id)}
- title="Remove"
+ title={t('Remove')}
className="p-0.5 text-ui-icon-muted hover:text-ui-danger cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -405,14 +409,14 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {tab}s
+ {t(`${tab}s`)}
</button>
))}
</div>
<button
type="button"
onClick={() => workspaceStoreActions.resetQuickAccessItems()}
- title="Reset Quick Access to defaults"
+ title={t('Reset Quick Access to defaults')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-warning hover:bg-ui-control-hover cursor-pointer transition-colors"
>
<RotateCcw className="w-3 h-3" />
@@ -426,7 +430,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
className="flex-1 py-1 px-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 cursor-pointer transition-colors"
>
<Palette className="w-3 h-3" />
- <span>+ Color</span>
+ <span>{t('+ Color')}</span>
</button>
<button
type="button"
@@ -434,7 +438,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
className="flex-1 py-1 px-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 cursor-pointer transition-colors"
>
<Paintbrush className="w-3 h-3" />
- <span>+ Brush</span>
+ <span>{t('+ Brush')}</span>
</button>
</div>
@@ -449,23 +453,23 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
>
<span className="flex items-center gap-1.5 truncate">
{renderCommandIcon(cmd.id)}
- <span className="truncate">{cmd.label}</span>
+ <span className="truncate">{td(cmd.label)}</span>
</span>
<Plus className="w-3 h-3 text-ui-icon-muted shrink-0" />
</button>
))}
{addTab === 'tool' &&
- QUICK_TOOL_CATALOG.map((t) => (
+ QUICK_TOOL_CATALOG.map((tool) => (
<button
- key={t.id}
+ key={tool.id}
type="button"
- onClick={() => handleAddTool(t.id, t.label)}
+ onClick={() => handleAddTool(tool.id, tool.label)}
className="w-full flex items-center justify-between px-1.5 py-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
>
<span className="flex items-center gap-1.5 truncate">
- {renderToolIcon(t.id)}
- <span className="truncate">{t.label}</span>
+ {renderToolIcon(tool.id)}
+ <span className="truncate">{t(tool.label)}</span>
</span>
<Plus className="w-3 h-3 text-ui-icon-muted shrink-0" />
</button>
@@ -488,7 +492,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
>
<span className="flex items-center gap-1.5 truncate">
<Paintbrush className="w-3 h-3 shrink-0" />
- <span className="truncate">{b.name}</span>
+ <span className="truncate">{td(b.name)}</span>
</span>
<Plus className="w-3 h-3 text-ui-icon-muted shrink-0" />
</button>
diff --git a/src/components/QuickBrushPanel.tsx b/src/components/QuickBrushPanel.tsx
index 0cf9c8d..c4bfd02 100644
--- a/src/components/QuickBrushPanel.tsx
+++ b/src/components/QuickBrushPanel.tsx
@@ -37,6 +37,7 @@ import {
} from '../utils/quickBrushUtils';
import { BrushPreview } from './BrushPreview';
import { QuickBrushPanelSettings } from './QuickBrushPanelSettings';
+import { isImeComposing, useI18n } from '../i18n';
export interface QuickBrushPanelProps {
customBrushes: CspBrush[];
@@ -192,6 +193,7 @@ const BrushTipThumbnail: React.FC<{
BrushTipThumbnail.displayName = 'BrushTipThumbnail';
export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ customBrushes }) => {
+ const { t, td } = useI18n();
const config = useWorkspaceStore((s) => s.quickBrushPanel);
const palettesHidden = useWorkspaceStore((s) => s.palettesHidden);
const autoFadeInFocus = useWorkspaceStore(
@@ -286,6 +288,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
setTileContextMenu(null);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setTileContextMenu(null);
};
window.addEventListener('mousedown', handleOutside);
@@ -371,16 +374,17 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
const incomingBrushId = e.dataTransfer.getData(DND_BRUSH_MIME);
if (incomingBrushId) {
const resolved = resolveQuickBrush(incomingBrushId, customBrushes);
+ const brushLabel = resolved ? td(resolved.name, 'brushName') : t('Brush');
const added = workspaceStoreActions.addQuickBrush(incomingBrushId);
if (added) {
- uiStoreActions.showToast(`Added "${resolved?.name || 'Brush'}" to Quick Brushes`);
+ uiStoreActions.showToast(t('Added "{name}" to Quick Brushes', { name: brushLabel }));
} else {
- uiStoreActions.showToast(`"${resolved?.name || 'Brush'}" is already in Quick Brushes`);
+ uiStoreActions.showToast(t('"{name}" is already in Quick Brushes', { name: brushLabel }));
}
}
setDraggedTileId(null);
},
- [config.locked, customBrushes]
+ [config.locked, customBrushes, t, td]
);
const handleOpenSettings = (tab: 'settings' | 'brushes' = 'settings') => {
@@ -440,11 +444,11 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
onClick={() => {
const locked = workspaceStoreActions.toggleQuickBrushPanelLocked();
uiStoreActions.showToast(
- locked ? 'Quick Brush Panel locked' : 'Quick Brush Panel unlocked'
+ locked ? t('Quick Brush Panel locked') : t('Quick Brush Panel unlocked')
);
}}
- title={config.locked ? 'Unlock Quick Brush Panel' : 'Lock Panel Position & Brushes'}
- aria-label={config.locked ? 'Unlock Quick Brush Panel' : 'Lock Quick Brush Panel'}
+ title={config.locked ? t('Unlock Quick Brush Panel') : t('Lock Panel Position & Brushes')}
+ aria-label={config.locked ? t('Unlock Quick Brush Panel') : t('Lock Quick Brush Panel')}
aria-pressed={config.locked}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
config.locked
@@ -460,8 +464,8 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
type="button"
data-testid="quick-brush-settings-btn"
onClick={() => handleOpenSettings('settings')}
- title="Quick Brush Panel Settings"
- aria-label="Quick Brush Panel Settings"
+ title={t('Quick Brush Panel Settings')}
+ aria-label={t('Quick Brush Panel Settings')}
aria-expanded={settingsOpen}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
settingsOpen
@@ -478,10 +482,10 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
onClick={() => {
setSettingsOpen(false);
workspaceStoreActions.setQuickBrushPanelVisible(false);
- uiStoreActions.showToast('Quick Brush Panel hidden (Shift+B to reopen)');
+ uiStoreActions.showToast(t('Quick Brush Panel hidden (Shift+B to reopen)'));
}}
- title="Hide Quick Brush Panel (Shift+B)"
- aria-label="Hide Quick Brush Panel"
+ title={t('Hide Quick Brush Panel (Shift+B)')}
+ aria-label={t('Hide Quick Brush Panel')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -492,8 +496,8 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
type="button"
data-testid="quick-brush-hide-ui-btn"
onClick={() => workspaceStoreActions.togglePalettesHidden()}
- title={palettesHidden ? 'Show All Palettes (Tab)' : 'Hide All Other Palettes (Tab)'}
- aria-label={palettesHidden ? 'Show All Palettes' : 'Hide All Other Palettes'}
+ title={palettesHidden ? t('Show All Palettes (Tab)') : t('Hide All Other Palettes (Tab)')}
+ aria-label={palettesHidden ? t('Show All Palettes') : t('Hide All Other Palettes')}
aria-pressed={palettesHidden}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
palettesHidden
@@ -521,7 +525,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
data-auto-faded={String(isAutoFaded)}
data-anchor-side={isFixed ? 'custom' : isHorizontal ? 'bottom' : leftHandedMode ? 'left' : 'right'}
role="toolbar"
- aria-label="Quick-Access Brush Panel"
+ aria-label={t('Quick-Access Brush Panel')}
onPointerDown={(e) => e.stopPropagation()}
onWheel={(e) => e.stopPropagation()}
onDragOver={(e) => {
@@ -573,8 +577,8 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
}}
title={
config.locked
- ? 'Panel locked — unlock to drag or flip orientation'
- : 'Drag to move panel • Double-click to flip Vertical / Horizontal'
+ ? t('Panel locked — unlock to drag or flip orientation')
+ : t('Drag to move panel • Double-click to flip Vertical / Horizontal')
}
className={`group flex items-center justify-center shrink-0 text-ui-muted ${
config.locked ? 'cursor-default' : 'cursor-grab active:cursor-grabbing hover:text-ui-primary'
@@ -591,7 +595,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
style={{ writingMode: 'vertical-rl' }}
className="text-[10px] font-medium tracking-wide text-ui-secondary max-h-[40px] overflow-hidden text-ellipsis whitespace-nowrap leading-none"
>
- {config.title}
+ {td(config.title)}
</span>
)}
</div>
@@ -617,14 +621,16 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
onClick={() => handleOpenSettings('brushes')}
style={{ width: Math.max(tileDim.width, 64), height: tileDim.height }}
className="rounded-ui-md border border-dashed border-ui-default bg-ui-control hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary flex flex-col items-center justify-center gap-1 text-[10px] cursor-pointer transition-colors"
- title="Add brushes to Quick-Access Brush Panel"
+ title={t('Add brushes to Quick-Access Brush Panel')}
>
<Plus className="w-4 h-4 text-ui-accent" />
- <span>Add</span>
+ <span>{t('Add')}</span>
</button>
) : (
<div style={gridStyle}>
{resolvedBrushes.map((brush, index) => {
+ const displayName = td(brush.name, 'brushName');
+ const displayDesc = brush.desc ? td(brush.desc) : '';
const isSelected = brush.isEraser
? activeTool === 'eraser'
: isPaintTool(activeTool) &&
@@ -697,12 +703,13 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
role="button"
tabIndex={0}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
void activateQuickBrush(brush, customBrushes);
}
}}
- title={brush.desc ? `${brush.name} — ${brush.desc}` : brush.name}
+ title={displayDesc ? `${displayName} — ${displayDesc}` : displayName}
style={{
width: tileDim.width,
height: tileDim.height,
@@ -756,7 +763,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
isSelected ? 'text-ui-primary font-medium' : 'text-ui-secondary'
}`}
>
- {brush.name}
+ {displayName}
</span>
)}
@@ -768,10 +775,12 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
onClick={(e) => {
e.stopPropagation();
workspaceStoreActions.removeQuickBrush(brush.id);
- uiStoreActions.showToast(`Removed "${brush.name}" from Quick Brushes`);
+ uiStoreActions.showToast(
+ t('Removed "{name}" from Quick Brushes', { name: displayName })
+ );
}}
- title={`Remove ${brush.name}`}
- aria-label={`Remove ${brush.name} from Quick Brushes`}
+ title={t('Remove {name}', { name: displayName })}
+ aria-label={t('Remove {name} from Quick Brushes', { name: displayName })}
className="opacity-0 group-hover:opacity-100 focus:opacity-100 absolute top-0.5 right-0.5 w-3.5 h-3.5 rounded-full bg-ui-elevated border border-ui-subtle hover:bg-ui-danger hover:border-ui-danger text-ui-muted hover:text-white flex items-center justify-center transition-opacity cursor-pointer"
>
<X className="w-2.5 h-2.5" />
@@ -822,7 +831,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
className="w-44 rounded-ui-md bg-ui-elevated border border-ui-default shadow-ui-popover p-1 text-[11px] text-ui-primary select-none"
>
<div className="px-2 py-0.5 text-[10px] text-ui-muted truncate">
- {tileContextMenu.brush.name}
+ {td(tileContextMenu.brush.name)}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -838,7 +847,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover text-left cursor-pointer"
>
<Sliders className="w-3 h-3 text-ui-accent" />
- <span>Edit in Brush Studio</span>
+ <span>{t('Edit in Brush Studio')}</span>
</button>
)}
@@ -858,7 +867,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
) : (
<ArrowUp className="w-3 h-3 text-ui-muted" />
)}
- <span>{isHorizontal ? 'Move Left' : 'Move Up'}</span>
+ <span>{isHorizontal ? t('Move Left') : t('Move Up')}</span>
</button>
<button
@@ -875,7 +884,7 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
) : (
<ArrowDown className="w-3 h-3 text-ui-muted" />
)}
- <span>{isHorizontal ? 'Move Right' : 'Move Down'}</span>
+ <span>{isHorizontal ? t('Move Right') : t('Move Down')}</span>
</button>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -885,13 +894,15 @@ export const QuickBrushPanel: React.FC<QuickBrushPanelProps> = React.memo(({ cus
onClick={() => {
const target = tileContextMenu.brush;
workspaceStoreActions.removeQuickBrush(target.id);
- uiStoreActions.showToast(`Removed "${target.name}" from Quick Brushes`);
+ uiStoreActions.showToast(
+ t('Removed "{name}" from Quick Brushes', { name: td(target.name) })
+ );
setTileContextMenu(null);
}}
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger text-left cursor-pointer"
>
<Trash2 className="w-3 h-3" />
- <span>Remove from Panel</span>
+ <span>{t('Remove from Panel')}</span>
</button>
</>
)}
diff --git a/src/components/QuickBrushPanelSettings.tsx b/src/components/QuickBrushPanelSettings.tsx
index 1b1c8c6..0983333 100644
--- a/src/components/QuickBrushPanelSettings.tsx
+++ b/src/components/QuickBrushPanelSettings.tsx
@@ -38,6 +38,7 @@ import {
} from '../stores';
import { resolveAppearanceTokens } from '../utils/themeEngine';
import { getCategoryAccentStyle, resolveQuickBrush } from '../utils/quickBrushUtils';
+import { isImeComposing, useI18n } from '../i18n';
export interface QuickBrushPanelSettingsProps {
anchorRef: React.RefObject<HTMLElement | null>;
@@ -51,6 +52,7 @@ const POPOVER_EST_HEIGHT = 430;
export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = React.memo(
({ anchorRef, initialTab = 'settings', customBrushes, onClose }) => {
+ const { t, td } = useI18n();
const config = useWorkspaceStore((s) => s.quickBrushPanel);
const palettesHidden = useWorkspaceStore((s) => s.palettesHidden);
const activePresetId = useToolStore((s) => s.activePresetId);
@@ -110,6 +112,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
onClose();
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.stopPropagation();
onClose();
@@ -155,10 +158,12 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
b.category === sec.id &&
(!normalizedQuery ||
b.name.toLowerCase().includes(normalizedQuery) ||
- sec.label.toLowerCase().includes(normalizedQuery))
+ td(b.name).toLowerCase().includes(normalizedQuery) ||
+ sec.label.toLowerCase().includes(normalizedQuery) ||
+ td(sec.label).toLowerCase().includes(normalizedQuery))
),
})).filter((s) => s.brushes.length > 0);
- }, [normalizedQuery]);
+ }, [normalizedQuery, td]);
const filteredCustomBrushes = useMemo(() => {
if (!normalizedQuery) return customBrushes;
@@ -173,8 +178,11 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
const handleToggleBrush = (id: BrushPresetId, name: string) => {
const added = workspaceStoreActions.toggleQuickBrush(id);
+ const displayName = td(name);
uiStoreActions.showToast(
- added ? `Added "${name}" to Quick Brushes` : `Removed "${name}" from Quick Brushes`
+ added
+ ? t('Added "{name}" to Quick Brushes', { name: displayName })
+ : t('Removed "{name}" from Quick Brushes', { name: displayName })
);
};
@@ -183,7 +191,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
ref={popoverRef}
data-testid="quick-brush-settings-popover"
role="dialog"
- aria-label="Quick-Access Brush Panel Settings"
+ aria-label={t('Quick-Access Brush Panel Settings')}
onPointerDown={(e) => e.stopPropagation()}
onWheel={(e) => e.stopPropagation()}
style={{
@@ -199,12 +207,12 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
<div className="h-8 px-2.5 flex items-center justify-between bg-ui-header border-b border-ui-subtle shrink-0">
<div className="flex items-center gap-1.5 font-medium text-ui-primary">
<SlidersHorizontal className="w-3.5 h-3.5 text-ui-accent" />
- <span>Quick Brush Panel</span>
+ <span>{t('Quick Brush Panel')}</span>
</div>
<button
type="button"
onClick={onClose}
- aria-label="Close Quick Brush Settings"
+ aria-label={t('Close Quick Brush Settings')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -224,7 +232,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
}`}
>
<SlidersHorizontal className="w-3 h-3" />
- <span>Panel Settings</span>
+ <span>{t('Panel Settings')}</span>
{activeTab === 'settings' && (
<span className="absolute bottom-0 left-2 right-2 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -240,7 +248,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
}`}
>
<Star className="w-3 h-3" />
- <span className="tabular-nums">Brushes ({pinnedEntries.length})</span>
+ <span className="tabular-nums">{t('Brushes ({count})', { count: pinnedEntries.length })}</span>
{activeTab === 'brushes' && (
<span className="absolute bottom-0 left-2 right-2 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -252,7 +260,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
<div className="p-2.5 space-y-3 overflow-y-auto min-h-0">
{/* Orientation */}
<div className="space-y-1">
- <div className="text-[10px] uppercase tracking-wider text-ui-muted">Orientation</div>
+ <div className="text-[10px] uppercase tracking-wider text-ui-muted">{t('Orientation')}</div>
<div className="grid grid-cols-2 gap-1">
{(
[
@@ -274,7 +282,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
}`}
>
{opt.icon}
- <span>{opt.label}</span>
+ <span>{t(opt.label)}</span>
</button>
);
})}
@@ -284,7 +292,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{/* Tile Size & Columns/Rows */}
<div className="grid grid-cols-2 gap-2">
<div className="space-y-1">
- <div className="text-[10px] uppercase tracking-wider text-ui-muted">Tile Size</div>
+ <div className="text-[10px] uppercase tracking-wider text-ui-muted">{t('Tile Size')}</div>
<div className="grid grid-cols-3 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{(
[
@@ -312,7 +320,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
<div className="space-y-1">
<div className="text-[10px] uppercase tracking-wider text-ui-muted">
- {config.orientation === 'vertical' ? 'Columns' : 'Rows'}
+ {config.orientation === 'vertical' ? t('Columns') : t('Rows')}
</div>
<div className="grid grid-cols-2 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{([1, 2] as const).map((n) => (
@@ -336,7 +344,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{/* Preview Style */}
<div className="space-y-1">
- <div className="text-[10px] uppercase tracking-wider text-ui-muted">Preview Style</div>
+ <div className="text-[10px] uppercase tracking-wider text-ui-muted">{t('Preview Style')}</div>
<div className="grid grid-cols-2 gap-1 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{(
[
@@ -355,7 +363,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {st.label}
+ {t(st.label)}
</button>
))}
</div>
@@ -364,7 +372,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{/* Opacity Slider */}
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px]">
- <span className="uppercase tracking-wider text-ui-muted">Panel Opacity</span>
+ <span className="uppercase tracking-wider text-ui-muted">{t('Panel Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round(config.opacity * 100)}%
</span>
@@ -383,13 +391,13 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{/* Panel Title Input */}
<div className="space-y-1">
- <div className="text-[10px] uppercase tracking-wider text-ui-muted">Panel Label</div>
+ <div className="text-[10px] uppercase tracking-wider text-ui-muted">{t('Panel Label')}</div>
<input
type="text"
data-testid="quick-brush-title-input"
value={config.title}
maxLength={28}
- placeholder="Favorites"
+ placeholder={t('Favorites')}
onChange={(e) => update({ title: e.target.value })}
className="w-full h-7 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle text-[11px] text-ui-primary placeholder:text-ui-muted"
/>
@@ -398,7 +406,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{/* Toggles */}
<div className="space-y-1.5 pt-0.5 border-t border-ui-subtle">
<label className="flex items-center justify-between gap-2 py-0.5 cursor-pointer">
- <span className="text-ui-secondary">Show brush names</span>
+ <span className="text-ui-secondary">{t('Show brush names')}</span>
<input
type="checkbox"
data-testid="quick-brush-toggle-names"
@@ -408,7 +416,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
</label>
<label className="flex items-center justify-between gap-2 py-0.5 cursor-pointer">
- <span className="text-ui-secondary">Category color accents</span>
+ <span className="text-ui-secondary">{t('Category color accents')}</span>
<input
type="checkbox"
data-testid="quick-brush-toggle-colors"
@@ -418,7 +426,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
</label>
<label className="flex items-center justify-between gap-2 py-0.5 cursor-pointer">
- <span className="text-ui-secondary">Show panel label (horizontal)</span>
+ <span className="text-ui-secondary">{t('Show panel label (horizontal)')}</span>
<input
type="checkbox"
data-testid="quick-brush-toggle-title"
@@ -429,9 +437,9 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
<label className="flex items-center justify-between gap-2 py-0.5 cursor-pointer">
<div>
- <div className="text-ui-secondary">Keep visible when UI hidden (Tab)</div>
+ <div className="text-ui-secondary">{t('Keep visible when UI hidden (Tab)')}</div>
<div className="text-[9px] text-ui-muted">
- Stay on canvas when all palettes are hidden
+ {t('Stay on canvas when all palettes are hidden')}
</div>
</div>
<input
@@ -443,7 +451,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
</label>
<label className="flex items-center justify-between gap-2 py-0.5 cursor-pointer">
- <span className="text-ui-secondary">Show Hide/Show UI button on bar</span>
+ <span className="text-ui-secondary">{t('Show Hide/Show UI button on bar')}</span>
<input
type="checkbox"
data-testid="quick-brush-toggle-hide-ui-btn"
@@ -459,7 +467,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
) : (
<Unlock className="w-3 h-3 text-ui-muted" />
)}
- <span>Lock position &amp; brush list</span>
+ <span>{t('Lock position & brush list')}</span>
</span>
<input
type="checkbox"
@@ -484,7 +492,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
) : (
<EyeOff className="w-3.5 h-3.5 text-ui-accent" />
)}
- <span>{palettesHidden ? 'Show All Palettes' : 'Hide All Other Palettes'}</span>
+ <span>{palettesHidden ? t('Show All Palettes') : t('Hide All Other Palettes')}</span>
</span>
<span className="text-[10px] font-ui-mono text-ui-muted">Tab</span>
</button>
@@ -496,19 +504,19 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
onClick={() => workspaceStoreActions.setQuickBrushPanelPosition(null, true)}
className="h-6 px-2 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary text-[10px] cursor-pointer transition-colors"
>
- Snap to Edge
+ {t('Snap to Edge')}
</button>
<button
type="button"
data-testid="quick-brush-reset-all-btn"
onClick={() => {
workspaceStoreActions.resetQuickBrushPanel();
- uiStoreActions.showToast('Quick Brush Panel reset to defaults');
+ uiStoreActions.showToast(t('Quick Brush Panel reset to defaults'));
}}
className="h-6 px-2 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-warning text-[10px] flex items-center justify-center gap-1 cursor-pointer transition-colors"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset Panel</span>
+ <span>{t('Reset Panel')}</span>
</button>
</div>
</div>
@@ -525,7 +533,9 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
const added = workspaceStoreActions.addQuickBrush(currentActiveId);
if (added) {
uiStoreActions.showToast(
- `Added "${resolved?.name || 'Brush'}" to Quick Brushes`
+ t('Added "{name}" to Quick Brushes', {
+ name: resolved ? td(resolved.name) : t('Brush'),
+ })
);
}
}}
@@ -533,7 +543,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
>
<Plus className="w-3 h-3 text-ui-accent" />
<span className="truncate">
- {isCurrentPinned ? 'Active Pinned' : 'Add Active'}
+ {isCurrentPinned ? t('Active Pinned') : t('Add Active')}
</span>
</button>
@@ -547,23 +557,25 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
}`}
>
<Eraser className="w-3 h-3" />
- <span>{pinnedSet.has(ERASER_PRESET_ID) ? 'Eraser Pinned' : '+ Pin Eraser'}</span>
+ <span>{pinnedSet.has(ERASER_PRESET_ID) ? t('Eraser Pinned') : t('+ Pin Eraser')}</span>
</button>
</div>
{/* Pinned Order Management */}
<div className="space-y-1 shrink-0">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span className="uppercase tracking-wider tabular-nums">Pinned ({pinnedEntries.length})</span>
+ <span className="uppercase tracking-wider tabular-nums">
+ {t('Pinned ({count})', { count: pinnedEntries.length })}
+ </span>
<div className="flex items-center gap-1.5">
{pinnedEntries.length > 0 && (
<button
type="button"
onClick={() => workspaceStoreActions.clearQuickBrushes()}
className="hover:text-ui-danger cursor-pointer"
- title="Clear all pinned brushes"
+ title={t('Clear all pinned brushes')}
>
- Clear
+ {t('Clear')}
</button>
)}
</div>
@@ -571,7 +583,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{pinnedEntries.length === 0 ? (
<div className="px-2 py-2 rounded-ui-sm bg-ui-input border border-ui-subtle text-center text-[10px] text-ui-muted">
- No brushes pinned yet. Pick any brush below or click the star in Sub Tool.
+ {t('No brushes pinned yet. Pick any brush below or click the star in Sub Tool.')}
</div>
) : (
<div className="max-h-28 overflow-y-auto space-y-0.5 pr-0.5">
@@ -587,14 +599,16 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
className="w-1 h-3 rounded-full shrink-0"
style={{ backgroundColor: accent.barColor || 'var(--ui-border-strong)' }}
/>
- <span className="truncate text-[11px] text-ui-primary">{brush.name}</span>
+ <span className="truncate text-[11px] text-ui-primary">
+ {td(brush.name, 'brushName')}
+ </span>
</div>
<div className="flex items-center gap-0.5 shrink-0">
<button
type="button"
disabled={idx === 0}
onClick={() => workspaceStoreActions.moveQuickBrush(brush.id, -1)}
- title="Move earlier"
+ title={t('Move earlier')}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronUp className="w-3 h-3" />
@@ -603,7 +617,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
type="button"
disabled={idx === pinnedEntries.length - 1}
onClick={() => workspaceStoreActions.moveQuickBrush(brush.id, 1)}
- title="Move later"
+ title={t('Move later')}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronDown className="w-3 h-3" />
@@ -611,7 +625,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
<button
type="button"
onClick={() => workspaceStoreActions.removeQuickBrush(brush.id)}
- title="Remove from Quick Brushes"
+ title={t('Remove from Quick Brushes')}
className="p-0.5 text-ui-muted hover:text-ui-danger cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -632,7 +646,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
data-testid="quick-brush-search-input"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
- placeholder="Search brushes to add..."
+ placeholder={t('Search brushes to add...')}
className="w-full h-6 pl-6 pr-2 rounded-ui-sm bg-ui-input border border-ui-subtle text-[10px] text-ui-primary placeholder:text-ui-muted"
/>
</div>
@@ -641,7 +655,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{filteredBuiltinSections.map((sec) => (
<div key={sec.id} className="space-y-0.5">
<div className="text-[9px] uppercase tracking-wider text-ui-muted px-1">
- {sec.label}
+ {td(sec.label)}
</div>
{sec.brushes.map((b) => {
const isPinned = pinnedSet.has(b.id);
@@ -659,7 +673,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
>
<span className="flex items-center gap-1.5 min-w-0">
<Paintbrush className="w-3 h-3 shrink-0 opacity-75" />
- <span className="truncate text-[10px]">{b.name}</span>
+ <span className="truncate text-[10px]">{td(b.name, 'brushName')}</span>
</span>
{isPinned ? (
<Check className="w-3 h-3 text-ui-accent shrink-0" />
@@ -675,7 +689,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
{filteredCustomBrushes.length > 0 && (
<div className="space-y-0.5">
<div className="text-[9px] uppercase tracking-wider text-ui-muted px-1">
- Imported / Custom
+ {t('Imported / Custom')}
</div>
{filteredCustomBrushes.map((b) => {
const isPinned = pinnedSet.has(b.id);
@@ -707,7 +721,7 @@ export const QuickBrushPanelSettings: React.FC<QuickBrushPanelSettingsProps> = R
) : (
<Paintbrush className="w-3 h-3 shrink-0 opacity-75" />
)}
- <span className="truncate text-[10px]">{b.name}</span>
+ <span className="truncate text-[10px]">{td(b.name, 'brushName')}</span>
</span>
{isPinned ? (
<Check className="w-3 h-3 text-ui-accent shrink-0" />
diff --git a/src/components/QuickShapeOverlay.tsx b/src/components/QuickShapeOverlay.tsx
index 72604cd..0858215 100644
--- a/src/components/QuickShapeOverlay.tsx
+++ b/src/components/QuickShapeOverlay.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import type { CanvasDimensions } from '../types/editor';
import type { QuickShapePreviewState } from '../utils/quickShapeEngine';
+import { useI18n } from '../i18n';
export interface QuickShapeOverlayProps {
dimensions: CanvasDimensions;
@@ -13,6 +14,7 @@ export interface QuickShapeOverlayProps {
export const QuickShapeOverlay: React.FC<QuickShapeOverlayProps> = React.memo(
({ dimensions, zoom, rotation, flipX, flipY, preview }) => {
+ const { td } = useI18n();
const invZoom = 1 / Math.max(0.05, zoom);
const crossArm = 5 * invZoom;
const handleR = 4.5 * invZoom;
@@ -166,7 +168,7 @@ export const QuickShapeOverlay: React.FC<QuickShapeOverlayProps> = React.memo(
>
<span className="w-1.5 h-1.5 rounded-full bg-ui-accent shrink-0" />
<span className="text-[10px] font-semibold tracking-tight text-ui-primary">
- {preview.label}
+ {td(preview.label)}
</span>
{preview.readout && (
<>
@@ -177,7 +179,7 @@ export const QuickShapeOverlay: React.FC<QuickShapeOverlayProps> = React.memo(
{preview.hint && (
<>
<span className="text-[10px] text-ui-muted">·</span>
- <span className="text-[9px] text-ui-muted">{preview.hint}</span>
+ <span className="text-[9px] text-ui-muted">{td(preview.hint)}</span>
</>
)}
</div>
diff --git a/src/components/ResizeCanvasModal.tsx b/src/components/ResizeCanvasModal.tsx
index 59643a0..4a4b74f 100644
--- a/src/components/ResizeCanvasModal.tsx
+++ b/src/components/ResizeCanvasModal.tsx
@@ -50,6 +50,7 @@ import {
nudgeCropDraft,
} from '../utils/canvasResizeCrop';
import { DPI_PRESETS } from './NewCanvasModal';
+import { isImeComposing, useI18n } from '../i18n';
function gcd(a: number, b: number): number {
a = Math.round(Math.abs(a));
@@ -87,6 +88,25 @@ function formatGridMode(mode: CropGridMode): string {
return 'Off';
}
+function areResizeDraftsEqual(a: CanvasResizeDraft | undefined, b: CanvasResizeDraft | undefined): boolean {
+ if (!a || !b) return a === b;
+ return (
+ a.originWidth === b.originWidth &&
+ a.originHeight === b.originHeight &&
+ a.cropX === b.cropX &&
+ a.cropY === b.cropY &&
+ a.width === b.width &&
+ a.height === b.height &&
+ a.dpi === b.dpi &&
+ a.scaleContent === b.scaleContent &&
+ a.anchor === b.anchor &&
+ a.lockRatio === b.lockRatio &&
+ a.ratioX === b.ratioX &&
+ a.ratioY === b.ratioY &&
+ a.gridMode === b.gridMode
+ );
+}
+
interface NumericDraftInputProps {
id: string;
value: number;
@@ -164,6 +184,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
onResize,
selectionBounds = null,
}) => {
+ const { t, tc, td } = useI18n();
const widthInputId = useId();
const heightInputId = useId();
const cropXInputId = useId();
@@ -177,22 +198,109 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
const [pos, setPos] = useState<{ x: number; y: number }>({ x: 0, y: 0 });
const isDraggingWindowRef = useRef(false);
const dragStartRef = useRef({ startX: 0, startY: 0, initX: 0, initY: 0 });
+ const draftHistoryRef = useRef<CanvasResizeDraft[]>([]);
+ const draftHistoryIndexRef = useRef<number>(-1);
+ const isApplyingDraftHistoryRef = useRef<boolean>(false);
+ const isPointerDownRef = useRef<boolean>(false);
+ const pendingPointerDraftPushRef = useRef<boolean>(false);
+
+ const pushDraftHistorySnapshot = useCallback((snapshot: CanvasResizeDraft) => {
+ const stack = draftHistoryRef.current;
+ const idx = draftHistoryIndexRef.current;
+ if (idx >= 0 && areResizeDraftsEqual(stack[idx], snapshot)) return;
+ const truncated = idx >= 0 ? stack.slice(0, idx + 1) : [];
+ truncated.push({ ...snapshot });
+ if (truncated.length > 100) {
+ truncated.shift();
+ }
+ draftHistoryRef.current = truncated;
+ draftHistoryIndexRef.current = truncated.length - 1;
+ }, []);
- // Ensure draft is initialized and synchronized whenever opened
+ // Ensure draft and live crop draft undo stack are initialized whenever opened
useEffect(() => {
- if (!isOpen) return;
+ if (!isOpen) {
+ draftHistoryRef.current = [];
+ draftHistoryIndexRef.current = -1;
+ isPointerDownRef.current = false;
+ pendingPointerDraftPushRef.current = false;
+ isApplyingDraftHistoryRef.current = false;
+ return;
+ }
userToggledLockRef.current = false;
setPos({ x: 0, y: 0 });
const existing = useUiStore.getState().canvasResizeDraft;
- if (
- !existing ||
- existing.originWidth !== currentDimensions.width ||
- existing.originHeight !== currentDimensions.height
- ) {
- uiStoreActions.updateCanvasResizeDraft(createInitialCanvasResizeDraft(currentDimensions));
+ const initialDraft =
+ existing &&
+ existing.originWidth === currentDimensions.width &&
+ existing.originHeight === currentDimensions.height
+ ? existing
+ : createInitialCanvasResizeDraft(currentDimensions);
+ if (initialDraft !== existing) {
+ uiStoreActions.updateCanvasResizeDraft(initialDraft);
}
+ draftHistoryRef.current = [{ ...initialDraft }];
+ draftHistoryIndexRef.current = 0;
}, [isOpen, currentDimensions]);
+ // Coalesce continuous pointer drags on the crop overlay into a single draft undo step on pointerup
+ useEffect(() => {
+ if (!isOpen) return;
+ const onPointerDown = () => {
+ isPointerDownRef.current = true;
+ };
+ const onPointerEnd = () => {
+ isPointerDownRef.current = false;
+ if (pendingPointerDraftPushRef.current) {
+ pendingPointerDraftPushRef.current = false;
+ const latest = useUiStore.getState().canvasResizeDraft;
+ if (latest) {
+ pushDraftHistorySnapshot(latest);
+ }
+ }
+ };
+ window.addEventListener('pointerdown', onPointerDown, true);
+ window.addEventListener('pointerup', onPointerEnd, true);
+ window.addEventListener('pointercancel', onPointerEnd, true);
+ return () => {
+ window.removeEventListener('pointerdown', onPointerDown, true);
+ window.removeEventListener('pointerup', onPointerEnd, true);
+ window.removeEventListener('pointercancel', onPointerEnd, true);
+ };
+ }, [isOpen, pushDraftHistorySnapshot]);
+
+ // Record discrete draft changes (inputs, anchor buttons, presets, arrow nudges) into crop draft history
+ useEffect(() => {
+ if (!isOpen || !storeDraft) return;
+ if (isApplyingDraftHistoryRef.current) {
+ isApplyingDraftHistoryRef.current = false;
+ return;
+ }
+ if (isPointerDownRef.current) {
+ pendingPointerDraftPushRef.current = true;
+ return;
+ }
+ pushDraftHistorySnapshot(storeDraft);
+ }, [isOpen, storeDraft, pushDraftHistorySnapshot]);
+
+ const handleUndoDraft = useCallback(() => {
+ if (draftHistoryIndexRef.current <= 0) return;
+ draftHistoryIndexRef.current -= 1;
+ const target = draftHistoryRef.current[draftHistoryIndexRef.current];
+ if (!target) return;
+ isApplyingDraftHistoryRef.current = true;
+ uiStoreActions.updateCanvasResizeDraft({ ...target });
+ }, []);
+
+ const handleRedoDraft = useCallback(() => {
+ if (draftHistoryIndexRef.current >= draftHistoryRef.current.length - 1) return;
+ draftHistoryIndexRef.current += 1;
+ const target = draftHistoryRef.current[draftHistoryIndexRef.current];
+ if (!target) return;
+ isApplyingDraftHistoryRef.current = true;
+ uiStoreActions.updateCanvasResizeDraft({ ...target });
+ }, []);
+
const draft: CanvasResizeDraft = useMemo(
() => storeDraft ?? createInitialCanvasResizeDraft(currentDimensions),
[storeDraft, currentDimensions]
@@ -219,6 +327,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
const target = e.target as HTMLElement | null;
const tag = target?.tagName;
const isTextLike =
@@ -231,6 +340,22 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
return;
}
+ if (!isTextLike && (e.ctrlKey || e.metaKey) && !e.altKey) {
+ const lowerKey = e.key.toLowerCase();
+ if (lowerKey === 'z' && !e.shiftKey) {
+ e.preventDefault();
+ e.stopPropagation();
+ handleUndoDraft();
+ return;
+ }
+ if ((lowerKey === 'z' && e.shiftKey) || (lowerKey === 'y' && !e.shiftKey)) {
+ e.preventDefault();
+ e.stopPropagation();
+ handleRedoDraft();
+ return;
+ }
+ }
+
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
e.stopPropagation();
@@ -274,7 +399,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
};
window.addEventListener('keydown', handleKeyDown, true);
return () => window.removeEventListener('keydown', handleKeyDown, true);
- }, [isOpen, onClose, handleApplyResize, updateDraft]);
+ }, [isOpen, onClose, handleApplyResize, handleUndoDraft, handleRedoDraft, updateDraft]);
// Floating window drag handlers
const handleWindowDragStart = (e: React.PointerEvent<HTMLDivElement>) => {
@@ -363,7 +488,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
if (!isOpen || isInspectorCollapsed) return null;
const isCropping = !scaleContent;
- const applyButtonLabel = isCropping && modified ? 'Apply Crop & Resize' : 'Resize Canvas';
+ const applyButtonLabel = isCropping && modified ? t('Apply Crop & Resize') : t('Resize Canvas');
return (
<div
@@ -388,7 +513,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
onPointerCancel={handleWindowDragEnd}
onDoubleClick={() => setPos({ x: 0, y: 0 })}
className="h-9 px-3 bg-ui-header border-b border-ui-subtle flex items-center justify-between shrink-0 cursor-move"
- title="Drag to move panel · Double-click to reset position"
+ title={t('Drag to move panel · Double-click to reset position')}
>
<div className="flex items-center gap-2 min-w-0">
{isCropping ? (
@@ -400,7 +525,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
id="resize-canvas-modal-title"
className="text-xs font-medium text-ui-primary tracking-wide truncate"
>
- Resize Canvas
+ {t('Resize Canvas')}
</h2>
<GripHorizontal className="w-3.5 h-3.5 text-ui-disabled shrink-0" />
</div>
@@ -409,8 +534,8 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<button
type="button"
onClick={() => uiStoreActions.setResizeInspectorCollapsed(true)}
- aria-label="Collapse panel"
- title="Hide panel while cropping on canvas"
+ aria-label={t('Collapse panel')}
+ title={t('Hide panel while cropping on canvas')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<PanelRightClose className="w-3.5 h-3.5" />
@@ -418,8 +543,8 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -442,10 +567,10 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
>
<div className="flex items-center gap-1.5 font-medium text-[11px] text-ui-primary mb-0.5">
<Crop className="w-3 h-3 text-ui-accent shrink-0" />
- <span>Canvas Bounds</span>
+ <span>{t('Canvas Bounds')}</span>
</div>
<p className="text-[10px] text-ui-muted leading-tight">
- Crop or expand directly on canvas without distorting pixels.
+ {t('Crop or expand directly on canvas without distorting pixels.')}
</p>
</button>
@@ -460,17 +585,17 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
>
<div className="flex items-center gap-1.5 font-medium text-[11px] text-ui-primary mb-0.5">
<Maximize2 className="w-3 h-3 text-ui-accent shrink-0" />
- <span>Scale Content</span>
+ <span>{t('Scale Content')}</span>
</div>
<p className="text-[10px] text-ui-muted leading-tight">
- Resamples and scales all artwork to new dimensions.
+ {t('Resamples and scales all artwork to new dimensions.')}
</p>
</button>
</div>
{/* Current Dimensions Status Bar */}
<div className="bg-ui-header border border-ui-subtle rounded-ui-md px-3 py-1.5 flex items-center justify-between">
- <span className="text-ui-muted text-[11px]">Current</span>
+ <span className="text-ui-muted text-[11px]">{t('Current')}</span>
<div className="flex items-center gap-1.5 font-ui-mono tabular-nums text-[11px]">
<span className="text-ui-primary font-medium">
{currentDimensions.width} × {currentDimensions.height} px
@@ -484,7 +609,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="bg-ui-header border border-ui-subtle rounded-ui-md p-2.5 space-y-2.5">
<div className="flex items-center justify-between">
<span className="text-[10px] font-medium text-ui-muted uppercase tracking-wider">
- New Dimensions
+ {t('New Dimensions')}
</span>
<div className="flex items-center gap-1">
<button
@@ -497,8 +622,8 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
}`}
title={
lockRatio
- ? 'Keep aspect ratio locked (Shift also locks while dragging)'
- : 'Aspect ratio free (hold Shift while dragging handles to lock)'
+ ? t('Keep aspect ratio locked (Shift also locks while dragging)')
+ : t('Aspect ratio free (hold Shift while dragging handles to lock)')
}
>
{lockRatio ? (
@@ -506,13 +631,13 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
) : (
<Unlock className="w-2.5 h-2.5 text-ui-icon-muted" />
)}
- <span>{lockRatio ? 'Keep Aspect Ratio' : 'Ratio Free'}</span>
+ <span>{lockRatio ? t('Keep Aspect Ratio') : t('Ratio Free')}</span>
</button>
<button
type="button"
onClick={() => updateDraft((prev) => applySwapDimensionsToDraft(prev))}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
- title="Swap Width and Height (Landscape ⇄ Portrait)"
+ title={t('Swap Width and Height (Landscape ⇄ Portrait)')}
>
<ArrowLeftRight className="w-3 h-3" />
</button>
@@ -523,7 +648,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="space-y-1">
<div className="flex items-center justify-between">
<label htmlFor={widthInputId} className="text-[11px] text-ui-muted">
- Width (px)
+ {t('Width (px)')}
</label>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{percentW}%
@@ -542,7 +667,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="space-y-1">
<div className="flex items-center justify-between">
<label htmlFor={heightInputId} className="text-[11px] text-ui-muted">
- Height (px)
+ {t('Height (px)')}
</label>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{percentH}%
@@ -573,7 +698,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary'
}`}
>
- Free
+ {tc('aspectRatio', 'Free')}
</button>
{RATIO_PRESETS.map((r) => {
const isActive = lockRatio && Math.abs(width / Math.max(1, height) - r.x / r.y) < 0.015;
@@ -603,10 +728,10 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="bg-ui-header border border-ui-subtle rounded-ui-md p-2.5 space-y-2.5">
<div className="flex items-center justify-between gap-2">
<span className="text-[10px] font-medium text-ui-muted uppercase tracking-wider">
- Crop Frame &amp; Anchor
+ {t('Crop Frame & Anchor')}
</span>
<span className="text-[10px] text-ui-accent font-medium truncate">
- {anchor ? ANCHOR_LABELS[anchor] : 'Custom Crop'}
+ {anchor ? td(ANCHOR_LABELS[anchor]) : t('Custom Crop')}
</span>
</div>
@@ -614,7 +739,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="grid grid-cols-2 gap-2.5">
<div className="space-y-0.5">
<label htmlFor={cropXInputId} className="text-[10px] text-ui-muted block">
- Crop X (px)
+ {t('Crop X (px)')}
</label>
<NumericDraftInput
id={cropXInputId}
@@ -627,7 +752,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
</div>
<div className="space-y-0.5">
<label htmlFor={cropYInputId} className="text-[10px] text-ui-muted block">
- Crop Y (px)
+ {t('Crop Y (px)')}
</label>
<NumericDraftInput
id={cropYInputId}
@@ -644,7 +769,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="pt-2 border-t border-ui-subtle flex items-center justify-between gap-2">
<div className="space-y-1.5 min-w-0 flex-1">
<p className="text-[10px] text-ui-muted leading-snug">
- Drag handles on canvas to crop or expand. Drag inside to move, or drag outside to draw a new crop.
+ {t('Drag handles on canvas to crop or expand. Drag inside to move, or drag outside to draw a new crop.')}
</p>
<div className="flex flex-wrap items-center gap-1">
<button
@@ -656,10 +781,10 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
? 'bg-ui-control hover:bg-ui-control-hover border-ui-subtle text-ui-primary cursor-pointer'
: 'bg-ui-input border-ui-subtle text-ui-disabled cursor-default opacity-60'
}`}
- title="Reset crop box to current canvas dimensions"
+ title={t('Reset crop box to current canvas dimensions')}
>
<RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
<button
@@ -671,10 +796,10 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
}))
}
className="inline-flex items-center gap-1 px-2 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
- title="Cycle crop composition guide grid"
+ title={t('Cycle crop composition guide grid')}
>
<Grid3X3 className="w-3 h-3" />
- <span>Grid: {formatGridMode(gridMode)}</span>
+ <span>{t('Grid: {mode}', { mode: td(formatGridMode(gridMode)) })}</span>
</button>
{selectionBounds && selectionBounds.width >= 1 && selectionBounds.height >= 1 && (
@@ -684,10 +809,10 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
updateDraft((prev) => applyFitBoundsToDraft(prev, selectionBounds))
}
className="inline-flex items-center gap-1 px-2 py-1 rounded-ui-xs bg-ui-accent-subtle hover:bg-ui-accent-hover border border-ui-accent-border text-[10px] text-ui-accent font-medium transition-colors cursor-pointer"
- title="Snap crop frame to active selection bounds"
+ title={t('Snap crop frame to active selection bounds')}
>
<SquareDashed className="w-3 h-3" />
- <span>Selection</span>
+ <span>{t('Selection')}</span>
</button>
)}
</div>
@@ -706,7 +831,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
? 'bg-ui-accent text-ui-accent-contrast'
: 'bg-ui-input text-ui-muted hover:bg-ui-control-hover hover:text-ui-primary'
}`}
- title={item.label}
+ title={td(item.label)}
>
{item.icon}
</button>
@@ -723,7 +848,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="flex items-center gap-1.5">
<Printer className="w-3 h-3 text-ui-icon-muted" />
<span className="text-[10px] font-medium text-ui-muted uppercase tracking-wider">
- Resolution (DPI)
+ {t('Resolution (DPI)')}
</span>
</div>
<span className="font-ui-mono tabular-nums text-[10px] text-ui-accent">
@@ -756,7 +881,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
<div className="pt-1.5 border-t border-ui-subtle flex items-center justify-between">
<div className="flex items-center gap-1.5">
<label htmlFor={dpiInputId} className="text-[10px] text-ui-muted">
- Manual DPI:
+ {t('Manual DPI:')}
</label>
<NumericDraftInput
id={dpiInputId}
@@ -782,7 +907,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
{/* Footer */}
<div className="px-3 py-2 bg-ui-header border-t border-ui-subtle flex items-center justify-between shrink-0 gap-2">
<span className="text-[10px] text-ui-muted truncate">
- Ratio:{' '}
+ {t('Ratio:')}{' '}
<span className="font-ui-mono tabular-nums text-ui-primary">{simplifiedRatio}</span>
</span>
@@ -792,7 +917,7 @@ export const ResizeCanvasModal: React.FC<ResizeCanvasModalProps> = ({
onClick={onClose}
className="px-3 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] font-medium text-ui-primary transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
diff --git a/src/components/RightSidebar.tsx b/src/components/RightSidebar.tsx
index 414790d..aabbd46 100644
--- a/src/components/RightSidebar.tsx
+++ b/src/components/RightSidebar.tsx
@@ -62,6 +62,7 @@ import {
SegmentedControl,
ToggleSwitch,
} from './ui';
+import { isImeComposing, useI18n } from '../i18n';
interface RightSidebarColorSectionProps {
colorMode: CanvasColorMode;
@@ -376,6 +377,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
dockedMode = 'full',
externalFileDropIndicator = null,
}) => {
+ const { t, tc, td } = useI18n();
const [bottomTab, setBottomTab] = useState<'layers' | 'history'>(
dockedMode === 'history' ? 'history' : 'layers'
);
@@ -413,6 +415,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setIsColorLabelPickerOpen(false);
};
window.addEventListener('pointerdown', handleOutside);
@@ -431,6 +434,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}
};
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setContextMenu(null);
};
window.addEventListener('pointerdown', handleOutsideClick);
@@ -694,7 +698,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
startXRef.current = e.clientX;
startWidthRef.current = width;
}}
- title="Resize sidebar"
+ title={t('Resize sidebar')}
className="absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-ui-accent/40 transition-colors z-30"
/>
)}
@@ -729,20 +733,23 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<span className="text-[10px] uppercase tracking-[0.06em] text-ui-muted font-medium tabular-nums px-1">
{effectiveTab === 'layers'
? filterResult.isActive
- ? `${filterResult.matchCount}/${layers.length} Layers`
- : `${layers.length} Layers`
- : `${historyList.length} Steps`}
+ ? t('{match}/{total} Layers', {
+ match: filterResult.matchCount,
+ total: layers.length,
+ })
+ : t('{count} Layers', { count: layers.length })
+ : t('{count} Steps', { count: historyList.length })}
</span>
) : (
<HairlineTabs<'layers' | 'history'>
size="xs"
bordered={false}
- aria-label="Layers and History"
+ aria-label={t('Layers and History')}
value={effectiveTab}
onChange={setBottomTab}
tabs={[
- { value: 'layers', label: 'Layers' },
- { value: 'history', label: 'History' },
+ { value: 'layers', label: t('Layers') },
+ { value: 'history', label: t('History') },
]}
/>
)}
@@ -759,14 +766,14 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
onClick={onUndo}
disabled={!hasOpenDocument || !canUndo}
- title="Undo"
+ title={t('Undo')}
icon={<Undo2 className="w-3 h-3" />}
/>
<IconButton
size="xs"
onClick={onRedo}
disabled={!hasOpenDocument || !canRedo}
- title="Redo"
+ title={t('Redo')}
icon={<Redo2 className="w-3 h-3" />}
/>
</div>
@@ -778,7 +785,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<div className="flex-1 flex flex-col overflow-hidden min-h-0">
{!hasOpenDocument ? (
<div className="flex-1 flex flex-col items-center justify-center p-4 text-center text-ui-muted">
- <p className="text-[11px] mb-2">No canvas open</p>
+ <p className="text-[11px] mb-2">{t('No canvas open')}</p>
<div className="flex items-center gap-1.5">
{onNewCanvas && (
<button
@@ -786,7 +793,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={onNewCanvas}
className="px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-primary transition-colors cursor-pointer"
>
- New
+ {t('New')}
</button>
)}
{onOpenFile && (
@@ -795,7 +802,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={onOpenFile}
className="px-2.5 py-1 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- Open
+ {tc('action', 'Open')}
</button>
)}
</div>
@@ -813,19 +820,19 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<select
value={activeLayer.blendMode}
onChange={(e) => onSetBlendMode(activeLayer.id, e.target.value as BlendMode)}
- aria-label="Blend Mode"
+ aria-label={t('Blend Mode')}
className="w-[46%] min-w-0 h-[var(--ui-control-height)] bg-ui-input text-ui-primary border border-ui-subtle hover:border-ui-default text-[11px] px-1.5 rounded-ui-sm cursor-pointer truncate transition-colors"
- title="Blend Mode"
+ title={t('Blend Mode')}
>
{BLEND_MODES.map((mode) => (
<option key={mode.value} value={mode.value} className="bg-ui-elevated text-ui-primary">
- {mode.label}
+ {tc('blendMode', mode.label)}
</option>
))}
</select>
<ScrubSlider
- aria-label="Layer Opacity"
+ aria-label={t('Layer Opacity')}
variant="opacity"
size="sm"
hideLabel
@@ -836,7 +843,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
unit="%"
value={Math.round(activeLayer.opacity * 100)}
onChange={(v) => onSetOpacity(activeLayer.id, v / 100)}
- title={`Layer Opacity: ${Math.round(activeLayer.opacity * 100)}%`}
+ title={t('Layer Opacity: {percent}%', {
+ percent: Math.round(activeLayer.opacity * 100),
+ })}
className="flex-1 min-w-0"
/>
</div>
@@ -848,7 +857,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
active={Boolean(activeLayer.locked)}
onClick={() => onToggleLock(activeLayer.id)}
- title={activeLayer.locked ? 'Unlock Layer' : 'Lock Layer'}
+ title={activeLayer.locked ? t('Unlock Layer') : t('Lock Layer')}
icon={
activeLayer.locked ? (
<Lock className="w-3 h-3" />
@@ -862,7 +871,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
active={Boolean(activeLayer.clipped)}
onClick={() => onToggleClipping?.(activeLayer.id)}
- title="Clip to Layer Below"
+ title={t('Clip to Layer Below')}
icon={<ClipToLayerIcon />}
/>
)}
@@ -871,7 +880,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
active={Boolean(activeLayer.alphaLocked)}
onClick={() => onToggleAlphaLock?.(activeLayer.id)}
- title="Lock Transparent Pixels (Alpha Lock)"
+ title={t('Lock Transparent Pixels (Alpha Lock)')}
icon={<AlphaLockIcon />}
/>
)}
@@ -889,9 +898,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
title={
activeLayerHasMask
? activeLayer.maskEnabled === false
- ? 'Enable Layer Mask'
- : 'Disable Layer Mask'
- : 'Add Layer Mask'
+ ? t('Enable Layer Mask')
+ : t('Disable Layer Mask')
+ : t('Add Layer Mask')
}
icon={<LayerMaskIcon className="w-3 h-3" />}
/>
@@ -900,7 +909,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
active={Boolean(activeLayer.isReference)}
onClick={() => onToggleReferenceLayer?.(activeLayer.id)}
- title="Reference Layer"
+ title={t('Reference Layer')}
icon={<Compass className="w-3 h-3" />}
/>
{onSetLayerColorLabel && (
@@ -912,8 +921,10 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => setIsColorLabelPickerOpen((p) => !p)}
title={
activeLayerColorPreset
- ? `Layer Color Label: ${activeLayerColorPreset.name}`
- : 'Set Layer Color Label'
+ ? t('Layer Color Label: {name}', {
+ name: td(activeLayerColorPreset.name),
+ })
+ : t('Set Layer Color Label')
}
icon={
activeLayerColorPreset ? (
@@ -946,7 +957,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onSetLayerColorLabel(activeLayer.id, preset.id);
setIsColorLabelPickerOpen(false);
}}
- title={preset.name}
+ title={td(preset.name)}
className={`w-4 h-4 rounded-full flex items-center justify-center transition-transform hover:scale-110 cursor-pointer ${
isPicked
? 'ring-2 ring-ui-accent ring-offset-1 ring-offset-[var(--ui-bg-elevated)]'
@@ -976,8 +987,10 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => onToggleOwnerLock(activeLayer.id)}
title={
activeLayer.reservedByPeerId
- ? `Owner-Locked by ${activeLayer.reservedByPeerName || 'Owner'} (click to unlock)`
- : 'Lock Layer to Owner (prevents edits by other peers)'
+ ? t('Owner-Locked by {owner} (click to unlock)', {
+ owner: activeLayer.reservedByPeerName || t('Owner'),
+ })
+ : t('Lock Layer to Owner (prevents edits by other peers)')
}
icon={<Shield className="w-3 h-3" />}
/>
@@ -989,7 +1002,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<IconButton
size="xs"
onClick={onOpen3DLayer}
- title="3D Reference Layer"
+ title={t('3D Reference Layer')}
icon={<Box className="w-3 h-3" />}
/>
)}
@@ -1000,8 +1013,8 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => onMergeFolder(activeLayer.id)}
title={
activeLayer.locked
- ? 'Unlock folder to merge'
- : 'Merge Folder into Single Layer'
+ ? t('Unlock folder to merge')
+ : t('Merge Folder into Single Layer')
}
icon={<Layers className="w-3 h-3" />}
/>
@@ -1013,8 +1026,8 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => onTransformLayer()}
title={
activeLayer.locked
- ? 'Unlock folder to transform'
- : 'Transform Folder (Ctrl+T)'
+ ? t('Unlock folder to transform')
+ : t('Transform Folder (Ctrl+T)')
}
icon={<Scaling className="w-3 h-3" />}
/>
@@ -1041,13 +1054,14 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}
onKeyDown={(e) => {
e.stopPropagation();
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
setLayerFilter((prev) => ({ ...prev, query: '' }));
e.currentTarget.blur();
}
}}
- placeholder="Search layers..."
- aria-label="Search layers"
+ placeholder={t('Search layers...')}
+ aria-label={t('Search layers')}
autoComplete="off"
spellCheck={false}
className="w-full h-5 pl-5 pr-4 rounded-ui-xs bg-ui-input border border-ui-subtle focus:border-ui-focus focus:outline-none text-[10.5px] text-ui-primary placeholder:text-ui-muted"
@@ -1057,7 +1071,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
type="button"
data-testid="layer-search-clear"
onClick={() => setLayerFilter((prev) => ({ ...prev, query: '' }))}
- title="Clear search"
+ title={t('Clear search')}
className="absolute right-1 text-ui-muted hover:text-ui-primary cursor-pointer"
>
<X className="w-2.5 h-2.5" />
@@ -1070,7 +1084,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
data-testid="layer-filter-toggle"
aria-pressed={isFilterStripOpen || hasSecondaryFilter}
onClick={() => setIsFilterStripOpen((p) => !p)}
- title="Filter layers by color label or type"
+ title={t('Filter layers by color label or type')}
className={`relative h-5 w-5 rounded-ui-xs border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${
isFilterStripOpen || hasSecondaryFilter
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -1095,14 +1109,14 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() =>
setLayerFilter((prev) => ({ ...prev, colorLabel: 'all' }))
}
- title="All Color Labels"
+ title={t('All Color Labels')}
className={`h-4 px-1 rounded-ui-xs text-[9px] cursor-pointer transition-colors ${
layerFilter.colorLabel === 'all'
? 'bg-ui-accent-subtle text-ui-accent font-medium'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- All
+ {t('All')}
</button>
{LAYER_COLOR_LABEL_PRESETS.filter((p) => p.id !== 'none').map((preset) => {
const isSelectedColor = layerFilter.colorLabel === preset.id;
@@ -1118,7 +1132,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
colorLabel: prev.colorLabel === preset.id ? 'all' : preset.id,
}))
}
- title={`Filter: ${preset.name}`}
+ title={t('Filter: {name}', { name: td(preset.name) })}
className={`w-3.5 h-3.5 rounded-full transition-transform hover:scale-110 cursor-pointer ${
isSelectedColor
? 'ring-2 ring-ui-accent ring-offset-1 ring-offset-[var(--ui-bg-panel)] scale-110'
@@ -1138,7 +1152,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
colorLabel: prev.colorLabel === 'none' ? 'all' : 'none',
}))
}
- title="Filter: Unlabeled Layers"
+ title={t('Filter: Unlabeled Layers')}
className={`w-3.5 h-3.5 rounded-full border flex items-center justify-center cursor-pointer transition-colors ${
layerFilter.colorLabel === 'none'
? 'border-ui-accent bg-ui-accent-subtle text-ui-accent'
@@ -1152,7 +1166,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<div className="flex items-center gap-1">
<select
data-testid="layer-kind-filter"
- aria-label="Filter by layer type"
+ aria-label={t('Filter by layer type')}
value={layerFilter.kind}
onChange={(e) =>
setLayerFilter((prev) => ({
@@ -1162,16 +1176,16 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}
className="flex-1 min-w-0 h-5 px-1 rounded-ui-xs bg-ui-input border border-ui-subtle text-[10px] text-ui-primary cursor-pointer"
>
- <option value="all" className="bg-ui-elevated text-ui-primary">All Kinds</option>
- <option value="raster" className="bg-ui-elevated text-ui-primary">Raster Layers</option>
- <option value="folder" className="bg-ui-elevated text-ui-primary">Folders</option>
- <option value="text" className="bg-ui-elevated text-ui-primary">Text / Balloons</option>
- <option value="adjustment" className="bg-ui-elevated text-ui-primary">Adjustments</option>
- <option value="tone" className="bg-ui-elevated text-ui-primary">Screentone</option>
- <option value="masked" className="bg-ui-elevated text-ui-primary">Masked</option>
- <option value="reference" className="bg-ui-elevated text-ui-primary">Reference</option>
- <option value="locked" className="bg-ui-elevated text-ui-primary">Locked</option>
- <option value="hidden" className="bg-ui-elevated text-ui-primary">Hidden</option>
+ <option value="all" className="bg-ui-elevated text-ui-primary">{t('All Kinds')}</option>
+ <option value="raster" className="bg-ui-elevated text-ui-primary">{t('Raster Layers')}</option>
+ <option value="folder" className="bg-ui-elevated text-ui-primary">{t('Folders')}</option>
+ <option value="text" className="bg-ui-elevated text-ui-primary">{t('Text / Balloons')}</option>
+ <option value="adjustment" className="bg-ui-elevated text-ui-primary">{t('Adjustments')}</option>
+ <option value="tone" className="bg-ui-elevated text-ui-primary">{t('Screentone')}</option>
+ <option value="masked" className="bg-ui-elevated text-ui-primary">{t('Masked')}</option>
+ <option value="reference" className="bg-ui-elevated text-ui-primary">{tc('layerFilter', 'Reference')}</option>
+ <option value="locked" className="bg-ui-elevated text-ui-primary">{t('Locked')}</option>
+ <option value="hidden" className="bg-ui-elevated text-ui-primary">{t('Hidden')}</option>
</select>
{filterResult.isActive && (
<button
@@ -1180,7 +1194,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={resetLayerFilter}
className="h-5 px-1.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[9.5px] text-ui-secondary hover:text-ui-primary shrink-0 cursor-pointer transition-colors"
>
- Reset
+ {t('Reset')}
</button>
)}
</div>
@@ -1196,8 +1210,11 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
>
<div className="flex items-center gap-1 min-w-0 text-ui-warning">
<Eye className="w-3 h-3 shrink-0" />
- <span className="truncate font-medium" title={`Isolated: ${soloedLayer.name}`}>
- Solo: {soloedLayer.name}
+ <span
+ className="truncate font-medium"
+ title={t('Isolated: {name}', { name: soloedLayer.name })}
+ >
+ {t('Solo: {name}', { name: soloedLayer.name })}
</span>
</div>
<button
@@ -1209,7 +1226,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-warning/20 hover:bg-ui-warning/30 text-ui-warning font-medium shrink-0 cursor-pointer transition-colors"
>
- Restore
+ {t('Restore')}
</button>
</div>
)}
@@ -1225,13 +1242,13 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
data-testid="layers-filter-empty"
className="py-6 px-3 text-center flex flex-col items-center gap-1.5 text-ui-muted"
>
- <span className="text-[10.5px]">No layers match filter</span>
+ <span className="text-[10.5px]">{t('No layers match filter')}</span>
<button
type="button"
onClick={resetLayerFilter}
className="px-2 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer transition-colors"
>
- Clear filter
+ {t('Clear filter')}
</button>
</div>
)}
@@ -1276,7 +1293,10 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
(layer.styles?.dropShadow?.enabled && layer.styles.dropShadow.opacity > 0) ||
(layer.styles?.outerGlow?.enabled && layer.styles.outerGlow.opacity > 0)
);
- const blendLabel = BLEND_MODE_LABELS.get(layer.blendMode) ?? layer.blendMode;
+ const blendLabel = tc(
+ 'blendMode',
+ BLEND_MODE_LABELS.get(layer.blendMode) ?? layer.blendMode
+ );
const isDefaultBlend = isFolder
? layer.blendMode === 'pass-through' || layer.blendMode === 'normal'
: layer.blendMode === 'normal';
@@ -1386,10 +1406,10 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
title={
isSoloed
- ? 'Soloed — Alt+Click to Restore All'
+ ? t('Soloed — Alt+Click to Restore All')
: layer.visible
- ? 'Hide Layer (Alt+Click to Solo)'
- : 'Show Layer (Alt+Click to Solo)'
+ ? t('Hide Layer (Alt+Click to Solo)')
+ : t('Show Layer (Alt+Click to Solo)')
}
className={`p-0.5 rounded-ui-xs transition-colors shrink-0 cursor-pointer ${
isSoloed
@@ -1406,7 +1426,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
{colorLabelPreset && (
<span
data-testid={`layer-color-tag-${layer.id}`}
- title={`Color Label: ${colorLabelPreset.name}`}
+ title={t('Color Label: {name}', { name: td(colorLabelPreset.name) })}
className="w-[3.5px] h-3.5 rounded-full shrink-0 -ml-0.5"
style={{ backgroundColor: colorLabelPreset.swatchHex }}
/>
@@ -1432,7 +1452,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
{/* Clipped Layer Angled Hairline Connector (↳) */}
{layer.clipped && (
<span
- title="Clipped to layer below"
+ title={t('Clipped to layer below')}
className="text-ui-accent/85 shrink-0 flex items-center justify-center -ml-0.5"
>
<ClipConnectorIcon className="w-3 h-3" />
@@ -1494,7 +1514,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
e.stopPropagation();
onEditVectorLayer?.(layer);
}}
- title="Non-destructive Text Layer (Double-click to edit)"
+ title={t('Non-destructive Text Layer (Double-click to edit)')}
className={`rounded-ui-xs bg-ui-input flex items-center justify-center shrink-0 ${
isActive && activeEditTarget !== 'mask'
? 'ring-1 ring-ui-accent'
@@ -1516,7 +1536,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
e.stopPropagation();
onEditVectorLayer?.(layer);
}}
- title="Non-destructive Speech Balloon (Double-click to edit)"
+ title={t('Non-destructive Speech Balloon (Double-click to edit)')}
className={`rounded-ui-xs bg-ui-input flex items-center justify-center shrink-0 ${
isActive && activeEditTarget !== 'mask'
? 'ring-1 ring-ui-accent'
@@ -1574,7 +1594,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
? 'ring-[1.5px] ring-ui-accent'
: 'ring-1 ring-ui-default'
}`}
- title="Layer Mask"
+ title={t('Layer Mask')}
>
{layer.maskThumbnailUrl ? (
<img
@@ -1609,6 +1629,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onBlur={finishRename}
onKeyDown={(e) => {
e.stopPropagation();
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') finishRename();
if (e.key === 'Escape') setEditingLayerId(null);
}}
@@ -1648,12 +1669,12 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
{/* Compact Metadata Badges */}
<div className="flex items-center gap-1 shrink-0 text-[9px] font-ui-mono tabular-nums text-ui-muted">
{layer.alphaLocked && (
- <span title="Alpha Locked" className="text-ui-accent/85 flex items-center">
+ <span title={t('Alpha Locked')} className="text-ui-accent/85 flex items-center">
<AlphaLockIcon className="w-2.5 h-2.5" />
</span>
)}
{layer.isReference && (
- <span title="Reference Layer" className="text-ui-accent/85 flex items-center">
+ <span title={t('Reference Layer')} className="text-ui-accent/85 flex items-center">
<Compass className="w-2.5 h-2.5" />
</span>
)}
@@ -1665,7 +1686,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
{!showSubMeta && layer.opacity < 0.99 && <span>{opacityPct}%</span>}
{layer.reservedByPeerId && (
<span
- title={`Locked by ${layer.reservedByPeerName || 'owner'}`}
+ title={t('Locked by {owner}', {
+ owner: layer.reservedByPeerName || t('owner'),
+ })}
className="text-ui-warning flex items-center"
>
<Shield className="w-2.5 h-2.5" />
@@ -1683,35 +1706,35 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<div className="shrink-0 border-t border-ui-subtle bg-ui-panel max-h-[45%] overflow-y-auto">
{/* Accordion 1: Monochrome Expression Color & Color Threshold */}
<SectionDisclosure
- title="Expression Color"
+ title={t('Expression Color')}
dense
open={isExpressionAccordionOpen}
onToggle={() => setIsExpressionAccordionOpen((p) => !p)}
summary={
activeLayer.expressionColor === 'monochrome'
- ? 'Mono'
+ ? tc('expressionColor', 'Mono')
: activeLayer.expressionColor === 'gray'
- ? 'Gray'
- : 'Color'
+ ? t('Gray')
+ : t('Color')
}
>
<SegmentedControl<ExpressionColor>
size="xs"
fullWidth
- aria-label="Expression Color"
+ aria-label={t('Expression Color')}
value={activeLayer.expressionColor || 'color'}
onChange={(mode) => onSetLayerExpressionColor?.(activeLayer.id, mode)}
options={[
- { value: 'color', label: 'Color' },
- { value: 'gray', label: 'Gray' },
- { value: 'monochrome', label: 'Mono' },
+ { value: 'color', label: t('Color') },
+ { value: 'gray', label: t('Gray') },
+ { value: 'monochrome', label: tc('expressionColor', 'Mono') },
]}
/>
{(activeLayer.expressionColor || 'color') === 'monochrome' && (
<div className="space-y-2">
<ScrubSlider
- label="Threshold"
+ label={t('Threshold')}
size="xs"
min={1}
max={255}
@@ -1722,7 +1745,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
/>
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Express</span>
+ <span className="text-ui-muted">{t('Express')}</span>
<div className="flex items-center gap-1">
<button
type="button"
@@ -1739,7 +1762,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
: 'bg-ui-input text-ui-muted border-ui-subtle hover:text-ui-primary'
}`}
>
- Black
+ {t('Black')}
</button>
<button
type="button"
@@ -1756,7 +1779,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
: 'bg-ui-input text-ui-muted border-ui-subtle hover:text-ui-primary'
}`}
>
- White
+ {t('White')}
</button>
</div>
</div>
@@ -1769,14 +1792,14 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => onApplyExpressionColor?.(activeLayer.id)}
className="w-full py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- Apply Expression Color
+ {t('Apply Expression Color')}
</button>
)}
</SectionDisclosure>
{/* Accordion 2: Screentone & Layer Tint */}
<SectionDisclosure
- title="Tone & Tint"
+ title={t('Tone & Tint')}
dense
open={isEffectsAccordionOpen}
onToggle={() => setIsEffectsAccordionOpen((p) => !p)}
@@ -1784,7 +1807,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
activeLayer.toneEnabled
? `${activeLayer.toneFrequency ?? 60}L`
: activeLayer.layerColorEnabled
- ? 'Tint'
+ ? t('Tint')
: undefined
}
summaryTone={
@@ -1795,7 +1818,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
>
<ToggleSwitch
size="xs"
- label="Screentone"
+ label={t('Screentone')}
checked={Boolean(activeLayer.toneEnabled)}
onChange={() => onToggleTone?.(activeLayer.id)}
/>
@@ -1805,7 +1828,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={onCreateToneLayer}
className="w-full h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover text-[10px] text-ui-primary border border-ui-subtle transition-colors cursor-pointer"
>
- New Screentone Layer...
+ {t('New Screentone Layer...')}
</button>
)}
@@ -1815,7 +1838,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<div className="space-y-2">
{isToneLayer ? (
<ScrubSlider
- label="Density"
+ label={t('Density')}
size="xs"
min={1}
max={100}
@@ -1829,13 +1852,13 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
/>
) : (
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Density</span>
- <span className="font-ui-mono text-ui-secondary">Layer tones</span>
+ <span>{t('Density')}</span>
+ <span className="font-ui-mono text-ui-secondary">{t('Layer tones')}</span>
</div>
)}
<ScrubSlider
- label="Frequency"
+ label={t('Frequency')}
size="xs"
min={20}
max={85}
@@ -1849,7 +1872,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
/>
<ScrubSlider
- label="Angle"
+ label={t('Angle')}
size="xs"
min={0}
max={90}
@@ -1870,10 +1893,10 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}
className="w-full h-6 px-1.5 text-[10px] bg-ui-input border border-ui-subtle rounded-ui-xs text-ui-primary"
>
- <option value="circle" className="bg-ui-elevated text-ui-primary">Circle Dot</option>
- <option value="euclidean" className="bg-ui-elevated text-ui-primary">Euclidean Dot</option>
- <option value="line" className="bg-ui-elevated text-ui-primary">Line (Hatching)</option>
- <option value="diamond" className="bg-ui-elevated text-ui-primary">Diamond</option>
+ <option value="circle" className="bg-ui-elevated text-ui-primary">{t('Circle Dot')}</option>
+ <option value="euclidean" className="bg-ui-elevated text-ui-primary">{t('Euclidean Dot')}</option>
+ <option value="line" className="bg-ui-elevated text-ui-primary">{t('Line (Hatching)')}</option>
+ <option value="diamond" className="bg-ui-elevated text-ui-primary">{t('Diamond')}</option>
</select>
</div>
);
@@ -1881,7 +1904,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<ToggleSwitch
size="xs"
- label="Layer Tint"
+ label={t('Layer Tint')}
checked={Boolean(activeLayer.layerColorEnabled)}
onChange={() => onToggleLayerColor?.(activeLayer.id)}
/>
@@ -1889,7 +1912,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
{activeLayer.layerColorEnabled && (
<div className="space-y-1.5">
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Main</span>
+ <span className="text-ui-muted">{t('Main')}</span>
<input
type="color"
value={activeLayer.layerColor || '#1c73c2'}
@@ -1898,7 +1921,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
/>
</div>
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Sub</span>
+ <span className="text-ui-muted">{t('Sub')}</span>
<input
type="color"
value={activeLayer.layerSubColor || '#ffffff'}
@@ -1911,7 +1934,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onClick={() => onApplyLayerColor?.(activeLayer.id)}
className="w-full py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- Apply Tint
+ {t('Apply Tint')}
</button>
</div>
)}
@@ -1928,7 +1951,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<IconButton
size="xs"
onClick={() => onAddLayer('raster')}
- title="New Layer (Ctrl+Shift+N)"
+ title={t('New Layer (Ctrl+Shift+N)')}
icon={<Plus className="w-3.5 h-3.5" />}
/>
<IconButton
@@ -1940,7 +1963,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onAddLayer('folder');
}
}}
- title="New Folder / Group (Ctrl+G)"
+ title={t('New Folder / Group (Ctrl+G)')}
icon={<FolderPlus className="w-3 h-3" />}
/>
{(onAddLayerMask || onToggleLayerMask) && (
@@ -1959,9 +1982,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
title={
activeLayerHasMask
? activeLayer?.maskEnabled === false
- ? 'Enable Layer Mask'
- : 'Toggle Layer Mask'
- : 'Add Layer Mask'
+ ? t('Enable Layer Mask')
+ : t('Toggle Layer Mask')
+ : t('Add Layer Mask')
}
icon={<LayerMaskIcon className="w-3 h-3" />}
/>
@@ -1970,7 +1993,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<IconButton
size="xs"
onClick={() => onOpenAdjustmentModal(undefined, 'curves')}
- title="New Adjustment Layer"
+ title={t('New Adjustment Layer')}
icon={<SlidersHorizontal className="w-3 h-3" />}
/>
)}
@@ -1979,7 +2002,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
size="xs"
disabled={!activeLayerCanHaveStyles}
onClick={() => activeLayer && onOpenLayerStylesModal(activeLayer.id)}
- title="Layer Styles (fx)"
+ title={t('Layer Styles (fx)')}
label="fx"
className="px-1 font-ui-mono"
/>
@@ -1991,7 +2014,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
<IconButton
size="xs"
onClick={() => onDuplicateLayer(activeLayer.id)}
- title="Duplicate Layer (Ctrl+J)"
+ title={t('Duplicate Layer (Ctrl+J)')}
icon={<Copy className="w-3 h-3" />}
/>
)}
@@ -2006,7 +2029,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onDeleteLayer(activeLayerId);
}
}}
- title="Delete Layer"
+ title={t('Delete Layer')}
icon={<Trash2 className="w-3 h-3" />}
/>
</div>
@@ -2018,7 +2041,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
/* History Tab */
<div className="flex-1 overflow-y-auto px-1.5 py-1 space-y-0.5 min-h-0">
{!hasOpenDocument || historyList.length === 0 ? (
- <div className="p-4 text-center text-[11px] text-ui-muted">No history</div>
+ <div className="p-4 text-center text-[11px] text-ui-muted">{t('No history')}</div>
) : (
historyList.map((item, idx) => {
const isActive = idx === historyIndex;
@@ -2042,7 +2065,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
className="pointer-events-none absolute left-0 top-1 bottom-1 w-[2px] rounded-full bg-ui-accent"
/>
)}
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{td(item.label)}</span>
<span className="text-[9px] font-ui-mono tabular-nums text-ui-muted shrink-0">
{item.timeFormatted}
</span>
@@ -2059,7 +2082,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
className="pointer-events-none absolute inset-0 z-40 rounded-ui-xs border-2 border-dashed border-ui-accent bg-ui-accent-subtle flex items-end justify-center p-2"
>
<span className="px-2 py-0.5 rounded-ui-xs bg-ui-floating border border-ui-accent-border text-[10px] font-medium text-ui-primary shadow-ui-floating">
- Drop image to import layer
+ {t('Drop image to import layer')}
</span>
</div>
)}
@@ -2113,7 +2136,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onSetLayerColorLabel(targetLayer.id, preset.id);
setContextMenu(null);
}}
- title={`Color Label: ${preset.name}`}
+ title={t('Color Label: {name}', { name: td(preset.name) })}
className={`w-3.5 h-3.5 rounded-full flex items-center justify-center transition-transform hover:scale-110 cursor-pointer ${
isPicked
? 'ring-2 ring-ui-accent ring-offset-1 ring-offset-[var(--ui-bg-elevated)]'
@@ -2143,9 +2166,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover flex items-center justify-between cursor-pointer"
>
<span>
- {soloLayerId === targetLayer.id ? 'Exit Solo Mode' : 'Solo / Isolate Layer'}
+ {soloLayerId === targetLayer.id ? t('Exit Solo Mode') : t('Solo / Isolate Layer')}
</span>
- <span className="text-[9px] text-ui-muted font-ui-mono">Alt+Eye</span>
+ <span className="text-[9px] text-ui-muted font-ui-mono">{t('Alt+Eye')}</span>
</button>
)}
@@ -2162,7 +2185,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Add Layer Mask
+ {t('Add Layer Mask')}
</button>
) : (
<>
@@ -2174,7 +2197,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- {targetLayer.maskEnabled === false ? 'Enable Mask' : 'Disable Mask'}
+ {targetLayer.maskEnabled === false ? t('Enable Mask') : t('Disable Mask')}
</button>
<button
type="button"
@@ -2184,7 +2207,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover flex items-center justify-between cursor-pointer"
>
- <span>{targetLayer.maskLinked === false ? 'Link Mask' : 'Unlink Mask'}</span>
+ <span>{targetLayer.maskLinked === false ? t('Link Mask') : t('Unlink Mask')}</span>
<Link2 className="w-3 h-3 text-ui-icon-muted" />
</button>
<button
@@ -2195,7 +2218,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-danger/15 text-ui-danger cursor-pointer"
>
- Delete Mask
+ {t('Delete Mask')}
</button>
</>
)}
@@ -2212,7 +2235,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Edit Adjustment...
+ {t('Edit Adjustment...')}
</button>
)}
@@ -2226,7 +2249,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- New Screentone Layer...
+ {t('New Screentone Layer...')}
</button>
<div className="my-0.5 border-t border-ui-subtle" />
</>
@@ -2244,7 +2267,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover capitalize cursor-pointer"
>
- New {adjType.replace('-', ' ')}...
+ {t(`New ${adjType.replace('-', ' ')}...`)}
</button>
))}
<div className="my-0.5 border-t border-ui-subtle" />
@@ -2260,7 +2283,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover text-ui-accent cursor-pointer"
>
- {targetLayer.type === 'text' ? 'Edit Text...' : 'Edit Speech Balloon...'}
+ {targetLayer.type === 'text' ? t('Edit Text...') : t('Edit Speech Balloon...')}
</button>
)}
@@ -2276,7 +2299,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Rasterize Layer
+ {t('Rasterize Layer')}
</button>
)}
@@ -2291,7 +2314,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Layer Styles...
+ {t('Layer Styles...')}
</button>
)}
@@ -2311,7 +2334,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
: 'hover:bg-ui-control-hover cursor-pointer'
}`}
>
- Merge Folder
+ {t('Merge Folder')}
</button>
)}
{onTransformLayer && (
@@ -2328,7 +2351,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
: 'hover:bg-ui-control-hover cursor-pointer'
}`}
>
- Transform Folder (Ctrl+T)
+ {t('Transform Folder (Ctrl+T)')}
</button>
)}
<div className="my-0.5 border-t border-ui-subtle" />
@@ -2344,7 +2367,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Group (Ctrl+G)
+ {t('Group (Ctrl+G)')}
</button>
)}
@@ -2356,7 +2379,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Duplicate
+ {t('Duplicate')}
</button>
<button
@@ -2367,7 +2390,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-control-hover cursor-pointer"
>
- Rename
+ {t('Rename')}
</button>
{targetLayer.id !== 'layer-bg' && (
@@ -2383,7 +2406,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
}}
className="w-full text-left px-2.5 py-1 rounded-ui-xs hover:bg-ui-danger/15 text-ui-danger cursor-pointer"
>
- Delete
+ {t('Delete')}
</button>
)}
</div>
diff --git a/src/components/SelectionOverlay.tsx b/src/components/SelectionOverlay.tsx
index a4b7321..7d59d64 100644
--- a/src/components/SelectionOverlay.tsx
+++ b/src/components/SelectionOverlay.tsx
@@ -18,6 +18,7 @@ import {
Feather,
} from 'lucide-react';
import { maskToSvgPath } from '../utils/selectionUtils';
+import { useI18n } from '../i18n';
interface SelectionOverlayProps {
selection: CanvasSelection | null;
@@ -59,6 +60,7 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
onContractSelection,
onFeatherSelection,
}) => {
+ const { t, tc } = useI18n();
const floatingCanvasContainerRef = useRef<HTMLDivElement>(null);
// Synchronize floating canvas DOM node
@@ -155,27 +157,27 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onDeselect}
- title="Deselect (Ctrl+D)"
+ title={t('Deselect (Ctrl+D)')}
className="px-1.5 py-1 text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
- <span>Deselect</span>
+ <span>{t('Deselect')}</span>
</button>
<button
type="button"
onClick={onInvertSelection}
- title="Invert Selection (Ctrl+Shift+I)"
+ title={t('Invert Selection (Ctrl+Shift+I)')}
className="px-1.5 py-1 text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<RotateCcw className="w-3.5 h-3.5" />
- <span>Invert</span>
+ <span>{t('Invert')}</span>
</button>
<button
type="button"
onClick={() => onExpandSelection?.(5)}
- title="Expand Selection (+5px)"
+ title={t('Expand Selection (+5px)')}
className="p-1 text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<Maximize2 className="w-3.5 h-3.5" />
@@ -184,7 +186,7 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={() => onContractSelection?.(5)}
- title="Contract Selection (-5px)"
+ title={t('Contract Selection (-5px)')}
className="p-1 text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<Minimize2 className="w-3.5 h-3.5" />
@@ -193,7 +195,7 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={() => onFeatherSelection?.(5)}
- title="Feather Selection (5px)"
+ title={t('Feather Selection (5px)')}
className="p-1 text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<Feather className="w-3.5 h-3.5" />
@@ -205,11 +207,11 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onCutSelection}
- title="Cut Selection (Ctrl+X)"
+ title={t('Cut Selection (Ctrl+X)')}
className="px-1.5 py-1 text-ui-primary hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<Scissors className="w-3.5 h-3.5" />
- <span>Cut</span>
+ <span>{t('Cut')}</span>
</button>
)}
@@ -217,11 +219,11 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onCopySelection}
- title="Copy Selection (Ctrl+C)"
+ title={t('Copy Selection (Ctrl+C)')}
className="px-1.5 py-1 text-ui-primary hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<Copy className="w-3.5 h-3.5" />
- <span>Copy</span>
+ <span>{t('Copy')}</span>
</button>
)}
@@ -229,11 +231,11 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onPasteSelection}
- title="Paste to New Layer (Ctrl+V)"
+ title={t('Paste to New Layer (Ctrl+V)')}
className="px-1.5 py-1 text-ui-primary hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<ClipboardPaste className="w-3.5 h-3.5" />
- <span>Paste</span>
+ <span>{t('Paste')}</span>
</button>
)}
@@ -241,11 +243,11 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onMoveSelectionToNewLayer}
- title="Move Selected Section to New Layer (Ctrl+Shift+J)"
+ title={t('Move Selected Section to New Layer (Ctrl+Shift+J)')}
className="px-1.5 py-1 text-ui-accent hover:bg-ui-control-hover rounded-ui-xs flex items-center gap-1 font-medium transition-colors cursor-pointer"
>
<Layers className="w-3.5 h-3.5" />
- <span>To Layer</span>
+ <span>{t('To Layer')}</span>
</button>
)}
@@ -254,22 +256,22 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onClearSelection}
- title="Delete Selected Section (Del)"
+ title={t('Delete Selected Section (Del)')}
className="px-1.5 py-1 text-ui-secondary hover:text-ui-danger hover:bg-ui-danger/15 rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<Trash2 className="w-3.5 h-3.5" />
- <span>Delete</span>
+ <span>{t('Delete')}</span>
</button>
{onDeleteOutsideSelection && (
<button
type="button"
onClick={onDeleteOutsideSelection}
- title="Delete Outside Selected Section"
+ title={t('Delete Outside Selected Section')}
className="px-1.5 py-1 text-ui-secondary hover:text-ui-danger hover:bg-ui-danger/15 rounded-ui-xs flex items-center gap-1 transition-colors cursor-pointer"
>
<Crop className="w-3.5 h-3.5" />
- <span>Del Outside</span>
+ <span>{t('Del Outside')}</span>
</button>
)}
@@ -278,28 +280,28 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
<button
type="button"
onClick={onFillColor}
- title="Fill with Foreground Color"
+ title={t('Fill with Foreground Color')}
className="px-2 py-1 text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
- Fill
+ {tc('action', 'Fill')}
</button>
<button
type="button"
onClick={onFillScreentone}
- title="Fill Screentone into New Layer"
+ title={t('Fill Screentone into New Layer')}
className="px-2 py-1 bg-ui-accent-subtle hover:bg-ui-accent-hover text-ui-accent border border-ui-accent-border rounded-ui-xs transition-colors cursor-pointer font-medium"
>
- Screentone
+ {t('Screentone')}
</button>
<button
type="button"
onClick={onTransformSelection}
- title="Transform Selection (Ctrl+T)"
+ title={t('Transform Selection (Ctrl+T)')}
className="px-2 py-1 text-ui-primary hover:bg-ui-control-hover rounded-ui-xs font-medium transition-colors cursor-pointer"
>
- Transform
+ {t('Transform')}
</button>
</div>,
document.body
diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsx
index de5a0e1..6d76072 100644
--- a/src/components/SettingsModal.tsx
+++ b/src/components/SettingsModal.tsx
@@ -28,7 +28,9 @@ import {
RefreshCw,
Minus,
Plus,
+ Globe,
} from 'lucide-react';
+import { AppLanguage, detectSystemLanguage, isImeComposing, useI18n } from '../i18n';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
import { updaterService } from '../services/updaterService';
import { useUpdaterStore } from '../stores/useUpdaterStore';
@@ -161,6 +163,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
onUpdateSettings,
onShowToast,
}) => {
+ const { t, tc, td, lang } = useI18n();
const [activeTab, setActiveTab] = useState<SettingsTab>('appearance');
const [localSettings, setLocalSettings] = useState<AppSettings>(() => ({
...DEFAULT_APP_SETTINGS,
@@ -191,7 +194,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
const allCommands = useMemo(
() => [...DEFAULT_COMMANDS, ...buildSubToolShortcutCommands(customBrushes, customSubToolGroups)],
- [customBrushes, customSubToolGroups]
+ [customBrushes, customSubToolGroups, lang]
);
useEffect(() => {
@@ -326,15 +329,23 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
if (selectedCategory !== 'All' && cmd.category !== selectedCategory) return false;
if (!q) return true;
const bound = formatShortcutLabel(resolveCommandShortcut(cmd, localSettings.shortcuts));
+ const trLabel = td(cmd.label);
+ const trDesc = td(cmd.description);
+ const trCat = td(cmd.category);
+ const trGroup = cmd.groupBadge ? td(cmd.groupBadge) : '';
return (
cmd.label.toLowerCase().includes(q) ||
+ trLabel.toLowerCase().includes(q) ||
cmd.description.toLowerCase().includes(q) ||
+ trDesc.toLowerCase().includes(q) ||
cmd.category.toLowerCase().includes(q) ||
+ trCat.toLowerCase().includes(q) ||
(cmd.groupBadge && cmd.groupBadge.toLowerCase().includes(q)) ||
+ (trGroup && trGroup.toLowerCase().includes(q)) ||
bound.toLowerCase().includes(q)
);
});
- }, [allCommands, searchQuery, selectedCategory, localSettings.shortcuts]);
+ }, [allCommands, searchQuery, selectedCategory, localSettings.shortcuts, td]);
if (!isOpen) return null;
@@ -369,7 +380,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
setDraftInterfaceScale(DEFAULT_INTERFACE_SCALE);
setInterfaceScaleInput(String(DEFAULT_INTERFACE_SCALE));
onUpdateSettings(fresh);
- onShowToast('Preferences reset to defaults');
+ onShowToast(t('Preferences reset to defaults'));
};
const handleConfirmConflictReplace = () => {
@@ -387,7 +398,9 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
setLocalSettings(updated);
onUpdateSettings(updated);
setPendingConflict(null);
- onShowToast(`Assigned ${formatShortcutLabel(pendingConflict.shortcut)}`);
+ onShowToast(
+ t('Assigned {shortcut}', { shortcut: formatShortcutLabel(pendingConflict.shortcut) })
+ );
};
const handleResetSingleShortcut = (commandId: string) => {
@@ -411,7 +424,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
setRecordingCommandId(null);
setPendingConflict(null);
handleChange('shortcuts', {});
- onShowToast('Shortcuts reset to defaults');
+ onShowToast(t('Shortcuts reset to defaults'));
};
const handleModifierSlotChange = (slot: ModifierKeySlot, action: ModifierAction) => {
@@ -430,7 +443,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
const handleResetModifiers = () => {
handleChange('modifierKeys', { ...DEFAULT_MODIFIER_KEY_SETTINGS });
- onShowToast('Modifier keys reset to defaults');
+ onShowToast(t('Modifier keys reset to defaults'));
};
const handleResetCollaboration = () => {
@@ -443,7 +456,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
};
setLocalSettings(updated);
onUpdateSettings(updated);
- onShowToast('Collaboration network settings reset to defaults');
+ onShowToast(t('Collaboration network settings reset to defaults'));
};
const handleSelectLookPreset = (presetId: BuiltInLookPresetId) => {
@@ -474,18 +487,18 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
};
const tabs: Array<{ id: SettingsTab; label: string; icon: React.ReactNode }> = [
- { id: 'appearance', label: 'Appearance', icon: <Palette className="w-3.5 h-3.5" /> },
- { id: 'canvas', label: 'Canvas', icon: <Layers className="w-3.5 h-3.5" /> },
- { id: 'brush', label: 'Brush & Stylus', icon: <Paintbrush className="w-3.5 h-3.5" /> },
- { id: 'performance', label: 'Performance', icon: <Gauge className="w-3.5 h-3.5" /> },
- { id: 'collaboration', label: 'Collaboration', icon: <Users className="w-3.5 h-3.5" /> },
- { id: 'shortcuts', label: 'Shortcuts', icon: <Keyboard className="w-3.5 h-3.5" /> },
+ { id: 'appearance', label: t('Appearance'), icon: <Palette className="w-3.5 h-3.5" /> },
+ { id: 'canvas', label: t('Canvas'), icon: <Layers className="w-3.5 h-3.5" /> },
+ { id: 'brush', label: t('Brush & Stylus'), icon: <Paintbrush className="w-3.5 h-3.5" /> },
+ { id: 'performance', label: t('Performance'), icon: <Gauge className="w-3.5 h-3.5" /> },
+ { id: 'collaboration', label: t('Collaboration'), icon: <Users className="w-3.5 h-3.5" /> },
+ { id: 'shortcuts', label: t('Shortcuts'), icon: <Keyboard className="w-3.5 h-3.5" /> },
{
id: 'modifiers',
- label: 'Modifier Keys',
+ label: t('Modifier Keys'),
icon: <SlidersHorizontal className="w-3.5 h-3.5" />,
},
- { id: 'about', label: 'About', icon: <Info className="w-3.5 h-3.5" /> },
+ { id: 'about', label: t('About'), icon: <Info className="w-3.5 h-3.5" /> },
];
return (
@@ -495,6 +508,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="fixed inset-0 z-50 flex items-center justify-center bg-ui-overlay p-4 select-none"
onClick={onClose}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !recordingCommandId) onClose();
}}
>
@@ -504,12 +518,12 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
>
{/* Header */}
<div className="h-10 px-4 flex items-center justify-between bg-ui-header border-b border-ui-subtle shrink-0">
- <span className="text-xs font-medium text-ui-primary">Preferences</span>
+ <span className="text-xs font-medium text-ui-primary">{t('Preferences')}</span>
<button
type="button"
onClick={onClose}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Close (Esc)"
+ title={t('Close (Esc)')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -520,14 +534,14 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
{/* Left Navigation */}
<div className="w-44 bg-ui-header border-r border-ui-subtle p-2 flex flex-col justify-between gap-2 shrink-0 min-h-0">
<div className="space-y-0.5 overflow-y-auto min-h-0">
- {tabs.map((t) => {
- const active = activeTab === t.id;
+ {tabs.map((tab) => {
+ const active = activeTab === tab.id;
return (
<button
- key={t.id}
+ key={tab.id}
type="button"
onClick={() => {
- setActiveTab(t.id);
+ setActiveTab(tab.id);
setRecordingCommandId(null);
setPendingConflict(null);
}}
@@ -537,8 +551,8 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- <span className={active ? 'text-ui-accent' : ''}>{t.icon}</span>
- <span>{t.label}</span>
+ <span className={active ? 'text-ui-accent' : ''}>{tab.icon}</span>
+ <span>{tab.label}</span>
</button>
);
})}
@@ -550,7 +564,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-ui-sm text-[11px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset All Defaults</span>
+ <span>{t('Reset All Defaults')}</span>
</button>
</div>
@@ -558,13 +572,71 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="flex-1 p-5 overflow-y-auto bg-ui-panel space-y-5">
{activeTab === 'appearance' && (
<>
+ <section
+ className="p-3 rounded-ui-md bg-ui-header border border-ui-default flex flex-wrap items-center justify-between gap-3"
+ data-testid="settings-language-section"
+ >
+ <div className="min-w-0">
+ <div className="flex items-center gap-1.5">
+ <Globe className="w-3.5 h-3.5 text-ui-accent shrink-0" />
+ <h3 className="text-xs font-medium text-ui-primary">
+ {lang === 'ja' ? '言語 (Language)' : 'Language / 言語'}
+ </h3>
+ </div>
+ <p className="text-[11px] text-ui-muted mt-0.5">
+ {t('Choose the display language for menus, panels, tools, and dialogs')}
+ </p>
+ </div>
+ <div className="flex items-center gap-1 bg-ui-input p-0.5 rounded-ui-sm border border-ui-subtle shrink-0">
+ {(
+ [
+ {
+ value: 'auto' as AppLanguage,
+ label: t('System Default ({lang})', {
+ lang: detectSystemLanguage() === 'ja' ? '日本語' : 'English',
+ }),
+ },
+ { value: 'en' as AppLanguage, label: 'English' },
+ { value: 'ja' as AppLanguage, label: '日本語' },
+ ] as const
+ ).map((opt) => {
+ const active = (localSettings.language ?? 'auto') === opt.value;
+ return (
+ <button
+ key={opt.value}
+ type="button"
+ data-testid={`settings-lang-${opt.value}`}
+ onClick={() => {
+ handleChange('language', opt.value);
+ const nextResolved =
+ opt.value === 'auto' ? detectSystemLanguage() : opt.value;
+ const langLabel = nextResolved === 'ja' ? '日本語' : 'English';
+ onShowToast(
+ nextResolved === 'ja'
+ ? `表示言語を${langLabel}に変更しました`
+ : `Language changed to ${langLabel}`
+ );
+ }}
+ className={`h-6 px-2.5 rounded-ui-xs text-[11px] transition-colors cursor-pointer ${
+ active
+ ? 'bg-ui-control-active text-ui-primary font-medium border border-ui-accent-border'
+ : 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border border-transparent'
+ }`}
+ >
+ {opt.label}
+ </button>
+ );
+ })}
+ </div>
+ </section>
+
<section className="p-3 rounded-ui-md bg-ui-header border border-ui-default flex items-center justify-between gap-3">
<div className="min-w-0">
<h3 className="text-xs font-medium text-ui-primary">
- Live Appearance Studio
+ {t('Live Appearance Studio')}
</h3>
<p className="text-[11px] text-ui-muted">
- Fine-tune brightness, warmth, accent, chrome, density, and custom tokens live over your canvas
+ {t('Fine-tune brightness, warmth, accent, chrome, density, and custom tokens live over your canvas')}
</p>
</div>
<button
@@ -574,16 +646,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="h-7 px-3 rounded-ui-sm bg-ui-control-active hover:bg-ui-control-hover border border-ui-accent-border text-xs font-medium text-ui-primary flex items-center gap-1.5 shrink-0 transition-colors cursor-pointer"
>
<Palette className="w-3.5 h-3.5 text-ui-accent shrink-0" />
- <span>Open Live Appearance Studio</span>
+ <span>{t('Open Live Appearance Studio')}</span>
</button>
</section>
<section className="space-y-2.5" data-testid="settings-look-presets-section">
<div className="flex items-center justify-between">
<div>
- <h3 className="text-xs font-medium text-ui-primary">Look Presets</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Look Presets')}</h3>
<p className="text-[11px] text-ui-muted">
- Calibrated studio palettes for color-accurate dark, neutral 18%, and daylight work
+ {t('Calibrated studio palettes for color-accurate dark, neutral 18%, and daylight work')}
</p>
</div>
</div>
@@ -612,22 +684,25 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<section className="space-y-2.5" data-testid="settings-interface-size-section">
<div className="flex items-center justify-between gap-2">
<div>
- <h3 className="text-xs font-medium text-ui-primary">Interface Size</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Interface Size')}</h3>
<p className="text-[11px] text-ui-muted tabular-nums">
- Adjust UI scale for menus, panels, and controls ({MIN_INTERFACE_SCALE}%–{MAX_INTERFACE_SCALE}%)
+ {t('Adjust UI scale for menus, panels, and controls ({min}%–{max}%)', {
+ min: MIN_INTERFACE_SCALE,
+ max: MAX_INTERFACE_SCALE,
+ })}
</p>
</div>
<div className="flex items-center gap-1 shrink-0">
<button
type="button"
data-testid="settings-interface-scale-dec"
- aria-label="Decrease Interface Size"
+ aria-label={t('Decrease Interface Size')}
disabled={draftInterfaceScale <= MIN_INTERFACE_SCALE}
onClick={() =>
commitInterfaceScale(draftInterfaceScale - INTERFACE_SCALE_STEP)
}
className="w-6 h-6 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-muted hover:text-ui-primary flex items-center justify-center transition-colors cursor-pointer disabled:opacity-35 disabled:cursor-not-allowed"
- title={`Decrease (-${INTERFACE_SCALE_STEP}%)`}
+ title={t('Decrease (-{step}%)', { step: INTERFACE_SCALE_STEP })}
>
<Minus className="w-3 h-3" />
</button>
@@ -635,7 +710,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<input
type="number"
data-testid="settings-interface-scale-input"
- aria-label="Interface Size Percentage"
+ aria-label={t('Interface Size Percentage')}
min={MIN_INTERFACE_SCALE}
max={MAX_INTERFACE_SCALE}
step={INTERFACE_SCALE_STEP}
@@ -650,6 +725,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
}
}}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
const parsed = Number(interfaceScaleInput);
if (Number.isFinite(parsed)) {
@@ -667,13 +743,13 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<button
type="button"
data-testid="settings-interface-scale-inc"
- aria-label="Increase Interface Size"
+ aria-label={t('Increase Interface Size')}
disabled={draftInterfaceScale >= MAX_INTERFACE_SCALE}
onClick={() =>
commitInterfaceScale(draftInterfaceScale + INTERFACE_SCALE_STEP)
}
className="w-6 h-6 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-muted hover:text-ui-primary flex items-center justify-center transition-colors cursor-pointer disabled:opacity-35 disabled:cursor-not-allowed"
- title={`Increase (+${INTERFACE_SCALE_STEP}%)`}
+ title={t('Increase (+{step}%)', { step: INTERFACE_SCALE_STEP })}
>
<Plus className="w-3 h-3" />
</button>
@@ -683,9 +759,9 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
disabled={draftInterfaceScale === DEFAULT_INTERFACE_SCALE}
onClick={() => commitInterfaceScale(DEFAULT_INTERFACE_SCALE)}
className="h-6 px-2 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer disabled:opacity-35 disabled:cursor-not-allowed"
- title="Reset Interface Size to 100%"
+ title={t('Reset Interface Size to 100%')}
>
- Reset
+ {t('Reset')}
</button>
</div>
</div>
@@ -695,7 +771,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<input
type="range"
data-testid="settings-interface-scale-slider"
- aria-label="Interface Size"
+ aria-label={t('Interface Size')}
min={MIN_INTERFACE_SCALE}
max={MAX_INTERFACE_SCALE}
step={INTERFACE_SCALE_STEP}
@@ -762,7 +838,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
</section>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Artist Name</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Artist Name')}</h3>
<input
type="text"
value={localSettings.userName || ''}
@@ -772,16 +848,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
safeLocalStorageSetItem(NICKNAME_STORAGE_KEY, val, 'artist name');
safeLocalStorageSetItem(NICKNAME_CUSTOMIZED_STORAGE_KEY, val.trim() ? '1' : '0', 'artist name flag');
}}
- placeholder="Artist"
+ placeholder={t('Artist')}
className="w-full bg-ui-input border border-ui-default px-3 py-1.5 rounded-ui-sm text-xs text-ui-primary placeholder:text-ui-muted/60"
/>
</section>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Viewport Overlays</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Viewport Overlays')}</h3>
<div className="space-y-1 bg-ui-header border border-ui-subtle rounded-ui-md p-2.5">
<label className="flex items-center justify-between py-1 cursor-pointer">
- <span className="text-xs text-ui-primary">Transparency Checkerboard</span>
+ <span className="text-xs text-ui-primary">{t('Transparency Checkerboard')}</span>
<input
type="checkbox"
checked={localSettings.showCheckerboard}
@@ -789,7 +865,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
/>
</label>
<label className="flex items-center justify-between py-1 cursor-pointer">
- <span className="text-xs text-ui-primary">Cursor Coordinates</span>
+ <span className="text-xs text-ui-primary">{t('Cursor Coordinates')}</span>
<input
type="checkbox"
checked={localSettings.showCursorCoordinates}
@@ -797,7 +873,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
/>
</label>
<label className="flex items-center justify-between py-1 cursor-pointer">
- <span className="text-xs text-ui-primary">Stylus Pressure Readout</span>
+ <span className="text-xs text-ui-primary">{t('Stylus Pressure Readout')}</span>
<input
type="checkbox"
checked={localSettings.showPressureInStatusBar}
@@ -812,10 +888,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
{activeTab === 'canvas' && (
<>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Default Dimensions</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Default Dimensions')}</h3>
<div className="grid grid-cols-2 gap-2.5">
<div className="space-y-1">
- <label className="text-[11px] text-ui-muted">Width (px)</label>
+ <label className="text-[11px] text-ui-muted">{t('Width (px)')}</label>
<input
type="number"
min="64"
@@ -826,7 +902,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
/>
</div>
<div className="space-y-1">
- <label className="text-[11px] text-ui-muted">Height (px)</label>
+ <label className="text-[11px] text-ui-muted">{t('Height (px)')}</label>
<input
type="number"
min="64"
@@ -840,7 +916,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
</section>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Resolution (DPI)</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Resolution (DPI)')}</h3>
<div className="grid grid-cols-6 gap-1.5">
{DPI_PRESETS.map((p) => {
const selected = localSettings.defaultDpi === p.dpi;
@@ -863,7 +939,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
</section>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Color Mode</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Color Mode')}</h3>
<div className="grid grid-cols-3 gap-1.5">
{(['color', 'grayscale', 'monochrome'] as CanvasColorMode[]).map((mode) => {
const selected = localSettings.defaultColorMode === mode;
@@ -878,7 +954,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
: 'bg-ui-header text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {mode}
+ {tc('colorMode', mode)}
</button>
);
})}
@@ -887,9 +963,11 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<section className="p-3 rounded-ui-md bg-ui-header border border-ui-subtle flex items-center justify-between gap-3">
<div>
- <h3 className="text-xs font-medium text-ui-primary">RAM, GPU & Scratch Disk</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('RAM, GPU & Scratch Disk')}</h3>
<p className="text-[11px] text-ui-muted tabular-nums">
- Configure RAM allocation ({localSettings.tileMemoryBudgetMb || 1024} MB), GPU adapter, and rendering optimization
+ {t('Configure RAM allocation ({mb} MB), GPU adapter, and rendering optimization', {
+ mb: localSettings.tileMemoryBudgetMb || 1024,
+ })}
</p>
</div>
<button
@@ -897,7 +975,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
onClick={() => setActiveTab('performance')}
className="px-2.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] text-ui-primary font-medium shrink-0 cursor-pointer transition-colors"
>
- Open Performance
+ {t('Open Performance')}
</button>
</section>
</>
@@ -920,10 +998,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="flex items-center justify-between gap-3">
<div>
<h3 className="text-xs font-medium text-ui-primary">
- Collaborative Drawing (WebRTC P2P)
+ {t('Collaborative Drawing (WebRTC P2P)')}
</h3>
<p className="text-[11px] text-ui-muted">
- Configure your display nickname and optional custom signaling or TURN relay servers for P2P rooms
+ {t('Configure your display nickname and optional custom signaling or TURN relay servers for P2P rooms')}
</p>
</div>
<button
@@ -933,12 +1011,12 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="flex items-center gap-1 px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary cursor-pointer shrink-0 transition-colors"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
<section className="space-y-2">
- <h4 className="text-xs font-medium text-ui-primary">Artist Nickname</h4>
+ <h4 className="text-xs font-medium text-ui-primary">{t('Artist Nickname')}</h4>
<input
type="text"
data-testid="settings-collab-nickname"
@@ -954,54 +1032,53 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
);
}}
maxLength={40}
- placeholder="Artist"
+ placeholder={t('Artist')}
className="w-full bg-ui-input border border-ui-default px-3 py-1.5 rounded-ui-sm text-xs text-ui-primary placeholder:text-ui-muted/60"
/>
<p className="text-[10px] text-ui-muted">
- Shown to other artists on live cursors, participant lists, and owned layers.
+ {t('Shown to other artists on live cursors, participant lists, and owned layers.')}
</p>
</section>
<section className="space-y-2">
<h4 className="text-xs font-medium text-ui-primary">
- Custom Signaling Server URL (Optional)
+ {t('Custom Signaling Server URL (Optional)')}
</h4>
<input
type="text"
data-testid="settings-collab-signaling-url"
value={localSettings.collabSignalingUrl || ''}
onChange={(e) => handleChange('collabSignalingUrl', e.target.value)}
- placeholder="wss://your-worker.workers.dev/signal (leave blank for built-in free relays)"
+ placeholder={t('wss://your-worker.workers.dev/signal (leave blank for built-in free relays)')}
className="w-full bg-ui-input border border-ui-default px-3 py-1.5 rounded-ui-sm font-ui-mono text-xs text-ui-primary placeholder:text-ui-muted/60"
/>
{localSettings.collabSignalingUrl.trim() &&
!/^(wss?|https?):\/\//i.test(localSettings.collabSignalingUrl.trim()) && (
<p className="text-[10px] text-ui-warning">
- Signaling URL should start with <code className="font-ui-mono">wss://</code> or{' '}
- <code className="font-ui-mono">https://</code>.
+ {t('Signaling URL should start with {proto1} or {proto2}.', {
+ proto1: 'wss://',
+ proto2: 'https://',
+ })}
</p>
)}
<p className="text-[10px] text-ui-muted leading-relaxed">
- Leave blank to use Ink Studio&apos;s built-in free multi-relay signaling. Only
- tiny SDP/ICE handshakes pass through signaling — all brush strokes and tiles
- travel directly peer-to-peer.
+ {t("Leave blank to use Ink Studio's built-in free multi-relay signaling. Only tiny SDP/ICE handshakes pass through signaling — all brush strokes and tiles travel directly peer-to-peer.")}
</p>
</section>
<section className="space-y-2.5">
<div>
<h4 className="text-xs font-medium text-ui-primary">
- Optional TURN Server (Strict NAT / Firewall)
+ {t('Optional TURN Server (Strict NAT / Firewall)')}
</h4>
<p className="text-[10px] text-ui-muted mt-0.5">
- Only required when direct P2P hole-punching is blocked by symmetric NAT or
- corporate firewalls.
+ {t('Only required when direct P2P hole-punching is blocked by symmetric NAT or corporate firewalls.')}
</p>
</div>
<div className="space-y-2 bg-ui-header border border-ui-subtle rounded-ui-md p-3">
<div className="space-y-1">
- <label className="text-[11px] text-ui-muted block">TURN Server URL</label>
+ <label className="text-[11px] text-ui-muted block">{t('TURN Server URL')}</label>
<input
type="text"
data-testid="settings-collab-turn-url"
@@ -1013,32 +1090,34 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
{localSettings.collabTurnUrl.trim() &&
!/^turns?:/i.test(localSettings.collabTurnUrl.trim()) && (
<p className="text-[10px] text-ui-warning">
- TURN URL must start with <code className="font-ui-mono">turn:</code> or{' '}
- <code className="font-ui-mono">turns:</code>.
+ {t('TURN URL must start with {proto1} or {proto2}.', {
+ proto1: 'turn:',
+ proto2: 'turns:',
+ })}
</p>
)}
</div>
<div className="grid grid-cols-2 gap-2.5">
<div className="space-y-1">
- <label className="text-[11px] text-ui-muted block">TURN Username</label>
+ <label className="text-[11px] text-ui-muted block">{t('TURN Username')}</label>
<input
type="text"
data-testid="settings-collab-turn-username"
value={localSettings.collabTurnUsername || ''}
onChange={(e) => handleChange('collabTurnUsername', e.target.value)}
- placeholder="Optional username"
+ placeholder={t('Optional username')}
className="w-full bg-ui-input border border-ui-default px-2.5 py-1.5 rounded-ui-sm text-xs text-ui-primary placeholder:text-ui-muted/60"
/>
</div>
<div className="space-y-1">
- <label className="text-[11px] text-ui-muted block">TURN Credential</label>
+ <label className="text-[11px] text-ui-muted block">{t('TURN Credential')}</label>
<input
type="password"
data-testid="settings-collab-turn-credential"
value={localSettings.collabTurnCredential || ''}
onChange={(e) => handleChange('collabTurnCredential', e.target.value)}
- placeholder="Optional password / token"
+ placeholder={t('Optional password / token')}
className="w-full bg-ui-input border border-ui-default px-2.5 py-1.5 rounded-ui-sm text-xs text-ui-primary placeholder:text-ui-muted/60"
/>
</div>
@@ -1049,8 +1128,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="rounded-ui-md bg-ui-header border border-ui-subtle p-3 flex items-start gap-2.5 text-[11px] text-ui-muted">
<Shield className="w-3.5 h-3.5 text-ui-icon-muted shrink-0 mt-0.5" />
<p className="leading-relaxed">
- Free public Google and Cloudflare STUN servers are included automatically for
- direct WebRTC P2P connections across PC and Android tablets.
+ {t('Free public Google and Cloudflare STUN servers are included automatically for direct WebRTC P2P connections across PC and Android tablets.')}
</p>
</div>
</div>
@@ -1065,7 +1143,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<section className="space-y-2">
<div className="flex items-center justify-between">
- <h3 className="text-xs font-medium text-ui-primary">Default Stabilization</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Default Stabilization')}</h3>
<span className="font-ui-mono tabular-nums text-xs text-ui-primary">
{localSettings.defaultStabilization}
</span>
@@ -1082,7 +1160,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<section className="space-y-1 bg-ui-header border border-ui-subtle rounded-ui-md p-2.5">
<label className="flex items-center justify-between py-1 cursor-pointer">
- <span className="text-xs text-ui-primary">Stylus Pressure Sensitivity</span>
+ <span className="text-xs text-ui-primary">{t('Stylus Pressure Sensitivity')}</span>
<input
type="checkbox"
checked={localSettings.usePressureByDefault}
@@ -1090,7 +1168,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
/>
</label>
<label className="flex items-center justify-between py-1 cursor-pointer">
- <span className="text-xs text-ui-primary">Bezier Curve Smoothing</span>
+ <span className="text-xs text-ui-primary">{t('Bezier Curve Smoothing')}</span>
<input
type="checkbox"
checked={localSettings.smoothingEnabled}
@@ -1100,12 +1178,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<label className="flex items-start justify-between gap-3 py-1.5 pt-2 mt-1 border-t border-ui-subtle cursor-pointer">
<div className="min-w-0">
<div className="text-xs text-ui-primary">
- QuickShape (Hold Pen to Snap Shape)
+ {t('QuickShape (Hold Pen to Snap Shape)')}
</div>
<p className="text-[10px] text-ui-muted leading-relaxed mt-0.5">
- Hold the stylus still (~350 ms) at the end of a freehand stroke to snap it
- into a smooth line, arc, circle, ellipse, triangle, or rectangle, then drag
- handles or corners before lifting.
+ {t('Hold the stylus still (~350 ms) at the end of a freehand stroke to snap it into a smooth line, arc, circle, ellipse, triangle, or rectangle, then drag handles or corners before lifting.')}
</p>
</div>
<input
@@ -1119,7 +1195,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
</section>
<section className="space-y-2">
- <h3 className="text-xs font-medium text-ui-primary">Undo History Limit</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Undo History Limit')}</h3>
<div className="grid grid-cols-4 gap-1.5">
{[25, 50, 75, 100].map((steps) => {
const selected = localSettings.maxHistorySteps === steps;
@@ -1150,9 +1226,12 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<Search className="w-3.5 h-3.5 text-ui-icon-muted absolute left-2.5 top-1/2 -translate-y-1/2" />
<input
type="text"
- placeholder="Search commands or keys..."
+ placeholder={t('Search commands or keys...')}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
+ onKeyDown={(e) => {
+ if (isImeComposing(e)) e.stopPropagation();
+ }}
className="w-full bg-ui-input border border-ui-default rounded-ui-sm pl-8 pr-3 py-1.5 text-xs text-ui-primary placeholder:text-ui-muted"
/>
</div>
@@ -1160,10 +1239,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
type="button"
onClick={handleResetAllShortcuts}
className="flex items-center gap-1 px-2.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary cursor-pointer shrink-0 transition-colors"
- title="Reset all keybindings to defaults"
+ title={t('Reset all keybindings to defaults')}
>
<RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
@@ -1183,7 +1262,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
: 'bg-ui-header text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {cat}
+ {cat === 'All' ? t('All') : td(cat)}
</button>
);
})}
@@ -1196,8 +1275,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="px-2.5 py-2 rounded-ui-sm bg-ui-accent-subtle border border-ui-accent-border flex items-center justify-between gap-2 text-[11px]"
>
<div className="text-ui-primary min-w-0 truncate">
- Recording shortcut — press any key combo with Ctrl, {osKeyLabel}, Shift, or Alt
- (Esc to cancel)
+ {t(
+ 'Recording shortcut — press any key combo with Ctrl, {osKey}, Shift, or Alt (Esc to cancel)',
+ { osKey: osKeyLabel }
+ )}
</div>
<button
type="button"
@@ -1209,17 +1290,19 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
? 'bg-ui-accent text-ui-accent-contrast border-transparent font-semibold'
: 'bg-ui-input text-ui-secondary border-ui-default hover:bg-ui-control-hover hover:text-ui-primary'
}`}
- title={`Combine the next key press with the ${osKeyLabel} (OS) modifier key`}
+ title={t('Combine the next key press with the {osKey} (OS) modifier key', {
+ osKey: osKeyLabel,
+ })}
>
+ {osKeyLabel} {recordWithOsModifier ? 'ON' : ''}
</button>
</div>
) : (
<div className="text-[10px] text-ui-muted px-0.5">
- Click any key badge to rebind. Supports <span className="font-ui-mono text-ui-secondary">Ctrl</span>,{' '}
- <span className="font-ui-mono text-ui-secondary">{osKeyLabel} (OS)</span>,{' '}
- <span className="font-ui-mono text-ui-secondary">Shift</span>, and{' '}
- <span className="font-ui-mono text-ui-secondary">Alt</span> — including direct shortcuts for custom sub tools &amp; groups.
+ {t(
+ 'Click any key badge to rebind. Supports Ctrl, {osKey} (OS), Shift, and Alt — including direct shortcuts for custom sub tools & groups.',
+ { osKey: osKeyLabel }
+ )}
</div>
)}
@@ -1229,14 +1312,10 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="flex items-center gap-2 text-ui-warning">
<AlertTriangle className="w-4 h-4 shrink-0 text-ui-warning" />
<span>
- <strong className="font-ui-mono">
- {formatShortcutLabel(pendingConflict.shortcut)}
- </strong>{' '}
- conflicts with{' '}
- <strong>
- {pendingConflict.conflicts.map((c) => c.label).join(', ')}
- </strong>
- . Reassign anyway?
+ {t('{shortcut} conflicts with {commands}. Reassign anyway?', {
+ shortcut: formatShortcutLabel(pendingConflict.shortcut),
+ commands: pendingConflict.conflicts.map((c) => td(c.label)).join(', '),
+ })}
</span>
</div>
<div className="flex items-center gap-1.5 shrink-0">
@@ -1245,14 +1324,14 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
onClick={handleConfirmConflictReplace}
className="px-2 py-1 rounded-ui-xs bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium cursor-pointer"
>
- Replace
+ {tc('shortcut', 'Replace')}
</button>
<button
type="button"
onClick={() => setPendingConflict(null)}
className="px-2 py-1 rounded-ui-xs bg-ui-control text-ui-primary hover:bg-ui-control-hover border border-ui-default cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
</div>
</div>
@@ -1273,26 +1352,26 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
>
<div className="min-w-0">
<div className="flex items-center gap-1.5">
- <span className="text-xs text-ui-primary truncate">{cmd.label}</span>
+ <span className="text-xs text-ui-primary truncate">{td(cmd.label)}</span>
<span className="text-[9px] px-1.5 py-0.5 rounded-ui-xs bg-ui-header border border-ui-subtle text-ui-muted">
- {cmd.category}
+ {td(cmd.category)}
</span>
{cmd.groupBadge && (
<span className="text-[9px] px-1.5 py-0.5 rounded-ui-xs bg-ui-control text-ui-secondary shrink-0">
- {cmd.groupBadge}
+ {td(cmd.groupBadge)}
</span>
)}
{cmd.springLoaded && (
<span
className="text-[9px] px-1.5 py-0.5 rounded-ui-xs bg-ui-accent-subtle text-ui-accent"
- title="Hold key > 250ms to temporarily activate and revert on release"
+ title={t('Hold key > 250ms to temporarily activate and revert on release')}
>
- Hold
+ {t('Hold')}
</span>
)}
</div>
<div className="text-[10px] text-ui-muted truncate">
- {cmd.description}
+ {td(cmd.description)}
</div>
</div>
@@ -1312,16 +1391,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
? 'bg-ui-input text-ui-primary border-ui-default hover:bg-ui-control-hover'
: 'bg-ui-input text-ui-muted border-ui-subtle italic hover:bg-ui-control-hover'
}`}
- title="Click and press a key combination to rebind"
+ title={t('Click and press a key combination to rebind')}
>
- {isRecording ? 'Press keys...' : formatShortcutLabel(activeKey)}
+ {isRecording ? t('Press keys...') : formatShortcutLabel(activeKey)}
</button>
{activeKey && (
<button
type="button"
onClick={() => handleClearSingleShortcut(cmd.id)}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
- title="Unbind shortcut"
+ title={t('Unbind shortcut')}
>
<X className="w-3 h-3" />
</button>
@@ -1331,7 +1410,9 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
type="button"
onClick={() => handleResetSingleShortcut(cmd.id)}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
- title={`Reset to default (${formatShortcutLabel(cmd.defaultShortcut)})`}
+ title={t('Reset to default ({shortcut})', {
+ shortcut: formatShortcutLabel(cmd.defaultShortcut),
+ })}
>
<RotateCcw className="w-3 h-3" />
</button>
@@ -1348,9 +1429,9 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="space-y-4">
<div className="flex items-center justify-between">
<div>
- <h3 className="text-xs font-medium text-ui-primary">Modifier Key Settings</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Modifier Key Settings')}</h3>
<p className="text-[11px] text-ui-muted">
- Configure hold-to-act keys, mouse buttons, stylus barrel buttons, and scroll wheel
+ {t('Configure hold-to-act keys, mouse buttons, stylus barrel buttons, and scroll wheel')}
</p>
</div>
<button
@@ -1359,16 +1440,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="flex items-center gap-1 px-2.5 py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
{/* Mouse Wheel */}
<div className="flex items-center justify-between gap-3 px-3 py-2 rounded-ui-md bg-ui-header border border-ui-subtle">
<div>
- <div className="text-xs text-ui-primary font-medium">Mouse Wheel</div>
+ <div className="text-xs text-ui-primary font-medium">{t('Mouse Wheel')}</div>
<div className="text-[10px] text-ui-muted">
- Action when scrolling wheel over the canvas viewport
+ {t('Action when scrolling wheel over the canvas viewport')}
</div>
</div>
<select
@@ -1378,7 +1459,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
>
{MOUSE_WHEEL_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
@@ -1392,8 +1473,8 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
className="flex items-center justify-between gap-3 px-3 py-2 rounded-ui-md bg-ui-header border border-ui-subtle"
>
<div className="min-w-0">
- <div className="text-xs text-ui-primary font-ui-mono">{label}</div>
- <div className="text-[10px] text-ui-muted truncate">{desc}</div>
+ <div className="text-xs text-ui-primary font-ui-mono">{t(label)}</div>
+ <div className="text-[10px] text-ui-muted truncate">{t(desc)}</div>
</div>
<select
value={localSettings.modifierKeys[slot]}
@@ -1404,7 +1485,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
>
{MODIFIER_ACTION_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
@@ -1425,12 +1506,14 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div>
<h2 className="text-sm font-semibold text-ui-primary">Ink Studio</h2>
<p className="text-[11px] font-ui-mono tabular-nums text-ui-muted">
- v{runtimeAppVersion || APP_VERSION} · Collaborative Drawing Studio · by Sora
+ {t('v{version} · Collaborative Drawing Studio · by Sora', {
+ version: runtimeAppVersion || APP_VERSION,
+ })}
</p>
</div>
</div>
<p className="text-xs text-ui-muted leading-relaxed">
- Collaborative Drawing Studio supporting layered PSD/CSP workflows, GPU tile compositing, stylus pressure dynamics, vector inking, and real-time multiplayer drawing.
+ {t('Collaborative Drawing Studio supporting layered PSD/CSP workflows, GPU tile compositing, stylus pressure dynamics, vector inking, and real-time multiplayer drawing.')}
</p>
{(() => {
@@ -1442,7 +1525,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<section className="space-y-2 pt-2 border-t border-ui-subtle">
<div className="flex items-center justify-between">
<h3 className="text-xs font-medium text-ui-primary tabular-nums">
- What&apos;s New in v{changelogEntry.version}
+ {t("What's New in v{version}", { version: changelogEntry.version })}
</h3>
</div>
<ChangelogBox entry={changelogEntry} maxHeightClass="max-h-48" />
@@ -1453,16 +1536,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
{isDesktopTauri && (
<section className="space-y-2.5 pt-2 border-t border-ui-subtle">
<div>
- <h3 className="text-xs font-medium text-ui-primary">Updates</h3>
+ <h3 className="text-xs font-medium text-ui-primary">{t('Updates')}</h3>
<p className="text-[11px] text-ui-muted">
- Keep Ink Studio up to date with the latest desktop releases
+ {t('Keep Ink Studio up to date with the latest desktop releases')}
</p>
</div>
<div className="bg-ui-header border border-ui-subtle rounded-ui-md p-3 space-y-3">
<label className="flex items-center justify-between py-0.5 cursor-pointer">
<span className="text-xs text-ui-primary">
- Automatically check for updates on startup
+ {t('Automatically check for updates on startup')}
</span>
<input
type="checkbox"
@@ -1474,34 +1557,38 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="pt-2.5 border-t border-ui-subtle flex items-center justify-between gap-3">
<div className="min-w-0 text-[11px]">
{updaterStatus === 'checking' && (
- <span className="text-ui-muted">Checking for updates...</span>
+ <span className="text-ui-muted">{t('Checking for updates...')}</span>
)}
{updaterStatus === 'up-to-date' && (
- <span className="text-ui-success">Up to date</span>
+ <span className="text-ui-success">{t('Up to date')}</span>
)}
{updaterStatus === 'available' && availableUpdateVersion && (
<span className="text-ui-accent font-medium tabular-nums">
- Update v{availableUpdateVersion} available
+ {t('Update v{version} available', { version: availableUpdateVersion })}
</span>
)}
{updaterStatus === 'downloading' && (
<span className="text-ui-accent font-ui-mono tabular-nums">
- Downloading update... {updateProgressPercent}%
+ {t('Downloading update... {percent}%', {
+ percent: updateProgressPercent,
+ })}
</span>
)}
{updaterStatus === 'ready' && (
<span className="text-ui-success">
- Update ready — restarting...
+ {t('Update ready — restarting...')}
</span>
)}
{updaterStatus === 'error' && (
<span className="text-ui-danger break-words">
- {updateErrorMessage || 'Failed to check for updates'}
+ {updateErrorMessage || t('Failed to check for updates')}
</span>
)}
{updaterStatus === 'idle' && (
<span className="text-ui-muted">
- Current version: <span className="font-ui-mono tabular-nums">v{runtimeAppVersion || APP_VERSION}</span>
+ {t('Current version: v{version}', {
+ version: runtimeAppVersion || APP_VERSION,
+ })}
</span>
)}
</div>
@@ -1518,7 +1605,9 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
>
<ArrowDownToLine className="w-3 h-3" />
<span>
- {updaterStatus === 'downloading' ? 'View Progress' : 'View Update'}
+ {updaterStatus === 'downloading'
+ ? t('View Progress')
+ : t('View Update')}
</span>
</button>
)}
@@ -1538,7 +1627,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
) : (
<RefreshCw className="w-3 h-3" />
)}
- <span>Check for Updates</span>
+ <span>{t('Check for Updates')}</span>
</button>
</div>
</div>
diff --git a/src/components/SimpleToneModal.tsx b/src/components/SimpleToneModal.tsx
index 51eaf7a..b680cd1 100644
--- a/src/components/SimpleToneModal.tsx
+++ b/src/components/SimpleToneModal.tsx
@@ -1,6 +1,7 @@
import React, { useState, useEffect, useRef } from 'react';
import { X } from 'lucide-react';
import { HalftoneDotShape, applyScreentoneCPU } from '../utils/screentoneEngine';
+import { isImeComposing, useI18n } from '../i18n';
export interface SimpleToneSettings {
density: number; // 1 to 100
@@ -36,6 +37,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
initialDotShape = 'circle',
dpi = 600,
}) => {
+ const { t } = useI18n();
const [frequency, setFrequency] = useState(initialFrequency);
const [density, setDensity] = useState(initialDensity);
const [angle, setAngle] = useState(initialAngle);
@@ -89,6 +91,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
onClose();
@@ -125,14 +128,14 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
{/* Header */}
<div className="h-10 px-4 bg-ui-header border-b border-ui-subtle flex items-center justify-between">
<h2 id="simple-tone-modal-title" className="text-xs font-medium text-ui-primary">
- Simple Tone Settings
+ {t('Simple Tone Settings')}
</h2>
<button
type="button"
onClick={onClose}
- aria-label="Close"
+ aria-label={t('Close')}
className="w-6 h-6 flex items-center justify-center text-ui-muted hover:text-ui-primary rounded-ui-sm hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Cancel (Esc)"
+ title={t('Cancel (Esc)')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -144,7 +147,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
<div className="flex gap-4">
{/* Swatch Preview */}
<div className="flex flex-col items-center">
- <span className="text-[10px] text-ui-muted mb-1">Preview</span>
+ <span className="text-[10px] text-ui-muted mb-1">{t('Preview')}</span>
<div className="w-[120px] h-[120px] rounded-ui-sm border border-ui-default bg-white overflow-hidden flex items-center justify-center">
<canvas ref={previewCanvasRef} className="w-full h-full" style={{ imageRendering: 'pixelated' }} />
</div>
@@ -157,23 +160,23 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
<div className="flex-1 space-y-3">
{/* Dot Shape */}
<div>
- <label className="text-[10px] text-ui-muted block mb-1">Dot Shape</label>
+ <label className="text-[10px] text-ui-muted block mb-1">{t('Dot Shape')}</label>
<select
value={dotShape}
onChange={(e) => setDotShape(e.target.value as HalftoneDotShape)}
className="w-full bg-ui-input border border-ui-default text-ui-primary text-xs rounded-ui-sm px-2 py-1 cursor-pointer"
>
- <option value="circle">Circle (Standard)</option>
- <option value="euclidean">Euclidean (Halftone)</option>
- <option value="line">Line (Hatching)</option>
- <option value="diamond">Diamond</option>
+ <option value="circle">{t('Circle (Standard)')}</option>
+ <option value="euclidean">{t('Euclidean (Halftone)')}</option>
+ <option value="line">{t('Line (Hatching)')}</option>
+ <option value="diamond">{t('Diamond')}</option>
</select>
</div>
{/* Angle */}
<div>
<div className="flex items-center justify-between text-[10px] mb-1">
- <span className="text-ui-muted">Angle</span>
+ <span className="text-ui-muted">{t('Angle')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{angle}°</span>
</div>
<input
@@ -206,7 +209,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
{/* Density Slider & Presets */}
<div className="p-2.5 bg-ui-header rounded-ui-md border border-ui-subtle">
<div className="flex items-center justify-between text-xs mb-1.5">
- <span className="text-ui-secondary">Density</span>
+ <span className="text-ui-secondary">{t('Density')}</span>
<div className="flex items-center space-x-1">
<input
type="number"
@@ -250,7 +253,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
{/* Frequency (Lines / LPI) */}
<div className="p-2.5 bg-ui-header rounded-ui-md border border-ui-subtle">
<div className="flex items-center justify-between text-xs mb-1.5">
- <span className="text-ui-secondary">Screen Frequency (LPI)</span>
+ <span className="text-ui-secondary">{t('Screen Frequency (LPI)')}</span>
<div className="flex items-center space-x-1">
<input
type="number"
@@ -300,7 +303,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary font-medium transition-colors cursor-pointer text-xs"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
@@ -315,7 +318,7 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
}
className="px-4 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium transition-opacity cursor-pointer text-xs"
>
- OK
+ {t('OK')}
</button>
</div>
</div>
diff --git a/src/components/SmartphoneViewportSimulator.tsx b/src/components/SmartphoneViewportSimulator.tsx
index 695fb01..225af31 100644
--- a/src/components/SmartphoneViewportSimulator.tsx
+++ b/src/components/SmartphoneViewportSimulator.tsx
@@ -1,5 +1,6 @@
import React, { useState, useRef } from 'react';
import { Smartphone, X, GripHorizontal } from 'lucide-react';
+import { useI18n } from '../i18n';
interface SmartphoneViewportSimulatorProps {
visible: boolean;
@@ -12,6 +13,7 @@ export const SmartphoneViewportSimulator: React.FC<SmartphoneViewportSimulatorPr
visible,
onToggleVisible,
}) => {
+ const { t } = useI18n();
// Mobile phone mockup dimensions (standard 9:16 smartphone viewport)
const phoneWidth = 360;
const phoneHeight = 640;
@@ -83,7 +85,7 @@ export const SmartphoneViewportSimulator: React.FC<SmartphoneViewportSimulatorPr
onPointerMove={handlePointerMove}
onPointerUp={handlePointerUp}
className="absolute top-2.5 left-1/2 -translate-x-1/2 w-28 h-6 bg-ui-floating border border-ui-default rounded-full flex items-center justify-between px-3 cursor-move z-30 shadow-ui-floating group"
- title="Drag to reposition smartphone preview frame"
+ title={t('Drag to reposition smartphone preview frame')}
>
<div className="w-2.5 h-2.5 rounded-full bg-ui-input border border-ui-default" />
<GripHorizontal className="w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors" />
@@ -102,7 +104,7 @@ export const SmartphoneViewportSimulator: React.FC<SmartphoneViewportSimulatorPr
type="button"
onClick={onToggleVisible}
className="text-ui-icon-muted hover:text-ui-primary transition-colors pointer-events-auto ml-1 p-0.5 cursor-pointer"
- title="Hide Viewport Simulator"
+ title={t('Hide Viewport Simulator')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -117,7 +119,7 @@ export const SmartphoneViewportSimulator: React.FC<SmartphoneViewportSimulatorPr
{/* Webtoon Reader Badge */}
<div className="absolute bottom-6 left-1/2 -translate-x-1/2 px-3 py-1 bg-ui-floating rounded-full border border-ui-default text-[10px] text-ui-primary font-medium flex items-center space-x-1.5 shadow-ui-floating">
<Smartphone className="w-3 h-3 text-ui-accent" />
- <span className="tabular-nums">9:16 Webtoon Simulator</span>
+ <span className="tabular-nums">{t('9:16 Webtoon Simulator')}</span>
</div>
</div>
diff --git a/src/components/SpeechBalloonOverlay.tsx b/src/components/SpeechBalloonOverlay.tsx
index 3f6e9b7..ec633dc 100644
--- a/src/components/SpeechBalloonOverlay.tsx
+++ b/src/components/SpeechBalloonOverlay.tsx
@@ -4,6 +4,7 @@ import {
Trash2,
} from 'lucide-react';
import { getBalloonHandles, BalloonHandle, renderSpeechBalloon } from '../utils/balloonEngine';
+import { isImeComposing, useI18n } from '../i18n';
interface SpeechBalloonOverlayProps {
balloon: SpeechBalloon | null;
@@ -26,6 +27,8 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onConfirmBalloon,
onDeleteBalloon,
}) => {
+ const { t, tc } = useI18n();
+
if (!balloon) return null;
const dragRef = useRef<{
@@ -304,7 +307,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
transform: 'translate(-50%, -50%)',
cursor: h.cursor,
}}
- title={h.id === 'tail-tip' ? 'Drag Tail Tip' : `Handle: ${h.id}`}
+ title={h.id === 'tail-tip' ? t('Drag Tail Tip') : t('Handle: {id}', { id: h.id })}
/>
);
})}
@@ -321,7 +324,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onPointerDown={(e) => e.stopPropagation()}
>
<div className="flex items-center justify-between border-b border-ui-subtle pb-1.5">
- <span className="text-ui-primary font-medium">Speech Balloon</span>
+ <span className="text-ui-primary font-medium">{t('Speech Balloon')}</span>
<div className="flex items-center space-x-1">
<button
onClick={() => setActiveTab('shape')}
@@ -329,7 +332,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
activeTab === 'shape' ? 'bg-ui-control-active text-ui-primary' : 'text-ui-muted hover:text-ui-primary'
}`}
>
- Shape
+ {tc('balloon', 'Shape')}
</button>
<button
onClick={() => setActiveTab('text')}
@@ -337,7 +340,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
activeTab === 'text' ? 'bg-ui-control-active text-ui-primary' : 'text-ui-muted hover:text-ui-primary'
}`}
>
- Text
+ {t('Text')}
</button>
</div>
</div>
@@ -345,7 +348,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
{activeTab === 'shape' ? (
<div className="space-y-2">
<div>
- <label className="text-[10px] text-ui-muted block mb-1">Shape Preset</label>
+ <label className="text-[10px] text-ui-muted block mb-1">{t('Shape Preset')}</label>
<div className="grid grid-cols-4 gap-1">
{(
[
@@ -364,14 +367,14 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
: 'border-ui-subtle bg-ui-input text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {lbl}
+ {tc('balloon', lbl)}
</button>
))}
</div>
</div>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-muted">Border Width</span>
+ <span className="text-ui-muted">{t('Border Width')}</span>
<div className="flex items-center space-x-1.5">
<input
type="range"
@@ -394,13 +397,17 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
<textarea
value={balloon.text}
onChange={(e) => onUpdateBalloon((p) => ({ ...p, text: e.target.value }))}
- placeholder="Balloon dialogue text..."
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
+ placeholder={t('Balloon dialogue text...')}
rows={2}
className="w-full bg-ui-input text-ui-primary placeholder:text-ui-muted text-xs border border-ui-default rounded-ui-sm p-1.5 resize-none"
/>
<div className="flex items-center justify-between">
- <span className="text-[11px] text-ui-muted">Direction</span>
+ <span className="text-[11px] text-ui-muted">{tc('textDirection', 'Direction')}</span>
<div className="flex space-x-1">
<button
onClick={() => onUpdateBalloon((p) => ({ ...p, vertical: false }))}
@@ -410,7 +417,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-muted hover:text-ui-primary'
}`}
>
- Horizontal
+ {tc('writingMode', 'Horizontal')}
</button>
<button
onClick={() => onUpdateBalloon((p) => ({ ...p, vertical: true }))}
@@ -420,13 +427,13 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
: 'bg-ui-input border-ui-subtle text-ui-muted hover:text-ui-primary'
}`}
>
- Vertical
+ {tc('writingMode', 'Vertical')}
</button>
</div>
</div>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-muted">Font Size</span>
+ <span className="text-ui-muted">{t('Font Size')}</span>
<div className="flex items-center space-x-1.5">
<input
type="range"
@@ -448,7 +455,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
<button
onClick={onDeleteBalloon}
className="p-1 text-ui-icon-muted hover:text-ui-danger hover:bg-ui-danger/15 rounded-ui-xs transition-colors cursor-pointer"
- title="Delete Balloon"
+ title={t('Delete Balloon')}
>
<Trash2 className="w-3.5 h-3.5" />
</button>
@@ -457,7 +464,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onClick={onConfirmBalloon}
className="px-3 py-1 bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm text-xs font-medium transition-opacity cursor-pointer"
>
- Apply Balloon
+ {t('Apply Balloon')}
</button>
</div>
</div>
diff --git a/src/components/SphereColorPicker.tsx b/src/components/SphereColorPicker.tsx
index 06d0081..aa52115 100644
--- a/src/components/SphereColorPicker.tsx
+++ b/src/components/SphereColorPicker.tsx
@@ -44,6 +44,7 @@ import {
getLightVectors,
} from '../utils/sphereColorMath';
import { safeLocalStorageSetItem } from '../utils/safeStorage';
+import { isImeComposing, useI18n } from '../i18n';
export interface SpherePickerSharedState {
slots: SphereSlotsState;
@@ -287,6 +288,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
onToggleCollapse,
className = '',
}) => {
+ const { t, tc, td } = useI18n();
const isDocked = variant === 'docked';
const [internalCollapsed, setInternalCollapsed] = useState(false);
const isCollapsed = !isDocked && (isCollapsedProp ?? internalCollapsed);
@@ -729,7 +731,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
if ((e.target as HTMLElement)?.closest?.('button')) return;
handleToggleCollapse();
}}
- title="Drag to move palette — Double-click to collapse/expand"
+ title={t('Drag to move palette — Double-click to collapse/expand')}
className={`h-7 px-2 flex items-center justify-between bg-ui-header cursor-grab active:cursor-grabbing shrink-0 ${
isCollapsed ? '' : 'border-b border-ui-subtle'
}`}
@@ -743,7 +745,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
}}
/>
<span className="text-[10px] font-medium text-ui-primary tracking-wide truncate">
- Color Sphere
+ {t('Color Sphere')}
</span>
</div>
@@ -756,8 +758,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
type="button"
onClick={onTogglePin}
data-testid="sphere-pin-toggle"
- title={isPinned ? 'Unpin & Float Palette' : 'Pin back to Color Panel'}
- aria-label={isPinned ? 'Unpin panel' : 'Pin panel'}
+ title={isPinned ? t('Unpin & Float Palette') : t('Pin back to Color Panel')}
+ aria-label={isPinned ? t('Unpin panel') : t('Pin panel')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
{isPinned ? <PinOff className="w-3 h-3" /> : <Pin className="w-3 h-3" />}
@@ -767,8 +769,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
type="button"
onClick={handleToggleCollapse}
data-testid="sphere-collapse-toggle"
- title={isCollapsed ? 'Expand Panel' : 'Hide / Collapse Panel'}
- aria-label={isCollapsed ? 'Expand Color Sphere' : 'Hide Color Sphere'}
+ title={isCollapsed ? t('Expand Panel') : t('Hide / Collapse Panel')}
+ aria-label={isCollapsed ? t('Expand Color Sphere') : t('Hide Color Sphere')}
aria-expanded={!isCollapsed}
className={`w-5 h-5 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
isCollapsed
@@ -782,8 +784,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={onClose}
- title="Close (Esc)"
- aria-label="Close"
+ title={t('Close (Esc)')}
+ aria-label={tc('action', 'Close')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3 h-3" />
@@ -802,8 +804,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={() => setShowSettings((s) => !s)}
- title="Lighting & Surface Settings"
- aria-label="Lighting Settings"
+ title={t('Lighting & Surface Settings')}
+ aria-label={t('Lighting Settings')}
aria-expanded={showSettings}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
showSettings
@@ -819,10 +821,10 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
onClick={() => setLightOrbitMode((m) => !m)}
title={
lightOrbitMode
- ? 'Light Orbit Active (drag sphere to angle light)'
- : 'Rotate Light Source (or Shift+drag on sphere)'
+ ? t('Light Orbit Active (drag sphere to angle light)')
+ : t('Rotate Light Source (or Shift+drag on sphere)')
}
- aria-label="Toggle Light Orbit Mode"
+ aria-label={t('Toggle Light Orbit Mode')}
aria-pressed={lightOrbitMode}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
lightOrbitMode
@@ -839,14 +841,19 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={handleRevertToPrevious}
- title={`Previous: ${previousColor} (Click to revert)`}
- aria-label={`Previous color ${previousColor}`}
+ title={t('Previous: {color} (Click to revert)', { color: previousColor })}
+ aria-label={t('Previous color {color}', { color: previousColor })}
className="flex-1 h-full cursor-pointer transition-opacity hover:opacity-90"
style={{ backgroundColor: previousColor }}
/>
<div
data-testid="sphere-live-preview"
- title={`Current: ${sampledColor.hex} | rgb(${sampledColor.rgb.r}, ${sampledColor.rgb.g}, ${sampledColor.rgb.b})`}
+ title={t('Current: {hex} | rgb({r}, {g}, {b})', {
+ hex: sampledColor.hex,
+ r: sampledColor.rgb.r,
+ g: sampledColor.rgb.g,
+ b: sampledColor.rgb.b,
+ })}
className="flex-1 h-full border-l border-ui-void/40"
style={{ backgroundColor: sampledColor.hex }}
/>
@@ -856,8 +863,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={handleEyedropperClick}
- title="Eyedropper"
- aria-label="Eyedropper"
+ title={t('Eyedropper')}
+ aria-label={t('Eyedropper')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<Pipette className="w-3.5 h-3.5" />
@@ -868,8 +875,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
type="button"
onClick={onTogglePin}
data-testid="sphere-pin-toggle"
- title="Unpin & Float Palette"
- aria-label="Unpin panel"
+ title={t('Unpin & Float Palette')}
+ aria-label={t('Unpin panel')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<PinOff className="w-3.5 h-3.5" />
@@ -884,7 +891,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
className={`${compact ? 'mx-2 p-2' : 'mx-2.5 p-2'} mt-1.5 rounded-ui-md bg-ui-input border border-ui-subtle space-y-2 text-[10px] shrink-0`}
>
<div className="flex items-center justify-between border-b border-ui-subtle pb-1">
- <span className="text-[10px] font-medium text-ui-secondary">Lighting &amp; Surface</span>
+ <span className="text-[10px] font-medium text-ui-secondary">{t('Lighting & Surface')}</span>
<button
type="button"
onClick={() => {
@@ -892,11 +899,11 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
commitState(resetState);
emitColor(resetState, true);
}}
- title="Reset Lighting"
+ title={t('Reset Lighting')}
className="flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs text-[10px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer transition-colors"
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
@@ -915,14 +922,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
style={{ backgroundColor: preset.swatch }}
/>
)}
- <span className="truncate">{preset.label}</span>
+ <span className="truncate">{td(preset.label)}</span>
</button>
))}
</div>
<div className="pt-1 border-t border-ui-subtle space-y-1">
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Key Tint</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Key Tint')}</span>
<input
type="range"
min={0}
@@ -930,14 +937,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(lightTintVal * 100)}
onChange={(e) => updateLighting({ lightTint: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Key Light Color Tint"
+ aria-label={t('Key Light Color Tint')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(lightTintVal * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Rim Glow</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Rim Glow')}</span>
<input
type="range"
min={0}
@@ -945,14 +952,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(rimIntensityVal * 100)}
onChange={(e) => updateLighting({ rimIntensity: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Rim Light Intensity"
+ aria-label={t('Rim Light Intensity')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(rimIntensityVal * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Gloss</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Gloss')}</span>
<input
type="range"
min={5}
@@ -960,14 +967,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round((1 - lighting.roughness) * 100)}
onChange={(e) => updateLighting({ roughness: 1 - Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Surface Gloss"
+ aria-label={t('Surface Gloss')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round((1 - lighting.roughness) * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Specular</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Specular')}</span>
<input
type="range"
min={0}
@@ -975,14 +982,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(lighting.specularStrength * 100)}
onChange={(e) => updateLighting({ specularStrength: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Specular Strength"
+ aria-label={t('Specular Strength')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(lighting.specularStrength * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">SSS Glow</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('SSS Glow')}</span>
<input
type="range"
min={0}
@@ -990,14 +997,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(subsurfaceVal * 100)}
onChange={(e) => updateLighting({ subsurface: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Subsurface Terminator Glow"
+ aria-label={t('Subsurface Terminator Glow')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(subsurfaceVal * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Bounce</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Bounce')}</span>
<input
type="range"
min={0}
@@ -1005,14 +1012,14 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(lighting.bounceIntensity * 100)}
onChange={(e) => updateLighting({ bounceIntensity: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Bounce Light Intensity"
+ aria-label={t('Bounce Light Intensity')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(lighting.bounceIntensity * 100)}
</span>
</div>
<div className="flex items-center justify-between gap-2">
- <span className="text-[10px] text-ui-muted w-14">Shadow</span>
+ <span className="text-[10px] text-ui-muted w-14">{t('Shadow')}</span>
<input
type="range"
min={0}
@@ -1020,7 +1027,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
value={Math.round(lighting.shadowDepth * 100)}
onChange={(e) => updateLighting({ shadowDepth: Number(e.target.value) / 100 }, true)}
className="flex-1"
- aria-label="Shadow Depth"
+ aria-label={t('Shadow Depth')}
/>
<span className="font-ui-mono tabular-nums text-[10px] w-7 text-right text-ui-primary">
{Math.round(lighting.shadowDepth * 100)}
@@ -1148,7 +1155,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
data-testid={`slot-${id}`}
aria-pressed={isActive}
onClick={() => commitState({ ...state, activeSlot: id })}
- title={`${label} Color (${hex})`}
+ title={t('{label} Color ({hex})', { label: tc('sphereSlot', label), hex })}
className={`flex items-center justify-center gap-1 px-1 py-1 rounded-ui-xs cursor-pointer transition-colors ${
isActive ? 'bg-ui-control-active ring-1 ring-ui-default' : 'hover:bg-ui-control-hover'
}`}
@@ -1181,7 +1188,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<div
role="slider"
tabIndex={0}
- aria-label={`${activeSlot} hue`}
+ aria-label={t('{slot} hue', { slot: tc('sphereSlotLower', activeSlot) })}
aria-valuemin={0}
aria-valuemax={359}
aria-valuenow={activeHue}
@@ -1212,13 +1219,18 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
</div>
<label
- title={`Pick exact ${activeSlot} color (${activeSlotHex})`}
+ title={t('Pick exact {slot} color ({hex})', {
+ slot: tc('sphereSlotLower', activeSlot),
+ hex: activeSlotHex,
+ })}
className="relative w-6 h-6 rounded-ui-xs border border-ui-default shrink-0 cursor-pointer overflow-hidden"
style={{ backgroundColor: activeSlotHex }}
>
<input
type="color"
- aria-label={`Pick ${activeSlot} color`}
+ aria-label={t('Pick {slot} color', {
+ slot: tc('sphereSlotLower', activeSlot),
+ })}
data-testid="sphere-slot-color-input"
value={activeSlotHex}
onChange={(e) => {
@@ -1233,7 +1245,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
</div>
<MiniBarSlider
- label={compact ? 'Chm' : 'Chroma'}
+ label={compact ? t('Chm') : t('Chroma')}
value={activeSlotHsv.s}
min={0}
max={1}
@@ -1245,7 +1257,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
/>
<MiniBarSlider
- label={compact ? 'Val' : 'Value'}
+ label={compact ? t('Val') : t('Value')}
value={activeSlotHsv.v}
min={0}
max={1}
@@ -1263,7 +1275,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
>
<div className="flex items-center gap-1.5 pb-0.5">
<select
- aria-label="Lighting Preset"
+ aria-label={t('Lighting Preset')}
data-testid="sphere-preset-select"
defaultValue=""
onChange={(e) => {
@@ -1275,11 +1287,11 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
className="flex-1 min-w-0 h-5 px-1.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary outline-none cursor-pointer"
>
<option value="" disabled>
- Lighting Mood Preset...
+ {t('Lighting Mood Preset...')}
</option>
{SPHERE_LIGHTING_PRESETS.map((preset) => (
<option key={preset.id} value={preset.id} className="bg-ui-elevated text-ui-primary">
- {preset.label}
+ {td(preset.label)}
</option>
))}
</select>
@@ -1290,8 +1302,8 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
commitState(resetState);
emitColor(resetState, true);
}}
- title="Reset Lighting & Colors"
- aria-label="Reset Lighting"
+ title={t('Reset Lighting & Colors')}
+ aria-label={t('Reset Lighting')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-icon-muted hover:text-ui-primary cursor-pointer shrink-0 transition-colors"
>
<RotateCcw className="w-2.5 h-2.5" />
@@ -1299,7 +1311,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
</div>
<MiniBarSlider
- label="Light"
+ label={tc('sphere', 'Light')}
value={lighting.lightIntensity}
min={0.1}
max={2.8}
@@ -1311,7 +1323,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
/>
<MiniBarSlider
- label={compact ? 'Amb' : 'Ambient'}
+ label={compact ? t('Amb') : t('Ambient')}
value={ambientVal}
min={0}
max={1.0}
@@ -1323,7 +1335,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
/>
<MiniBarSlider
- label={compact ? 'Ctr' : 'Contrast'}
+ label={compact ? t('Ctr') : t('Contrast')}
value={lighting.contrast}
min={0.4}
max={2.2}
@@ -1335,7 +1347,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
/>
<MiniBarSlider
- label="Sat"
+ label={t('Sat')}
value={lighting.saturation}
min={0}
max={1.8}
@@ -1349,14 +1361,18 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
type="button"
onClick={handleToggleBw}
data-testid="sphere-bw-toggle"
- title={isBwMode ? 'Restore Color Saturation' : 'Black & White / Grayscale Mode (0% Sat)'}
+ title={
+ isBwMode
+ ? t('Restore Color Saturation')
+ : t('Black & White / Grayscale Mode (0% Sat)')
+ }
className={`px-1.5 py-0.5 rounded-ui-xs text-[9px] font-ui-mono font-semibold cursor-pointer transition-colors shrink-0 ${
isBwMode
? 'bg-ui-accent text-ui-accent-contrast'
: 'bg-ui-control border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- B&amp;W
+ {t('B&W')}
</button>
}
/>
@@ -1369,7 +1385,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={() => handleCopy('hex')}
- title="Copy HEX"
+ title={t('Copy HEX')}
data-testid="sphere-output-hex"
className="flex items-center gap-1.5 px-2 py-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-primary cursor-pointer transition-colors"
>
@@ -1384,7 +1400,7 @@ export const SphereColorPicker: React.FC<SphereColorPickerProps> = ({
<button
type="button"
onClick={() => handleCopy('rgb')}
- title="Copy RGB"
+ title={t('Copy RGB')}
data-testid="sphere-output-rgb"
className="flex items-center gap-1.5 px-2 py-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors truncate"
>
@@ -1456,6 +1472,7 @@ export const SphereColorPickerModal: React.FC<SphereColorPickerModalProps> = ({
blocking = false,
...pickerProps
}) => {
+ const { t } = useI18n();
const [panelWidth, setPanelWidth] = useState<number>(() => loadSavedFloatWidth());
const [pos, setPos] = useState<{ x: number; y: number }>(() => loadSavedFloatPos(panelWidth));
const [isCollapsed, setIsCollapsed] = useState(false);
@@ -1467,6 +1484,7 @@ export const SphereColorPickerModal: React.FC<SphereColorPickerModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.stopPropagation();
onClose();
@@ -1582,7 +1600,7 @@ export const SphereColorPickerModal: React.FC<SphereColorPickerModalProps> = ({
onPointerDown={onClose}
role="dialog"
aria-modal="true"
- aria-label="3D Sphere Color Picker"
+ aria-label={t('3D Sphere Color Picker')}
>
<SphereColorPicker
{...pickerProps}
@@ -1597,7 +1615,7 @@ export const SphereColorPickerModal: React.FC<SphereColorPickerModalProps> = ({
style={{ left: pos.x, top: pos.y, width: panelWidth }}
role="dialog"
aria-modal="false"
- aria-label="3D Sphere Color Picker"
+ aria-label={t('3D Sphere Color Picker')}
className="fixed z-[95] pointer-events-auto"
>
<div className="relative">
@@ -1615,7 +1633,7 @@ export const SphereColorPickerModal: React.FC<SphereColorPickerModalProps> = ({
{!isCollapsed && (
<div
onPointerDown={handleResizeStart}
- title="Drag to resize"
+ title={t('Drag to resize')}
className="absolute bottom-0.5 right-0.5 w-3 h-3 cursor-nwse-resize opacity-35 hover:opacity-80 transition-opacity"
style={{
background:
diff --git a/src/components/StatusBar.tsx b/src/components/StatusBar.tsx
index 9e81277..6892dfa 100644
--- a/src/components/StatusBar.tsx
+++ b/src/components/StatusBar.tsx
@@ -12,6 +12,7 @@ import { ThemePreset } from '../types/settings';
import { DEFAULT_STATUS_BAR_MODULES, StatusBarModulesConfig } from '../types/workspace';
import { formatZoomPercent } from '../hooks/useCanvasNavigation';
import { formatRotationDegrees } from '../utils/canvasUtils';
+import { useI18n } from '../i18n';
const CMYK_STANDARD_LABELS: Record<CmykStandard, string> = {
'japan-color-2001': 'Japan Color 2001',
@@ -58,6 +59,7 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
valueCheckEnabled = false,
onToggleValueCheck,
}) => {
+ const { t, tc } = useI18n();
const posTextRef = useRef<HTMLSpanElement>(null);
const pressureBarRef = useRef<HTMLDivElement>(null);
const pressureTextRef = useRef<HTMLSpanElement>(null);
@@ -119,14 +121,16 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
data-testid="status-module-tool-info"
className="bg-ui-input border border-ui-subtle px-2 py-0.5 rounded-ui-sm flex items-center gap-1.5"
>
- <span className="text-ui-primary capitalize font-medium text-[11px]">{tool}</span>
+ <span className="text-ui-primary capitalize font-medium text-[11px]">
+ {tc('toolId', tool)}
+ </span>
<span className="text-ui-disabled">|</span>
<span className="text-[10px] font-ui-mono text-ui-secondary">
- {brushSettings.smoothing ? 'Bézier' : 'Direct'}
+ {brushSettings.smoothing ? t('Bézier') : t('Direct')}
</span>
<span className="text-ui-disabled">|</span>
<span className="text-ui-accent font-ui-mono tabular-nums text-[10px]">
- Stab: {brushSettings.stabilization ?? 0}
+ {t('Stab: {value}', { value: brushSettings.stabilization ?? 0 })}
</span>
</div>
)}
@@ -140,7 +144,7 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
<>
{dimensions && (
<>
- <span className="text-ui-primary" title="Canvas Dimensions">
+ <span className="text-ui-primary" title={t('Canvas Dimensions')}>
{dimensions.width}×{dimensions.height}px
</span>
{dimensions.dpi ? (
@@ -157,28 +161,40 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
? 'text-ui-secondary'
: 'text-ui-accent'
}`}
- title={`Active Document Color Mode: ${colorMode}`}
+ title={t('Active Document Color Mode: {mode}', {
+ mode: tc('colorModeId', colorMode),
+ })}
>
{colorMode === 'monochrome'
- ? '1-bit Manga'
+ ? t('1-bit Manga')
: colorMode === 'grayscale'
- ? 'Grayscale'
- : 'Color RGB'}
+ ? t('Grayscale')
+ : t('Color RGB')}
</span>
{softProofSettings?.enabled && (
<>
<span className="text-ui-disabled">|</span>
<span
className="text-ui-accent font-medium"
- title={`CMYK Soft Proofing: ${softProofSettings.standard}${softProofSettings.gamutWarning ? ' (Gamut Warning ON)' : ''}`}
+ title={
+ softProofSettings.gamutWarning
+ ? t('CMYK Soft Proofing: {standard} (Gamut Warning ON)', {
+ standard: softProofSettings.standard,
+ })
+ : t('CMYK Soft Proofing: {standard}', {
+ standard: softProofSettings.standard,
+ })
+ }
>
- [CMYK Proof: {CMYK_STANDARD_LABELS[softProofSettings.standard] || 'US Web Coated'}]
+ {t('[CMYK Proof: {label}]', {
+ label: CMYK_STANDARD_LABELS[softProofSettings.standard] || 'US Web Coated',
+ })}
</span>
</>
)}
</>
) : (
- <span className="text-ui-disabled italic">No active document</span>
+ <span className="text-ui-disabled italic">{t('No active document')}</span>
)}
</div>
)}
@@ -196,12 +212,12 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
}`}
title={
valueCheckEnabled
- ? '1-Click Value Check (Live B/W Tone Check) is ON — Click or press Shift+Y to disable'
- : '1-Click Value Check (Shift+Y) — Toggle Live B/W Tone Preview'
+ ? t('1-Click Value Check (Live B/W Tone Check) is ON — Click or press Shift+Y to disable')
+ : t('1-Click Value Check (Shift+Y) — Toggle Live B/W Tone Preview')
}
>
<Contrast className="w-3 h-3 shrink-0" />
- <span>{valueCheckEnabled ? '[Value Check: B/W]' : 'Value'}</span>
+ <span>{valueCheckEnabled ? t('[Value Check: B/W]') : t('Value')}</span>
</button>
)}
</div>
@@ -214,7 +230,7 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
data-testid="status-module-cursor-coords"
className="bg-ui-input border border-ui-subtle px-2 py-0.5 rounded-ui-sm flex items-center gap-1.5"
>
- <span className="text-ui-muted text-[10px]">Pos:</span>
+ <span className="text-ui-muted text-[10px]">{t('Pos:')}</span>
<span ref={posTextRef} className="text-ui-primary text-[11px] tabular-nums">
— , —
</span>
@@ -227,7 +243,7 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
data-testid="status-module-pressure"
className="bg-ui-input border border-ui-subtle px-2 py-0.5 rounded-ui-sm flex items-center gap-2"
>
- <span className="text-ui-muted text-[10px]">Pressure:</span>
+ <span className="text-ui-muted text-[10px]">{t('Pressure:')}</span>
<div className="w-14 h-1.5 bg-ui-control rounded-full overflow-hidden">
<div
ref={pressureBarRef}
@@ -253,9 +269,9 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
? 'cursor-pointer hover:bg-ui-control-hover text-ui-primary'
: 'opacity-40 pointer-events-none'
}`}
- title="Canvas Rotation (Click or Double-click to Reset 0°)"
+ title={t('Canvas Rotation (Click or Double-click to Reset 0°)')}
>
- <span className="text-ui-muted text-[10px]">Angle:</span>
+ <span className="text-ui-muted text-[10px]">{t('Angle:')}</span>
<span className="text-ui-primary font-medium text-[11px] tabular-nums">
{hasOpenDocument ? formatRotationDegrees(rotation) : '0°'}
</span>
@@ -273,11 +289,11 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
}`}
title={
onResetZoomTo100
- ? 'Canvas Zoom Level (Click to Reset to 100% — Ctrl+1)'
- : 'Canvas Zoom Level'
+ ? t('Canvas Zoom Level (Click to Reset to 100% — Ctrl+1)')
+ : t('Canvas Zoom Level')
}
>
- <span className="text-ui-muted text-[10px]">Zoom:</span>
+ <span className="text-ui-muted text-[10px]">{t('Zoom:')}</span>
<span className="text-ui-primary font-medium text-[11px] tabular-nums">
{hasOpenDocument ? formatZoomPercent(zoom) : '—'}
</span>
diff --git a/src/components/StraightRulerOverlay.tsx b/src/components/StraightRulerOverlay.tsx
index e9cb239..baf5942 100644
--- a/src/components/StraightRulerOverlay.tsx
+++ b/src/components/StraightRulerOverlay.tsx
@@ -9,6 +9,7 @@ import {
normalizeRulerAngle,
snapAngleToStep,
} from '../utils/straightRulerMath';
+import { useI18n } from '../i18n';
interface StraightRulerOverlayProps {
ruler: StraightRuler;
@@ -40,6 +41,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
navigation,
viewportRef,
}) => {
+ const { t } = useI18n();
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const moveHandleRef = useRef<HTMLDivElement | null>(null);
const rotLeftHandleRef = useRef<HTMLDivElement | null>(null);
@@ -450,7 +452,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
ref={moveHandleRef}
data-testid="straight-ruler-move-handle"
onPointerDown={(e) => startHandleDrag('move', e)}
- title="Drag to move ruler"
+ title={t('Drag to move ruler')}
className="absolute top-0 left-0 pointer-events-auto cursor-move group"
>
<div className="w-7 h-7 rounded-full bg-ui-floating border-2 border-sky-500 text-ui-primary shadow-ui-floating flex items-center justify-center transition-transform duration-100 group-hover:scale-110 group-active:scale-95">
@@ -462,7 +464,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
ref={rotLeftHandleRef}
data-testid="straight-ruler-rotate-left"
onPointerDown={(e) => startHandleDrag('rotate-left', e)}
- title="Drag to rotate ruler (hold Shift for 15° snap)"
+ title={t('Drag to rotate ruler (hold Shift for 15° snap)')}
className="absolute top-0 left-0 pointer-events-auto cursor-grab active:cursor-grabbing group"
>
<div className="w-6 h-6 rounded-full bg-ui-floating border-2 border-sky-500 text-ui-primary shadow-ui-floating flex items-center justify-center transition-transform duration-100 group-hover:scale-110 group-active:scale-95">
@@ -474,7 +476,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
ref={rotRightHandleRef}
data-testid="straight-ruler-rotate-right"
onPointerDown={(e) => startHandleDrag('rotate-right', e)}
- title="Drag to rotate ruler (hold Shift for 15° snap)"
+ title={t('Drag to rotate ruler (hold Shift for 15° snap)')}
className="absolute top-0 left-0 pointer-events-auto cursor-grab active:cursor-grabbing group"
>
<div className="w-6 h-6 rounded-full bg-ui-floating border-2 border-sky-500 text-ui-primary shadow-ui-floating flex items-center justify-center transition-transform duration-100 group-hover:scale-110 group-active:scale-95">
@@ -502,7 +504,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
>
<span
className="font-ui-mono tabular-nums text-[11px] text-ui-accent font-medium min-w-[46px] text-center"
- title="Scroll to adjust angle (Shift+Scroll for 15°)"
+ title={t('Scroll to adjust angle (Shift+Scroll for 15°)')}
data-testid="straight-ruler-angle-readout"
>
{ruler.angle.toFixed(1)}°
@@ -520,7 +522,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
? 'bg-ui-control-active text-ui-accent'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
- title={`Set ruler angle to ${deg}°`}
+ title={t('Set ruler angle to {deg}°', { deg })}
>
{deg}°
</button>
@@ -534,7 +536,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
type="button"
data-testid="straight-ruler-lock-btn"
onClick={() => onUpdateRuler({ ...ruler, locked: !ruler.locked })}
- title={ruler.locked ? 'Unlock Ruler Position & Angle' : 'Lock Ruler in Place'}
+ title={ruler.locked ? t('Unlock Ruler Position & Angle') : t('Lock Ruler in Place')}
aria-pressed={ruler.locked}
className={`px-1.5 py-0.5 rounded-ui-xs border flex items-center gap-1 cursor-pointer transition-colors ${
ruler.locked
@@ -543,14 +545,18 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
}`}
>
{ruler.locked ? <Lock className="w-3 h-3" /> : <Unlock className="w-3 h-3" />}
- <span>{ruler.locked ? 'Locked' : 'Lock'}</span>
+ <span>{ruler.locked ? t('Locked') : t('Lock')}</span>
</button>
<button
type="button"
data-testid="straight-ruler-snap-btn"
onClick={() => onUpdateRuler({ ...ruler, snapEnabled: !ruler.snapEnabled })}
- title={ruler.snapEnabled ? 'Disable Snapping (or hold Alt while drawing)' : 'Enable Snapping'}
+ title={
+ ruler.snapEnabled
+ ? t('Disable Snapping (or hold Alt while drawing)')
+ : t('Enable Snapping')
+ }
aria-pressed={ruler.snapEnabled}
className={`w-6 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
ruler.snapEnabled
@@ -566,7 +572,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
type="button"
data-testid="straight-ruler-center-btn"
onClick={handleRecenter}
- title="Center Ruler in Viewport"
+ title={t('Center Ruler in Viewport')}
className="w-6 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer transition-colors"
>
<Crosshair className="w-3 h-3" />
@@ -577,7 +583,7 @@ export const StraightRulerOverlay: React.FC<StraightRulerOverlayProps> = ({
type="button"
data-testid="straight-ruler-close-btn"
onClick={onCloseRuler}
- title="Hide Ruler (R)"
+ title={t('Hide Ruler (R)')}
className="w-6 h-5 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-danger hover:bg-ui-danger/15 cursor-pointer transition-colors"
>
<X className="w-3 h-3" />
diff --git a/src/components/SubToolList.tsx b/src/components/SubToolList.tsx
index 460208a..f732a59 100644
--- a/src/components/SubToolList.tsx
+++ b/src/components/SubToolList.tsx
@@ -103,6 +103,7 @@ import { BrushPreview } from './BrushPreview';
import { IconButton } from './ui';
import { resolveAppearanceTokens } from '../utils/themeEngine';
import { NEUTRAL_BRUSH_DEFAULTS } from '../utils/brushPresetManager';
+import { isImeComposing, useI18n } from '../i18n';
export interface SubToolListProps {
customBrushes: CspBrush[];
@@ -364,6 +365,7 @@ function detectCustomGroupTabDropTarget(
export const SubToolList: React.FC<SubToolListProps> = React.memo(
({ customBrushes, setCustomBrushes }) => {
+ const { t, td } = useI18n();
const currentTool = useToolStore((s) => s.tool);
const activePreset = useToolStore((s) => s.activePresetId);
const quickBrushIds = useWorkspaceStore((s) => s.quickBrushPanel.brushIds);
@@ -472,6 +474,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setGroupContextMenu(null);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
setBrushContextMenu(null);
setGroupContextMenu(null);
@@ -564,8 +567,8 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
}
uiStoreActions.showToast(
added
- ? `Added "${brushName}" to Quick Brush Panel`
- : `Removed "${brushName}" from Quick Brush Panel`
+ ? t('Added "{name}" to Quick Brush Panel', { name: td(brushName) })
+ : t('Removed "{name}" from Quick Brush Panel', { name: td(brushName) })
);
};
@@ -596,9 +599,11 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
}
uiStoreActions.updateAppSettings({ ...latest, shortcuts: nextShortcuts });
if (shortcut) {
- uiStoreActions.showToast(`Shortcut assigned: ${formatShortcutLabel(shortcut)}`);
+ uiStoreActions.showToast(
+ t('Shortcut assigned: {shortcut}', { shortcut: formatShortcutLabel(shortcut) })
+ );
} else {
- uiStoreActions.showToast('Shortcut cleared');
+ uiStoreActions.showToast(t('Shortcut cleared'));
}
};
@@ -646,21 +651,30 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const first = parsedBrush.importWarnings[0];
uiStoreActions.showToast(
count === 1
- ? `Imported "${parsedBrush.name}" (Notice: ${first})`
- : `Imported "${parsedBrush.name}" with ${count} CSP import notices — check inspector`
+ ? t('Imported "{name}" (Notice: {notice})', {
+ name: parsedBrush.name,
+ notice: first,
+ })
+ : t('Imported "{name}" with {count} CSP import notices — check inspector', {
+ name: parsedBrush.name,
+ count,
+ })
);
} else {
uiStoreActions.showToast(
activeCustomGroup
- ? `Imported "${parsedBrush.name}" into "${activeCustomGroup.name}"`
- : `Imported brush "${parsedBrush.name}"`
+ ? t('Imported "{name}" into "{group}"', {
+ name: parsedBrush.name,
+ group: activeCustomGroup.name,
+ })
+ : t('Imported brush "{name}"', { name: parsedBrush.name })
);
}
} catch (err: unknown) {
const msg =
- err instanceof Error ? err.message : 'Failed to import brush file.';
+ err instanceof Error ? err.message : t('Failed to import brush file.');
void uiStoreActions.alertDialog({
- title: 'Brush Import Failed',
+ title: t('Brush Import Failed'),
message: msg,
});
} finally {
@@ -675,12 +689,12 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const brush = buildExportableBrush(presetId, customBrushes, liveSettings);
const res = await exportBrushToInkbFile(brush);
if (res.exported) {
- uiStoreActions.showToast(`Saved brush "${res.fileName}"`);
+ uiStoreActions.showToast(t('Saved brush "{fileName}"', { fileName: res.fileName }));
}
} catch (err: unknown) {
- const msg = err instanceof Error ? err.message : 'Failed to export brush.';
+ const msg = err instanceof Error ? err.message : t('Failed to export brush.');
void uiStoreActions.alertDialog({
- title: 'Brush Export Failed',
+ title: t('Brush Export Failed'),
message: msg,
});
}
@@ -689,15 +703,15 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const handleDeleteCustomBrush = async (e: React.MouseEvent | undefined, brush: CspBrush) => {
e?.stopPropagation();
const subtitle = brush.badge
- ? `${brush.badge} brush`
- : 'Imported custom brush';
+ ? t('{badge} brush', { badge: td(brush.badge) })
+ : t('Imported custom brush');
const confirmed = await uiStoreActions.confirmDialog({
variant: 'danger',
- title: 'Delete Brush',
- message: 'Are you sure you want to delete this brush?',
- detail: 'This permanently removes the brush from your library and cannot be undone.',
- confirmLabel: 'Delete',
- cancelLabel: 'Cancel',
+ title: t('Delete Brush'),
+ message: t('Are you sure you want to delete this brush?'),
+ detail: t('This permanently removes the brush from your library and cannot be undone.'),
+ confirmLabel: t('Delete'),
+ cancelLabel: t('Cancel'),
preview: {
imageUrl: brush.tipDataUrl,
title: brush.name,
@@ -729,7 +743,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const newBrush: CspBrush = {
...base,
id,
- name: isDecorationMode ? 'New Decoration Brush' : 'New Natural Brush',
+ name: isDecorationMode ? t('New Decoration Brush') : t('New Natural Brush'),
category: targetCategory,
badge: isDecorationMode ? 'Decoration' : 'Studio',
importedAt: Date.now(),
@@ -758,7 +772,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const dupBrush: CspBrush = {
...exported,
id,
- name: `${exported.name} Copy`,
+ name: t('{name} Copy', { name: td(exported.name) }),
badge: 'Studio',
importedAt: Date.now(),
};
@@ -780,14 +794,14 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const handleCommitCreateGroup = () => {
const created = subToolGroupStoreActions.createGroup({
- name: newGroupName.trim() || `Custom Group ${scopedCustomGroups.length + 1}`,
+ name: newGroupName.trim() || t('Custom Group {n}', { n: scopedCustomGroups.length + 1 }),
color: newGroupColor,
toolScope: isDecorationMode ? 'decoration' : 'brush',
selectTab: true,
});
setIsCreatingGroup(false);
setNewGroupName('');
- uiStoreActions.showToast(`Created Sub Tool group "${created.name}"`);
+ uiStoreActions.showToast(t('Created Sub Tool group "{name}"', { name: created.name }));
};
const handleCreateGroupFromBrush = useCallback((presetId: BrushPresetId, brushName: string) => {
@@ -797,7 +811,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
.groups.filter((g) => (decoScope ? isDecorationCustomGroup(g) : !isDecorationCustomGroup(g)))
.length;
const created = subToolGroupStoreActions.createGroup({
- name: `Custom Group ${existingCount + 1}`,
+ name: t('Custom Group {n}', { n: existingCount + 1 }),
color: SUBTOOL_GROUP_COLOR_SWATCHES[1]?.hex ?? null,
toolScope: decoScope ? 'decoration' : 'brush',
initialBrushIds: [presetId],
@@ -805,26 +819,32 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
});
setRenamingGroupId(created.id);
setRenameDraft(created.name);
- uiStoreActions.showToast(`Created "${created.name}" with "${brushName}"`);
- }, []);
+ uiStoreActions.showToast(
+ t('Created "{group}" with "{brush}"', { group: created.name, brush: td(brushName) })
+ );
+ }, [t, td]);
const handleDeleteCustomGroup = async (group: CustomSubToolGroup) => {
const confirmed = await uiStoreActions.confirmDialog({
variant: 'danger',
- title: 'Delete Sub Tool Group',
- message: `Delete custom group "${group.name}"?`,
+ title: t('Delete Sub Tool Group'),
+ message: t('Delete custom group "{name}"?', { name: group.name }),
detail:
- group.brushIds.length > 0
- ? `Its ${group.brushIds.length} sub tool${group.brushIds.length === 1 ? '' : 's'} will safely return to their default sections.`
- : 'This removes the empty custom Sub Tool group.',
- confirmLabel: 'Delete Group',
- cancelLabel: 'Cancel',
+ group.brushIds.length === 1
+ ? t('Its 1 sub tool will safely return to their default sections.')
+ : group.brushIds.length > 1
+ ? t('Its {count} sub tools will safely return to their default sections.', {
+ count: group.brushIds.length,
+ })
+ : t('This removes the empty custom Sub Tool group.'),
+ confirmLabel: t('Delete Group'),
+ cancelLabel: t('Cancel'),
});
if (confirmed) {
subToolGroupStoreActions.deleteGroup(group.id);
removeOrphanShortcut(getSubToolGroupCommandId(group.id));
if (addBrushesGroupId === group.id) setAddBrushesGroupId(null);
- uiStoreActions.showToast(`Deleted group "${group.name}"`);
+ uiStoreActions.showToast(t('Deleted group "{name}"', { name: group.name }));
}
};
@@ -969,8 +989,11 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
if (finalTarget.kind === 'quick-brush-panel') {
const added = workspaceStoreActions.addQuickBrush(presetId);
+ const displayName = td(name);
uiStoreActions.showToast(
- added ? `Added "${name}" to Quick Brushes` : `"${name}" is already in Quick Brushes`
+ added
+ ? t('Added "{name}" to Quick Brushes', { name: displayName })
+ : t('"{name}" is already in Quick Brushes', { name: displayName })
);
return;
}
@@ -987,11 +1010,12 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
visibleIds
);
if (finalTarget.groupId !== sourceGroupId) {
- const targetLabel = getGroupDisplayLabel(
- finalTarget.groupId,
- customGroupsRef.current
+ const targetLabel = td(
+ getGroupDisplayLabel(finalTarget.groupId, customGroupsRef.current)
+ );
+ uiStoreActions.showToast(
+ t('Moved "{name}" to "{group}"', { name: td(name), group: targetLabel })
);
- uiStoreActions.showToast(`Moved "${name}" to "${targetLabel}"`);
}
return;
}
@@ -1008,11 +1032,12 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
visibleIds
);
if (moved) {
- const targetLabel = getGroupDisplayLabel(
- finalTarget.groupId,
- customGroupsRef.current
+ const targetLabel = td(
+ getGroupDisplayLabel(finalTarget.groupId, customGroupsRef.current)
+ );
+ uiStoreActions.showToast(
+ t('Moved "{name}" to "{group}"', { name: td(name), group: targetLabel })
);
- uiStoreActions.showToast(`Moved "${name}" to "${targetLabel}"`);
}
}
};
@@ -1022,7 +1047,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
window.addEventListener('pointercancel', onCancel);
window.addEventListener('keydown', onKeyDown);
},
- [handleCreateGroupFromBrush]
+ [handleCreateGroupFromBrush, t, td]
);
// Unified Pointer-Event Drag for Reordering Custom Group Tabs
@@ -1151,6 +1176,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
) => {
const { builtin, custom, ownerGroupId } = options;
const name = custom ? custom.name : builtin ? builtin.name : presetId;
+ const displayName = custom ? custom.name : builtin ? td(builtin.name, 'brushName') : td(presetId, 'brushName');
const isSelected =
isPaintTool(currentTool) &&
(activePreset === presetId ||
@@ -1171,9 +1197,17 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
? activeBrushDrag.target.position
: null;
+ const shortcutSuffix = boundShortcut ? ` (${formatShortcutLabel(boundShortcut)})` : '';
const rowTitle = builtin
- ? `${builtin.name} — ${builtin.desc}${boundShortcut ? ` (${formatShortcutLabel(boundShortcut)})` : ''} · Drag to move or reorder`
- : `${name}${boundShortcut ? ` (${formatShortcutLabel(boundShortcut)})` : ''} · Drag to move or reorder`;
+ ? t('{name} — {desc}{shortcut} · Drag to move or reorder', {
+ name: displayName,
+ desc: td(builtin.desc),
+ shortcut: shortcutSuffix,
+ })
+ : t('{name}{shortcut} · Drag to move or reorder', {
+ name: displayName,
+ shortcut: shortcutSuffix,
+ });
// 1. GRID MODE: Clean 2-column visual brush cards with stroke preview + name below
if (brushListStyle === 'grid') {
@@ -1244,13 +1278,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={(e) => handleTogglePinToQuickPanel(presetId, name, e)}
title={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-label={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-pressed={isPinned}
className={`w-4 h-4 rounded-ui-xs flex items-center justify-center cursor-pointer transition-opacity ${
@@ -1265,8 +1299,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
type="button"
data-testid={`subtool-menu-btn-${presetId}`}
onClick={(e) => openBrushMenu(e, presetId, name, custom)}
- title={`Sub Tool options for ${name} (move group, shortcut, export)`}
- aria-label={`Options for ${name}`}
+ title={t('Sub Tool options for {name} (move group, shortcut, export)', {
+ name: displayName,
+ })}
+ aria-label={t('Options for {name}', { name: displayName })}
className="opacity-0 group-hover:opacity-100 focus:opacity-100 w-4 h-4 rounded-ui-xs bg-ui-panel/90 text-ui-muted hover:text-ui-primary flex items-center justify-center cursor-pointer transition-opacity"
>
<MoreHorizontal className="w-2.5 h-2.5" />
@@ -1276,12 +1312,12 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{/* Label & Shortcut Footer */}
<div className="flex items-center justify-between gap-1 min-w-0 px-0.5">
- <span className="text-[10.5px] leading-tight truncate flex-1">{name}</span>
+ <span className="text-[10.5px] leading-tight truncate flex-1">{displayName}</span>
{custom?.importWarnings && custom.importWarnings.length > 0 && (
<span
title={custom.importWarnings.join('\n')}
className="text-ui-warning shrink-0"
- aria-label="Import warning"
+ aria-label={t('Import warning')}
>
<AlertTriangle className="w-2.5 h-2.5" />
</span>
@@ -1290,7 +1326,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<span
data-testid={`subtool-shortcut-badge-${presetId}`}
className="text-[8px] font-ui-mono tabular-nums px-1 py-px rounded-ui-xs bg-ui-input text-ui-accent border border-ui-subtle shrink-0"
- title={`Shortcut: ${formatShortcutLabel(boundShortcut)}`}
+ title={t('Shortcut: {shortcut}', {
+ shortcut: formatShortcutLabel(boundShortcut),
+ })}
>
{formatShortcutLabel(boundShortcut)}
</span>
@@ -1348,13 +1386,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{renderBrushTipIcon(builtin, custom, 'w-3 h-3')}
</span>
- <span className="text-[11px] truncate leading-tight flex-1 min-w-0">{name}</span>
+ <span className="text-[11px] truncate leading-tight flex-1 min-w-0">{displayName}</span>
{custom?.importWarnings && custom.importWarnings.length > 0 && (
<span
title={custom.importWarnings.join('\n')}
className="text-ui-warning shrink-0"
- aria-label="Import warning"
+ aria-label={t('Import warning')}
>
<AlertTriangle className="w-2.5 h-2.5" />
</span>
@@ -1364,7 +1402,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<span
data-testid={`subtool-shortcut-badge-${presetId}`}
className="text-[8.5px] font-ui-mono tabular-nums px-1 py-px rounded-ui-xs bg-ui-input text-ui-accent border border-ui-subtle shrink-0"
- title={`Shortcut: ${formatShortcutLabel(boundShortcut)}`}
+ title={t('Shortcut: {shortcut}', {
+ shortcut: formatShortcutLabel(boundShortcut),
+ })}
>
{formatShortcutLabel(boundShortcut)}
</span>
@@ -1377,13 +1417,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={(e) => handleTogglePinToQuickPanel(presetId, name, e)}
title={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-label={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-pressed={isPinned}
className={`shrink-0 cursor-pointer transition-opacity ${
@@ -1400,8 +1440,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
type="button"
data-testid={`subtool-menu-btn-${presetId}`}
onClick={(e) => openBrushMenu(e, presetId, name, custom)}
- title={`Sub Tool options for ${name} (move group, shortcut, export)`}
- aria-label={`Options for ${name}`}
+ title={t('Sub Tool options for {name} (move group, shortcut, export)', {
+ name: displayName,
+ })}
+ aria-label={t('Options for {name}', { name: displayName })}
className="opacity-0 group-hover:opacity-100 focus:opacity-100 text-ui-muted hover:text-ui-primary shrink-0 cursor-pointer"
>
<MoreHorizontal className="w-2.5 h-2.5" />
@@ -1409,7 +1451,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<button
type="button"
onClick={(e) => handleExportBrush(presetId, e)}
- title={`Export ${name} (.inkb)`}
+ title={t('Export {name} (.inkb)', { name: displayName })}
className="opacity-0 group-hover:opacity-100 text-ui-muted hover:text-ui-primary shrink-0 cursor-pointer"
>
<Download className="w-2.5 h-2.5" />
@@ -1418,7 +1460,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<button
type="button"
onClick={(e) => void handleDeleteCustomBrush(e, custom)}
- title="Delete brush"
+ title={t('Delete brush')}
className="opacity-0 group-hover:opacity-100 text-ui-muted hover:text-ui-danger shrink-0 cursor-pointer"
>
<Trash2 className="w-2.5 h-2.5" />
@@ -1485,13 +1527,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{/* Clean single-line name + optional warning/shortcut/star */}
<div className="flex-1 min-w-0 flex items-center gap-1">
- <span className="text-[11px] truncate leading-tight">{name}</span>
+ <span className="text-[11px] truncate leading-tight">{displayName}</span>
{custom?.importWarnings && custom.importWarnings.length > 0 && (
<span
title={custom.importWarnings.join('\n')}
className="text-ui-warning shrink-0"
- aria-label="Import warning"
+ aria-label={t('Import warning')}
>
<AlertTriangle className="w-2.5 h-2.5" />
</span>
@@ -1501,7 +1543,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<span
data-testid={`subtool-shortcut-badge-${presetId}`}
className="text-[8.5px] font-ui-mono tabular-nums px-1 py-px rounded-ui-xs bg-ui-input text-ui-accent border border-ui-subtle shrink-0"
- title={`Shortcut: ${formatShortcutLabel(boundShortcut)}`}
+ title={t('Shortcut: {shortcut}', {
+ shortcut: formatShortcutLabel(boundShortcut),
+ })}
>
{formatShortcutLabel(boundShortcut)}
</span>
@@ -1513,13 +1557,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={(e) => handleTogglePinToQuickPanel(presetId, name, e)}
title={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-label={
isPinned
- ? `Remove ${name} from Quick Brush Panel`
- : `Add ${name} to Quick Brush Panel`
+ ? t('Remove {name} from Quick Brush Panel', { name: displayName })
+ : t('Add {name} to Quick Brush Panel', { name: displayName })
}
aria-pressed={isPinned}
className={`shrink-0 cursor-pointer transition-opacity ${
@@ -1553,8 +1597,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
type="button"
data-testid={`subtool-menu-btn-${presetId}`}
onClick={(e) => openBrushMenu(e, presetId, name, custom)}
- title={`Sub Tool options for ${name} (move group, shortcut, export)`}
- aria-label={`Options for ${name}`}
+ title={t('Sub Tool options for {name} (move group, shortcut, export)', {
+ name: displayName,
+ })}
+ aria-label={t('Options for {name}', { name: displayName })}
className="p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-primary cursor-pointer"
>
<MoreHorizontal className="w-2.5 h-2.5" />
@@ -1562,7 +1608,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<button
type="button"
onClick={(e) => handleExportBrush(presetId, e)}
- title={`Export ${name} (.inkb)`}
+ title={t('Export {name} (.inkb)', { name: displayName })}
className="p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-primary cursor-pointer"
>
<Download className="w-2.5 h-2.5" />
@@ -1571,7 +1617,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<button
type="button"
onClick={(e) => void handleDeleteCustomBrush(e, custom)}
- title="Delete brush"
+ title={t('Delete brush')}
className="p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-danger cursor-pointer"
>
<Trash2 className="w-2.5 h-2.5" />
@@ -1647,6 +1693,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
maxLength={32}
onChange={(e) => setRenameDraft(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') handleCommitRenameGroup(group.id);
if (e.key === 'Escape') {
setRenamingGroupId(null);
@@ -1669,7 +1716,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
}}
onContextMenu={(e) => openGroupMenu(e, group, groupIndex)}
className="flex items-center gap-1 min-w-0 flex-1 text-left text-[9.5px] uppercase tracking-[0.06em] text-ui-secondary hover:text-ui-primary select-none cursor-pointer"
- title={`${group.name} (double-click to rename, right-click for options)`}
+ title={t('{name} (double-click to rename, right-click for options)', {
+ name: group.name,
+ })}
>
{!isFocusedSingleView &&
(isCollapsed ? (
@@ -1697,7 +1746,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<span
data-testid={`subtool-group-shortcut-badge-${group.id}`}
className="text-[8.5px] font-ui-mono px-1 py-px rounded-ui-xs bg-ui-input text-ui-accent border border-ui-subtle"
- title={`Group shortcut: ${formatShortcutLabel(groupShortcut)}`}
+ title={t('Group shortcut: {shortcut}', {
+ shortcut: formatShortcutLabel(groupShortcut),
+ })}
>
{formatShortcutLabel(groupShortcut)}
</span>
@@ -1708,7 +1759,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={() =>
setAddBrushesGroupId((cur) => (cur === group.id ? null : group.id))
}
- title={`Add or manage brushes in "${group.name}"`}
+ title={t('Add or manage brushes in "{name}"', { name: group.name })}
className={`p-0.5 rounded-ui-xs cursor-pointer transition-colors ${
isAddingBrushes
? 'text-ui-accent bg-ui-control-active'
@@ -1721,7 +1772,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
type="button"
data-testid={`subtool-group-menu-btn-${group.id}`}
onClick={(e) => openGroupMenu(e, group, groupIndex)}
- title={`Options for "${group.name}"`}
+ title={t('Options for "{name}"', { name: group.name })}
className="p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<MoreHorizontal className="w-2.5 h-2.5" />
@@ -1736,12 +1787,12 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="mx-0.5 p-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle space-y-1"
>
<div className="flex items-center justify-between text-[9.5px] text-ui-secondary">
- <span>Assign brushes to &ldquo;{group.name}&rdquo;</span>
+ <span>{t('Assign brushes to \u201c{name}\u201d', { name: group.name })}</span>
<button
type="button"
onClick={() => setAddBrushesGroupId(null)}
className="text-ui-muted hover:text-ui-primary cursor-pointer"
- aria-label="Close brush picker"
+ aria-label={t('Close brush picker')}
>
<X className="w-3 h-3" />
</button>
@@ -1796,7 +1847,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
: 'text-ui-muted hover:bg-ui-control-hover hover:text-ui-primary'
}`}
>
- <span className="truncate">{bb.name}</span>
+ <span className="truncate">{td(bb.name)}</span>
{inThisGroup ? (
<Check className="w-2.5 h-2.5 text-ui-accent shrink-0" />
) : (
@@ -1813,14 +1864,14 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
(resolvedMembers.length === 0 ? (
<div className="mx-0.5 px-2 py-2 rounded-ui-sm border border-dashed border-ui-default bg-ui-input text-center space-y-1">
<div className="text-[10px] text-ui-muted">
- Drag any brush here or add sub tools
+ {t('Drag any brush here or add sub tools')}
</div>
<button
type="button"
onClick={() => setAddBrushesGroupId(group.id)}
className="px-2 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer"
>
- + Add Sub Tools
+ {t('+ Add Sub Tools')}
</button>
</div>
) : (
@@ -1831,19 +1882,23 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
};
const getDragGhostHint = (drag: ActiveBrushPointerDrag): string | null => {
- const t = drag.target;
- if (!t) return null;
- if (t.kind === 'create-group') return '+ Create New Group';
- if (t.kind === 'quick-brush-panel') return '+ Pin to Quick Brushes';
- if (t.kind === 'group-tab' || t.kind === 'group-section') {
- if (t.groupId === drag.sourceGroupId) return null;
- return `Move to ${getGroupDisplayLabel(t.groupId, customGroups)}`;
+ const target = drag.target;
+ if (!target) return null;
+ if (target.kind === 'create-group') return t('+ Create New Group');
+ if (target.kind === 'quick-brush-panel') return t('+ Pin to Quick Brushes');
+ if (target.kind === 'group-tab' || target.kind === 'group-section') {
+ if (target.groupId === drag.sourceGroupId) return null;
+ return t('Move to {group}', {
+ group: td(getGroupDisplayLabel(target.groupId, customGroups)),
+ });
}
- if (t.kind === 'brush-row') {
- const grpLabel = getGroupDisplayLabel(t.groupId, customGroups);
- return t.groupId === drag.sourceGroupId
- ? `Reorder (${t.position})`
- : `Move to ${grpLabel}`;
+ if (target.kind === 'brush-row') {
+ const grpLabel = td(getGroupDisplayLabel(target.groupId, customGroups));
+ return target.groupId === drag.sourceGroupId
+ ? target.position === 'before'
+ ? t('Reorder (before)')
+ : t('Reorder (after)')
+ : t('Move to {group}', { group: grpLabel });
}
return null;
};
@@ -1865,9 +1920,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<IconButton
size="xs"
onClick={handleCreateNewBrush}
- title="Create New Brush in Brush Studio"
+ title={t('Create New Brush in Brush Studio')}
icon={<Plus className="w-3 h-3" />}
- label="New"
+ label={t('New')}
/>
<IconButton
size="xs"
@@ -1877,19 +1932,19 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setIsCreatingGroup((v) => !v);
setNewGroupName('');
}}
- title="Create Custom Sub Tool Group"
+ title={t('Create Custom Sub Tool Group')}
icon={<FolderPlus className="w-3 h-3" />}
/>
<IconButton
size="xs"
onClick={() => void handleDuplicateActiveBrush()}
- title="Duplicate Active Brush"
+ title={t('Duplicate Active Brush')}
icon={<Copy className="w-2.5 h-2.5" />}
/>
<IconButton
size="xs"
onClick={() => uiStoreActions.setBrushStudioModalOpen(true)}
- title="Edit Active Brush in Brush Studio"
+ title={t('Edit Active Brush in Brush Studio')}
icon={<Sliders className="w-2.5 h-2.5" />}
/>
</div>
@@ -1902,8 +1957,8 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={() => workspaceStoreActions.toggleQuickBrushPanelVisible()}
title={
quickBrushVisible
- ? 'Hide Quick-Access Brush Panel (Shift+B)'
- : 'Show Quick-Access Brush Panel (Shift+B)'
+ ? t('Hide Quick-Access Brush Panel (Shift+B)')
+ : t('Show Quick-Access Brush Panel (Shift+B)')
}
aria-pressed={quickBrushVisible}
icon={<Star className="w-2.5 h-2.5" fill={quickBrushVisible ? 'currentColor' : 'none'} />}
@@ -1911,7 +1966,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<IconButton
size="xs"
onClick={() => sutInputRef.current?.click()}
- title="Import Brush (.inkb, .sut)"
+ title={t('Import Brush (.inkb, .sut)')}
icon={<FolderDown className="w-2.5 h-2.5" />}
/>
<IconButton
@@ -1922,7 +1977,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
(isDecorationMode ? DEFAULT_DECORATION_PRESET_ID : DEFAULT_BRUSH_PRESET_ID)
)
}
- title="Export Active Brush (.inkb)"
+ title={t('Export Active Brush (.inkb)')}
icon={<Download className="w-2.5 h-2.5" />}
/>
</div>
@@ -1947,9 +2002,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
? 'bg-ui-accent-subtle text-ui-primary font-medium border-ui-accent-border/45'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
- title="Show all Decoration sub tools"
+ title={t('Show all Decoration sub tools')}
>
- All
+ {t('All')}
{effectiveActiveDecorationTab === 'all' && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -1982,7 +2037,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setRenameDraft(group.name);
}}
onContextMenu={(e) => openGroupMenu(e, group, idx)}
- title={`${group.name}${grpShortcut ? ` (${formatShortcutLabel(grpShortcut)})` : ''} — Drag brushes here or right-click for options`}
+ title={t('{name}{shortcut} — Drag brushes here or right-click for options', {
+ name: group.name,
+ shortcut: grpShortcut ? ` (${formatShortcutLabel(grpShortcut)})` : '',
+ })}
className={`relative h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] shrink-0 max-w-[100px] transition-colors cursor-pointer border ${
isBrushDropOver || isGroupReorderOver
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent ring-1 ring-ui-accent'
@@ -2012,6 +2070,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const isBrushDropOver =
activeBrushDrag?.target?.kind === 'group-tab' &&
activeBrushDrag.target.groupId === sec.id;
+ const secLabel = td(sec.label);
return (
<button
key={sec.id}
@@ -2021,7 +2080,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={() =>
subToolGroupStoreActions.setActiveDecorationTab(sec.id as DecorationCategory)
}
- title={`${sec.label} decoration brushes — Drag any brush here to move it into ${sec.label}`}
+ title={t(
+ '{label} decoration brushes — Drag any brush here to move it into {label}',
+ { label: secLabel }
+ )}
className={`relative h-5 px-1.5 rounded-ui-xs text-[10px] shrink-0 transition-colors cursor-pointer border ${
isBrushDropOver
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent ring-1 ring-ui-accent'
@@ -2030,7 +2092,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- {sec.label}
+ {secLabel}
{isTabActive && !isBrushDropOver && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -2047,8 +2109,8 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setIsCreatingGroup((v) => !v);
setNewGroupName('');
}}
- title="Create Custom Sub Tool Group (click or drag any brush here)"
- aria-label="Create Custom Sub Tool Group"
+ title={t('Create Custom Sub Tool Group (click or drag any brush here)')}
+ aria-label={t('Create Custom Sub Tool Group')}
className={`h-5 px-1.5 rounded-ui-xs flex items-center gap-0.5 text-[10px] shrink-0 transition-colors cursor-pointer border ${
isCreateGroupDropActive
? 'bg-ui-accent text-ui-accent-contrast border-transparent font-semibold'
@@ -2060,7 +2122,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
}`}
>
<FolderPlus className="w-2.5 h-2.5 shrink-0" />
- <span>{activeBrushDrag ? 'New Group' : '+ Group'}</span>
+ <span>{activeBrushDrag ? t('New Group') : t('+ Group')}</span>
</button>
</div>
) : (
@@ -2081,9 +2143,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
? 'bg-ui-accent-subtle text-ui-primary font-medium border-ui-accent-border/45'
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
- title="Show all Sub Tool groups"
+ title={t('Show all Sub Tool groups')}
>
- All
+ {t('All')}
{effectiveActiveTab === 'all' && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -2116,7 +2178,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setRenameDraft(group.name);
}}
onContextMenu={(e) => openGroupMenu(e, group, idx)}
- title={`${group.name}${grpShortcut ? ` (${formatShortcutLabel(grpShortcut)})` : ''} — Drag brushes here or right-click for options`}
+ title={t('{name}{shortcut} — Drag brushes here or right-click for options', {
+ name: group.name,
+ shortcut: grpShortcut ? ` (${formatShortcutLabel(grpShortcut)})` : '',
+ })}
className={`relative h-5 px-1.5 rounded-ui-xs flex items-center gap-1 text-[10px] shrink-0 max-w-[100px] transition-colors cursor-pointer border ${
isBrushDropOver || isGroupReorderOver
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent ring-1 ring-ui-accent'
@@ -2147,6 +2212,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
const isBrushDropOver =
activeBrushDrag?.target?.kind === 'group-tab' &&
activeBrushDrag.target.groupId === sec.id;
+ const secLabel = td(sec.label);
return (
<button
key={sec.id}
@@ -2154,7 +2220,9 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
data-testid={`subtool-group-tab-${sec.id}`}
data-subtool-drop-tab={sec.id}
onClick={() => subToolGroupStoreActions.setActiveTab(sec.id)}
- title={`${sec.label} sub tools — Drag any brush here to move it into ${sec.label}`}
+ title={t('{label} sub tools — Drag any brush here to move it into {label}', {
+ label: secLabel,
+ })}
className={`relative h-5 px-1.5 rounded-ui-xs text-[10px] shrink-0 transition-colors cursor-pointer border ${
isBrushDropOver
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent ring-1 ring-ui-accent'
@@ -2163,7 +2231,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- {shortBuiltinTabLabel(sec.id, sec.label)}
+ {td(shortBuiltinTabLabel(sec.id, sec.label))}
{isTabActive && !isBrushDropOver && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
)}
@@ -2177,7 +2245,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
data-testid="subtool-group-tab-custom"
data-subtool-drop-tab="custom"
onClick={() => subToolGroupStoreActions.setActiveTab('custom')}
- title="Imported & custom brushes — Drag any brush here to move it into Imported"
+ title={t('Imported & custom brushes — Drag any brush here to move it into Imported')}
className={`relative h-5 px-1.5 rounded-ui-xs text-[10px] shrink-0 transition-colors cursor-pointer border ${
activeBrushDrag?.target?.kind === 'group-tab' &&
activeBrushDrag.target.groupId === 'custom'
@@ -2187,7 +2255,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover border-transparent'
}`}
>
- Imported
+ {t('Imported')}
{effectiveActiveTab === 'custom' &&
!(activeBrushDrag?.target?.kind === 'group-tab' && activeBrushDrag.target.groupId === 'custom') && (
<span className="absolute bottom-0 left-1 right-1 h-[2px] bg-ui-accent rounded-full" />
@@ -2204,8 +2272,8 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setIsCreatingGroup((v) => !v);
setNewGroupName('');
}}
- title="Create Custom Sub Tool Group (click or drag any brush here)"
- aria-label="Create Custom Sub Tool Group"
+ title={t('Create Custom Sub Tool Group (click or drag any brush here)')}
+ aria-label={t('Create Custom Sub Tool Group')}
className={`h-5 px-1.5 rounded-ui-xs flex items-center gap-0.5 text-[10px] shrink-0 transition-colors cursor-pointer border ${
isCreateGroupDropActive
? 'bg-ui-accent text-ui-accent-contrast border-transparent font-semibold'
@@ -2217,7 +2285,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
}`}
>
<FolderPlus className="w-2.5 h-2.5 shrink-0" />
- <span>{activeBrushDrag ? 'New Group' : '+ Group'}</span>
+ <span>{activeBrushDrag ? t('New Group') : t('+ Group')}</span>
</button>
</div>
)}
@@ -2235,9 +2303,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
autoFocus
value={newGroupName}
maxLength={32}
- placeholder={`Custom Group ${scopedCustomGroups.length + 1}`}
+ placeholder={t('Custom Group {n}', { n: scopedCustomGroups.length + 1 })}
onChange={(e) => setNewGroupName(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
handleCommitCreateGroup();
@@ -2253,28 +2322,29 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
onClick={handleCommitCreateGroup}
className="h-6 px-2 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-[10px] font-medium cursor-pointer shrink-0"
>
- Create
+ {t('Create')}
</button>
<button
type="button"
onClick={() => setIsCreatingGroup(false)}
- aria-label="Cancel creating group"
+ aria-label={t('Cancel creating group')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer shrink-0"
>
<X className="w-3 h-3" />
</button>
</div>
<div className="flex items-center gap-1.5">
- <span className="text-[9.5px] text-ui-muted">Tag:</span>
+ <span className="text-[9.5px] text-ui-muted">{t('Tag:')}</span>
{SUBTOOL_GROUP_COLOR_SWATCHES.map((sw) => {
const selected = newGroupColor === sw.hex;
+ const swLabel = td(sw.label);
return (
<button
key={sw.id}
type="button"
onClick={() => setNewGroupColor(sw.hex)}
- title={sw.label}
- aria-label={`Color ${sw.label}`}
+ title={swLabel}
+ aria-label={t('Color {label}', { label: swLabel })}
className={`w-3.5 h-3.5 rounded-full flex items-center justify-center cursor-pointer transition-transform ${
selected ? 'ring-1 ring-ui-primary scale-110' : 'opacity-70 hover:opacity-100'
}`}
@@ -2327,14 +2397,14 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{isDraggingFileOver && (
<div className="absolute inset-1 bg-ui-elevated/95 border border-ui-accent-border rounded-ui-sm flex flex-col items-center justify-center p-2 text-center z-30 pointer-events-none">
<FolderDown className="w-4 h-4 text-ui-accent mb-1" />
- <span className="text-[10px] text-ui-primary">Drop .inkb / .sut</span>
+ <span className="text-[10px] text-ui-primary">{t('Drop .inkb / .sut')}</span>
</div>
)}
{isImportingSut && (
<div className="px-2 py-1 rounded-ui-sm bg-ui-control border border-ui-subtle text-[10px] text-ui-primary flex items-center gap-1.5">
<Loader2 className="w-3 h-3 animate-spin" />
- <span className="truncate">Importing...</span>
+ <span className="truncate">{t('Importing...')}</span>
</div>
)}
@@ -2403,7 +2473,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
) : (
<ChevronDown className="w-2.5 h-2.5 shrink-0 text-ui-icon-muted" />
)}
- <span className="truncate font-medium">{section.label}</span>
+ <span className="truncate font-medium">{td(section.label)}</span>
</span>
<span className="text-[9px] text-ui-muted font-ui-mono tabular-nums shrink-0">
{resolvedItems.length}
@@ -2414,7 +2484,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{!isCollapsed &&
(resolvedItems.length === 0 ? (
<div className="px-2 py-2 text-[10px] text-ui-muted text-center border border-dashed border-ui-default rounded-ui-sm">
- Drag any brush here to add to {section.label}
+ {t('Drag any brush here to add to {label}', { label: td(section.label) })}
</div>
) : (
renderBrushCollection(resolvedItems, section.id)
@@ -2469,7 +2539,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
) : (
<ChevronDown className="w-2.5 h-2.5 shrink-0 text-ui-icon-muted" />
)}
- <span className="truncate font-medium">{section.label}</span>
+ <span className="truncate font-medium">{td(section.label)}</span>
</span>
<span className="text-[9px] text-ui-muted font-ui-mono tabular-nums shrink-0">
{resolvedItems.length}
@@ -2480,7 +2550,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{!isCollapsed &&
(resolvedItems.length === 0 ? (
<div className="px-2 py-2 text-[10px] text-ui-muted text-center border border-dashed border-ui-default rounded-ui-sm">
- Drag any brush here to add to {section.label}
+ {t('Drag any brush here to add to {label}', { label: td(section.label) })}
</div>
) : (
renderBrushCollection(resolvedItems, section.id)
@@ -2524,7 +2594,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
) : (
<ChevronDown className="w-2.5 h-2.5 shrink-0 text-ui-icon-muted" />
)}
- <span className="truncate font-medium">Imported</span>
+ <span className="truncate font-medium">{t('Imported')}</span>
</span>
<span className="text-[9px] text-ui-muted font-ui-mono tabular-nums shrink-0">
{resolvedImported.length}
@@ -2554,7 +2624,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="pointer-events-none select-none flex items-center gap-1.5 px-2.5 py-1 rounded-ui-md bg-ui-floating border border-ui-accent shadow-ui-floating text-[11px] text-ui-primary"
>
<GripVertical className="w-3 h-3 text-ui-accent shrink-0" />
- <span className="font-medium max-w-[140px] truncate">{activeBrushDrag.name}</span>
+ <span className="font-medium max-w-[140px] truncate">{td(activeBrushDrag.name)}</span>
{getDragGhostHint(activeBrushDrag) && (
<span className="text-[10px] text-ui-accent border-l border-ui-subtle pl-1.5 whitespace-nowrap">
{getDragGhostHint(activeBrushDrag)}
@@ -2600,7 +2670,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-52 max-h-[80vh] overflow-y-auto rounded-ui-md bg-ui-elevated border border-ui-default shadow-ui-popover p-1 text-[11px] text-ui-primary select-none"
>
<div className="px-2 py-0.5 text-[10px] text-ui-muted truncate font-medium">
- {brushContextMenu.name}
+ {td(brushContextMenu.name)}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -2620,7 +2690,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
>
<span className="flex items-center gap-1.5">
<Keyboard className="w-3 h-3 text-ui-accent" />
- <span>Set Shortcut...</span>
+ <span>{t('Set Shortcut...')}</span>
</span>
{shortcuts[getSubToolCommandId(brushContextMenu.presetId)] && (
<span className="text-[9px] font-ui-mono text-ui-muted">
@@ -2639,13 +2709,13 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover text-ui-secondary hover:text-ui-primary cursor-pointer text-left"
>
<X className="w-3 h-3" />
- <span>Clear Shortcut</span>
+ <span>{t('Clear Shortcut')}</span>
</button>
)}
<div className="my-0.5 border-t border-ui-subtle" />
<div className="px-2 py-0.5 text-[9.5px] uppercase tracking-wider text-ui-muted">
- Move to Sub Tool Group
+ {t('Move to Sub Tool Group')}
</div>
{(() => {
@@ -2675,7 +2745,10 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
g.id
);
uiStoreActions.showToast(
- `Moved "${brushContextMenu.name}" to "${g.name}"`
+ t('Moved "{name}" to "{group}"', {
+ name: td(brushContextMenu.name),
+ group: g.name,
+ })
);
setBrushContextMenu(null);
}}
@@ -2696,6 +2769,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
{(isDecorationMode ? DECORATION_BRUSH_SECTIONS : BUILTIN_BRUSH_SECTIONS).map(
(sec) => {
const isMember = currentGroupId === sec.id;
+ const secLabel = td(sec.label);
return (
<button
key={sec.id}
@@ -2709,13 +2783,16 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
builtinGroupMemberIds[sec.id]
);
uiStoreActions.showToast(
- `Moved "${brushContextMenu.name}" to "${sec.label}"`
+ t('Moved "{name}" to "{group}"', {
+ name: td(brushContextMenu.name),
+ group: secLabel,
+ })
);
setBrushContextMenu(null);
}}
className="w-full flex items-center justify-between gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover text-ui-secondary hover:text-ui-primary cursor-pointer text-left"
>
- <span className="truncate">{sec.label}</span>
+ <span className="truncate">{secLabel}</span>
{isMember && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
);
@@ -2732,7 +2809,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover text-ui-accent cursor-pointer text-left"
>
<FolderPlus className="w-3 h-3 shrink-0" />
- <span>New Group with Brush...</span>
+ <span>{t('New Group with Brush...')}</span>
</button>
{currentGroupId !== factoryGroupId && (
@@ -2744,14 +2821,16 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
brushContextMenu.presetId
);
uiStoreActions.showToast(
- `Returned "${brushContextMenu.name}" to default section`
+ t('Returned "{name}" to default section', {
+ name: td(brushContextMenu.name),
+ })
);
setBrushContextMenu(null);
}}
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover text-ui-secondary hover:text-ui-primary cursor-pointer text-left"
>
<Undo2 className="w-3 h-3 shrink-0" />
- <span>Return to Default Section</span>
+ <span>{t('Return to Default Section')}</span>
</button>
)}
</>
@@ -2771,8 +2850,8 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
<Star className="w-3 h-3 text-ui-warning" />
<span>
{quickBrushSet.has(migrateLegacyPresetId(brushContextMenu.presetId))
- ? 'Unpin from Quick Brushes'
- : 'Pin to Quick Brushes'}
+ ? t('Unpin from Quick Brushes')
+ : t('Pin to Quick Brushes')}
</span>
</button>
@@ -2787,7 +2866,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Sliders className="w-3 h-3 text-ui-muted" />
- <span>Edit in Brush Studio</span>
+ <span>{t('Edit in Brush Studio')}</span>
</button>
<button
@@ -2800,7 +2879,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Copy className="w-3 h-3 text-ui-muted" />
- <span>Duplicate</span>
+ <span>{t('Duplicate')}</span>
</button>
<button
@@ -2813,7 +2892,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Download className="w-3 h-3 text-ui-muted" />
- <span>Export (.inkb)</span>
+ <span>{t('Export (.inkb)')}</span>
</button>
{brushContextMenu.customBrush && (
@@ -2829,7 +2908,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<Trash2 className="w-3 h-3" />
- <span>Delete Brush</span>
+ <span>{t('Delete Brush')}</span>
</button>
</>
)}
@@ -2854,7 +2933,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-48 rounded-ui-md bg-ui-elevated border border-ui-default shadow-ui-popover p-1 text-[11px] text-ui-primary select-none"
>
<div className="px-2 py-0.5 text-[10px] text-ui-muted truncate font-medium">
- Group: {groupContextMenu.group.name}
+ {t('Group: {name}', { name: groupContextMenu.group.name })}
</div>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -2870,7 +2949,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<PencilLine className="w-3 h-3 text-ui-muted" />
- <span>Rename Group</span>
+ <span>{t('Rename Group')}</span>
</button>
<button
@@ -2889,7 +2968,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover cursor-pointer text-left"
>
<Plus className="w-3 h-3 text-ui-accent" />
- <span>Manage Brushes...</span>
+ <span>{t('Manage Brushes...')}</span>
</button>
<button
@@ -2900,7 +2979,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
setGroupContextMenu(null);
setShortcutModalTarget({
commandId: getSubToolGroupCommandId(grp.id),
- label: `Group: ${grp.name}`,
+ label: t('Group: {name}', { name: grp.name }),
kind: 'group',
});
}}
@@ -2908,7 +2987,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
>
<span className="flex items-center gap-1.5">
<Keyboard className="w-3 h-3 text-ui-accent" />
- <span>Set Shortcut...</span>
+ <span>{t('Set Shortcut...')}</span>
</span>
{shortcuts[getSubToolGroupCommandId(groupContextMenu.group.id)] && (
<span className="text-[9px] font-ui-mono text-ui-muted">
@@ -2920,7 +2999,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
</button>
<div className="px-2 py-1 space-y-1">
- <div className="text-[9.5px] text-ui-muted">Group Tag Color</div>
+ <div className="text-[9.5px] text-ui-muted">{t('Group Tag Color')}</div>
<div className="flex items-center gap-1.5">
{SUBTOOL_GROUP_COLOR_SWATCHES.map((sw) => (
<button
@@ -2933,7 +3012,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
);
setGroupContextMenu(null);
}}
- title={sw.label}
+ title={td(sw.label)}
className={`w-3.5 h-3.5 rounded-full cursor-pointer ${
groupContextMenu.group.color === sw.hex
? 'ring-1 ring-ui-primary scale-110'
@@ -2957,7 +3036,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-35 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowLeft className="w-3 h-3 text-ui-muted" />
- <span>Move Group Left</span>
+ <span>{t('Move Group Left')}</span>
</button>
<button
@@ -2970,7 +3049,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-control-hover disabled:opacity-35 disabled:cursor-not-allowed cursor-pointer text-left"
>
<ArrowRight className="w-3 h-3 text-ui-muted" />
- <span>Move Group Right</span>
+ <span>{t('Move Group Right')}</span>
</button>
<div className="my-0.5 border-t border-ui-subtle" />
@@ -2986,7 +3065,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-full flex items-center gap-1.5 px-2 py-1 rounded-ui-sm hover:bg-ui-danger/15 text-ui-danger cursor-pointer text-left"
>
<Trash2 className="w-3 h-3" />
- <span>Delete Group</span>
+ <span>{t('Delete Group')}</span>
</button>
</div>,
document.body
diff --git a/src/components/SubToolShortcutModal.tsx b/src/components/SubToolShortcutModal.tsx
index 4a096b2..8e61c89 100644
--- a/src/components/SubToolShortcutModal.tsx
+++ b/src/components/SubToolShortcutModal.tsx
@@ -13,6 +13,7 @@ import {
subscribeNativeOsHotkeys,
} from '../utils/nativeOsHotkeys';
import { ShortcutOverrides } from '../types/settings';
+import { isImeComposing, useI18n } from '../i18n';
export interface SubToolShortcutModalProps {
commandId: string;
@@ -37,7 +38,9 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
onClear,
onClose,
}) => {
+ const { t, tc, td } = useI18n();
const [osModifierPinned, setOsModifierPinned] = useState(false);
+ const displayTargetLabel = td(targetLabel);
const [pendingConflict, setPendingConflict] = useState<{
shortcut: string;
conflicts: CommandDefinition[];
@@ -84,6 +87,7 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
};
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
e.preventDefault();
e.stopPropagation();
processCapture(e);
@@ -106,7 +110,7 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
<div
role="dialog"
aria-modal="true"
- aria-label={`Set Shortcut for ${targetLabel}`}
+ aria-label={t('Set Shortcut for {target}', { target: displayTargetLabel })}
data-testid="subtool-shortcut-modal"
className="fixed inset-0 z-[1100] flex items-center justify-center bg-ui-overlay p-4 select-none"
onClick={onClose}
@@ -120,13 +124,13 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
<div className="flex items-center gap-1.5 min-w-0">
<Keyboard className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span className="font-medium text-ui-primary truncate">
- {targetKind === 'group' ? 'Group Shortcut' : 'Sub Tool Shortcut'}
+ {targetKind === 'group' ? t('Group Shortcut') : t('Sub Tool Shortcut')}
</span>
</div>
<button
type="button"
onClick={onClose}
- aria-label="Close shortcut recorder"
+ aria-label={t('Close shortcut recorder')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -136,21 +140,21 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
<div className="p-4 space-y-3">
<div className="space-y-0.5">
<div className="text-[11px] text-ui-muted">
- {targetKind === 'group' ? 'Sub Tool Group' : 'Sub Tool'}
+ {targetKind === 'group' ? t('Sub Tool Group') : t('Sub Tool')}
</div>
- <div className="text-xs font-medium text-ui-primary truncate">{targetLabel}</div>
+ <div className="text-xs font-medium text-ui-primary truncate">{displayTargetLabel}</div>
</div>
<div className="rounded-ui-md bg-ui-header border border-ui-accent-border px-3 py-3 text-center space-y-1.5">
<div className="text-[11px] font-medium text-ui-accent">
- Press any key combination...
+ {t('Press any key combination...')}
</div>
<div className="text-[10px] text-ui-muted">
- Supports Ctrl, {osKeyName}, Shift, Alt · Esc to cancel
+ {t('Supports Ctrl, {osKey}, Shift, Alt · Esc to cancel', { osKey: osKeyName })}
</div>
{currentShortcut && (
<div className="pt-1 text-[10px] text-ui-secondary">
- Current:{' '}
+ {t('Current:')}{' '}
<span className="font-ui-mono text-ui-primary bg-ui-control border border-ui-subtle px-1.5 py-0.5 rounded-ui-xs">
{formatShortcutLabel(currentShortcut)}
</span>
@@ -169,9 +173,11 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border font-semibold'
: 'bg-ui-input text-ui-secondary border-ui-default hover:text-ui-primary hover:bg-ui-control-hover'
}`}
- title={`Toggle ${osKeyName} key modifier for the next key press`}
+ title={t('Toggle {osKey} key modifier for the next key press', { osKey: osKeyName })}
>
- + {osKeyName} Key {osModifierPinned ? '(Active)' : ''}
+ {osModifierPinned
+ ? t('+ {osKey} Key (Active)', { osKey: osKeyName })
+ : t('+ {osKey} Key', { osKey: osKeyName })}
</button>
{currentShortcut && (
@@ -185,7 +191,7 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
className="flex items-center gap-1 px-2 py-1 rounded-ui-sm bg-ui-control border border-ui-subtle hover:bg-ui-danger/15 hover:border-ui-danger/40 text-ui-secondary hover:text-ui-danger text-[10px] cursor-pointer transition-colors"
>
<Trash2 className="w-3 h-3" />
- <span>Clear</span>
+ <span>{t('Clear')}</span>
</button>
)}
</div>
@@ -195,12 +201,25 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
<div className="flex items-start gap-2 text-ui-primary">
<AlertTriangle className="w-3.5 h-3.5 shrink-0 text-ui-warning mt-0.5" />
<span>
- <strong className="font-ui-mono text-ui-warning">
- {formatShortcutLabel(pendingConflict.shortcut)}
- </strong>{' '}
- is already assigned to{' '}
- <strong>{pendingConflict.conflicts.map((c) => c.label).join(', ')}</strong>.
- Replace it?
+ {t('{shortcut} is already assigned to {targets}. Replace it?')
+ .split(/(\{shortcut\}|\{targets\})/)
+ .map((part, idx) => {
+ if (part === '{shortcut}') {
+ return (
+ <strong key={idx} className="font-ui-mono text-ui-warning">
+ {formatShortcutLabel(pendingConflict.shortcut)}
+ </strong>
+ );
+ }
+ if (part === '{targets}') {
+ return (
+ <strong key={idx}>
+ {pendingConflict.conflicts.map((c) => td(c.label)).join(', ')}
+ </strong>
+ );
+ }
+ return <React.Fragment key={idx}>{part}</React.Fragment>;
+ })}
</span>
</div>
<div className="flex items-center justify-end gap-1.5">
@@ -209,7 +228,7 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
onClick={() => setPendingConflict(null)}
className="px-2 py-1 rounded-ui-xs bg-ui-control border border-ui-default text-ui-primary hover:bg-ui-control-hover cursor-pointer text-[10px] transition-colors"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
@@ -224,7 +243,7 @@ export const SubToolShortcutModal: React.FC<SubToolShortcutModalProps> = ({
}}
className="px-2.5 py-1 rounded-ui-xs bg-ui-warning/20 hover:bg-ui-warning/30 border border-ui-warning/50 text-ui-warning font-medium cursor-pointer text-[10px] transition-colors"
>
- Replace
+ {tc('shortcut', 'Replace')}
</button>
</div>
</div>
diff --git a/src/components/SubViewPanel.tsx b/src/components/SubViewPanel.tsx
index bedefc3..14ad603 100644
--- a/src/components/SubViewPanel.tsx
+++ b/src/components/SubViewPanel.tsx
@@ -74,6 +74,7 @@ import {
subViewPointToImagePixel,
} from '../utils/subViewEngine';
import { clampNavigatorSplitRatio, computePerceptualLuminanceByte } from '../utils/valueCheck';
+import { isImeComposing, t as translate, tc as translateCtx, useI18n } from '../i18n';
export type { PixelCoord };
export { subViewPointToImagePixel, computeSubViewFitZoom };
@@ -154,7 +155,7 @@ function readLocalImageFile(
const img = new Image();
img.onload = () => {
resolve({
- name: file.name || 'Reference',
+ name: file.name || translateCtx('subView', 'Reference'),
src: dataUrl,
width: img.naturalWidth || img.width || 1,
height: img.naturalHeight || img.height || 1,
@@ -235,6 +236,7 @@ type LiveCardPatch = {
export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
({ colorMode = 'color', themePreset = 'modern' }) => {
+ const { t, tc } = useI18n();
const items = useSubViewStore((s) => s.items);
const activeId = useSubViewStore((s) => s.activeId);
const viewMode = useSubViewStore((s) => s.viewMode);
@@ -502,7 +504,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
if (cancelled) return;
sourceCanvasMapRef.current.delete(itemId);
if (activeItemRef.current?.id === itemId) {
- setLoadError('Failed to decode image');
+ setLoadError(translate('Failed to decode image'));
}
setSourceVersion((v) => v + 1);
};
@@ -920,7 +922,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
try {
loaded.push(await readLocalImageFile(file));
} catch {
- setLoadError(`Could not load "${file.name}"`);
+ setLoadError(t('Could not load "{name}"', { name: file.name }));
}
}
if (loaded.length > 0) {
@@ -943,13 +945,13 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
subViewStoreActions.addImages(loaded, { dropBoardPoint });
}
},
- []
+ [t]
);
const handlePasteFromClipboard = useCallback(async () => {
setLoadError(null);
if (typeof navigator === 'undefined' || !navigator.clipboard?.read) {
- setLoadError('Use Ctrl+V while hovering References to paste an image');
+ setLoadError(t('Use Ctrl+V while hovering References to paste an image'));
return;
}
try {
@@ -957,22 +959,24 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
const files: File[] = [];
let idx = 1;
for (const clipItem of clipItems) {
- const imgType = clipItem.types.find((t) => t.startsWith('image/'));
+ const imgType = clipItem.types.find((mt) => mt.startsWith('image/'));
if (imgType) {
const blob = await clipItem.getType(imgType);
const ext = imgType.split('/')[1]?.replace(/[^a-z0-9]/gi, '') || 'png';
- files.push(new File([blob], `Clipboard ${idx++}.${ext}`, { type: imgType }));
+ files.push(
+ new File([blob], `${t('Clipboard {n}', { n: idx++ })}.${ext}`, { type: imgType })
+ );
}
}
if (files.length === 0) {
- setLoadError('No image found in clipboard');
+ setLoadError(t('No image found in clipboard'));
return;
}
await handleFilesSelected(files);
} catch {
- setLoadError('Clipboard image read blocked — press Ctrl+V over References');
+ setLoadError(t('Clipboard image read blocked — press Ctrl+V over References'));
}
- }, [handleFilesSelected]);
+ }, [handleFilesSelected, t]);
// Clipboard Ctrl+V listener scoped to when the References panel is hovered or focused
useEffect(() => {
@@ -1008,9 +1012,9 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
const loaded = await readLocalImageFile(file);
subViewStoreActions.replaceImageSrc(item.id, loaded.src, loaded.width, loaded.height);
} catch {
- setLoadError(`Could not load "${file.name}"`);
+ setLoadError(t('Could not load "{name}"', { name: file.name }));
}
- }, []);
+ }, [t]);
// Viewport control actions (board camera in Board mode, active image in Single mode)
const handleSubZoomBy = useCallback((factor: number) => {
@@ -1115,6 +1119,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
return;
}
const onKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
const tag = (e.target as HTMLElement | null)?.tagName;
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return;
if (e.code === 'Space' || e.key === ' ') setIsSpaceHeld(true);
@@ -1772,7 +1777,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-add-btn"
onClick={() => fileInputRef.current?.click()}
- title="Import Reference Image(s)"
+ title={t('Import Reference Image(s)')}
className={`${btnBase} w-5 shrink-0`}
>
<Plus className="w-3 h-3" />
@@ -1781,7 +1786,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-paste-btn"
onClick={() => void handlePasteFromClipboard()}
- title="Paste Reference from Clipboard (Ctrl+V while hovering)"
+ title={t('Paste Reference from Clipboard (Ctrl+V while hovering)')}
className={`${btnBase} w-5 shrink-0`}
>
<ClipboardPaste className="w-3 h-3" />
@@ -1791,7 +1796,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-prev-btn"
disabled={items.length <= 1}
onClick={() => subViewStoreActions.stepActive(-1)}
- title="Previous Reference"
+ title={t('Previous Reference')}
className={`${btnBase} w-4 shrink-0`}
>
<ChevronLeft className="w-3 h-3" />
@@ -1807,7 +1812,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-next-btn"
disabled={items.length <= 1}
onClick={() => subViewStoreActions.stepActive(1)}
- title="Next Reference"
+ title={t('Next Reference')}
className={`${btnBase} w-4 shrink-0`}
>
<ChevronRight className="w-3 h-3" />
@@ -1817,7 +1822,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{/* PureRef Board vs Single Focus Mode Toggle */}
<div
role="group"
- aria-label="Reference View Mode"
+ aria-label={t('Reference View Mode')}
className="flex items-center rounded-ui-xs bg-ui-input border border-ui-subtle p-[1px] shrink-0"
>
<button
@@ -1825,7 +1830,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-mode-board"
aria-pressed={viewMode === 'board'}
onClick={() => subViewStoreActions.setViewMode('board')}
- title="PureRef Board Mode (multiple simultaneous references in one zoomable & rotatable area)"
+ title={t('PureRef Board Mode (multiple simultaneous references in one zoomable & rotatable area)')}
className={`h-4 px-1 rounded-[2px] text-[9px] flex items-center gap-0.5 transition-colors cursor-pointer ${
viewMode === 'board'
? 'bg-ui-accent-subtle text-ui-accent font-medium'
@@ -1833,14 +1838,14 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
}`}
>
<LayoutGrid className="w-2.5 h-2.5" />
- <span>Board</span>
+ <span>{t('Board')}</span>
</button>
<button
type="button"
data-testid="subview-mode-single"
aria-pressed={viewMode === 'single'}
onClick={() => subViewStoreActions.setViewMode('single')}
- title="Single Focus Mode (cycle one reference at a time)"
+ title={t('Single Focus Mode (cycle one reference at a time)')}
className={`h-4 px-1 rounded-[2px] text-[9px] flex items-center gap-0.5 transition-colors cursor-pointer ${
viewMode === 'single'
? 'bg-ui-accent-subtle text-ui-accent font-medium'
@@ -1859,7 +1864,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
disabled={!activeItem}
onClick={() => subViewStoreActions.toggleShowPalette()}
aria-pressed={showPalette}
- title="Extract Dominant Color Palette"
+ title={t('Extract Dominant Color Palette')}
className={`${btnBase} w-5 ${showPalette && activeItem ? btnActive : ''}`}
>
<Palette className="w-3 h-3" />
@@ -1870,7 +1875,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
disabled={items.length === 0}
onClick={() => subViewStoreActions.toggleShowList()}
aria-pressed={showList}
- title="Reference List"
+ title={t('Reference List')}
className={`${btnBase} w-5 ${showList && items.length > 0 ? btnActive : ''}`}
>
<List className="w-3 h-3" />
@@ -1880,7 +1885,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-delete-btn"
disabled={!activeItem}
onClick={() => activeItem && subViewStoreActions.removeImage(activeItem.id)}
- title="Remove Current Reference"
+ title={t('Remove Current Reference')}
className={`${btnBase} w-5 hover:text-ui-danger`}
>
<Trash2 className="w-3 h-3" />
@@ -1934,14 +1939,14 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
grayscale: !item.grayscale,
});
}}
- title={item.grayscale ? 'Disable Card B/W' : 'Per-Card B/W'}
+ title={item.grayscale ? t('Disable Card B/W') : t('Per-Card B/W')}
className={`px-1 h-4 rounded-ui-xs text-[8.5px] font-ui-mono cursor-pointer ${
item.grayscale
? 'bg-ui-accent-subtle text-ui-accent'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- BW
+ {t('BW')}
</button>
{viewMode === 'board' && (
<button
@@ -1952,7 +1957,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
locked: !item.locked,
});
}}
- title={item.locked ? 'Unlock Card' : 'Lock Card Position'}
+ title={item.locked ? t('Unlock Card') : t('Lock Card Position')}
className={`w-4 h-4 flex items-center justify-center rounded-ui-xs cursor-pointer ${
item.locked
? 'text-ui-warning'
@@ -1975,7 +1980,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{items.length > 1 && (
<div className="flex items-center justify-between pt-0.5 mt-0.5 border-t border-ui-subtle px-0.5">
<span className="text-[9px] text-ui-muted" data-testid="subview-active-name">
- {activeItem?.name || 'No reference'}
+ {activeItem?.name || t('No reference')}
</span>
<button
type="button"
@@ -1983,7 +1988,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={() => subViewStoreActions.clearAll()}
className="text-[9px] text-ui-muted hover:text-ui-danger transition-colors cursor-pointer"
>
- Clear All
+ {t('Clear All')}
</button>
</div>
)}
@@ -1996,7 +2001,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-palette-strip"
className="shrink-0 px-1.5 py-1 border-b border-ui-subtle bg-ui-input flex items-center gap-1"
>
- <span className="text-[9px] text-ui-muted shrink-0">Key</span>
+ <span className="text-[9px] text-ui-muted shrink-0">{t('Key')}</span>
<div className="flex items-center gap-1 flex-1 min-w-0">
{extractedSwatches.length > 0 ? (
extractedSwatches.map((sw) => (
@@ -2008,13 +2013,16 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
setSampledHex(sw.hex);
toolStoreActions.setPrimaryColor(sw.hex, true, colorMode);
}}
- title={`${sw.hex.toUpperCase()} · Value ${sw.luminance}% (Click to pick)`}
+ title={t('{hex} · Value {percent}% (Click to pick)', {
+ hex: sw.hex.toUpperCase(),
+ percent: sw.luminance,
+ })}
style={{ backgroundColor: sw.hex }}
className="flex-1 h-4 min-w-[14px] rounded-ui-xs border border-ui-strong/60 hover:scale-110 transition-transform cursor-pointer"
/>
))
) : (
- <span className="text-[9px] text-ui-muted italic">No swatches</span>
+ <span className="text-[9px] text-ui-muted italic">{t('No swatches')}</span>
)}
</div>
</div>
@@ -2062,7 +2070,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-bw-toggle"
aria-pressed={isBwActive}
onClick={() => subViewStoreActions.toggleGrayscale()}
- title="Toggle Perceptual Black & White Value Study (Shortcut: G)"
+ title={t('Toggle Perceptual Black & White Value Study (Shortcut: G)')}
className={`h-4 px-1.5 rounded-ui-xs text-[9.5px] font-medium flex items-center gap-1 transition-colors cursor-pointer ${
isBwActive
? 'bg-ui-accent text-ui-accent-contrast'
@@ -2070,7 +2078,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
}`}
>
<Contrast className="w-2.5 h-2.5" />
- <span>B/W</span>
+ <span>{t('B/W')}</span>
</button>
{/* Split Color | B/W Curtain Toggle */}
@@ -2079,7 +2087,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-split-bw-toggle"
aria-pressed={studyFilter.splitBw}
onClick={() => subViewStoreActions.toggleSplitBw()}
- title="Split Compare: Color | Perceptual B/W"
+ title={t('Split Compare: Color | Perceptual B/W')}
className={`h-4 px-1 rounded-ui-xs text-[9px] flex items-center justify-center transition-colors cursor-pointer ${
studyFilter.splitBw
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-inset ring-ui-accent-border'
@@ -2095,14 +2103,14 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-value-steps"
aria-pressed={studyFilter.valueSteps > 0}
onClick={() => subViewStoreActions.cycleValueSteps()}
- title="Light & Shape Study Value Grouping (Off → 2-Value Notan → 3-Value → 5-Value)"
+ title={t('Light & Shape Study Value Grouping (Off → 2-Value Notan → 3-Value → 5-Value)')}
className={`h-4 px-1 rounded-ui-xs text-[9px] font-ui-mono tabular-nums flex items-center justify-center transition-colors cursor-pointer ${
studyFilter.valueSteps > 0
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-inset ring-ui-accent-border'
: 'text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {VALUE_STEP_LABELS[studyFilter.valueSteps]}
+ {t(VALUE_STEP_LABELS[studyFilter.valueSteps])}
</button>
{/* Squint Blur Toggle */}
@@ -2111,7 +2119,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-squint-toggle"
aria-pressed={studyFilter.squintBlur}
onClick={() => subViewStoreActions.toggleSquintBlur()}
- title="Squint Blur (Simplify fine details to read big shapes & masses)"
+ title={t('Squint Blur (Simplify fine details to read big shapes & masses)')}
className={`h-4 px-1 rounded-ui-xs text-[9px] flex items-center justify-center transition-colors cursor-pointer ${
studyFilter.squintBlur
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-inset ring-ui-accent-border'
@@ -2127,7 +2135,9 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-grid-toggle"
aria-pressed={studyFilter.gridMode !== 'none'}
onClick={() => subViewStoreActions.cycleGridMode()}
- title={`Proportional Grid Overlay: ${GRID_MODE_LABELS[studyFilter.gridMode]} (Click to cycle)`}
+ title={t('Proportional Grid Overlay: {mode} (Click to cycle)', {
+ mode: t(GRID_MODE_LABELS[studyFilter.gridMode]),
+ })}
className={`h-4 px-1 rounded-ui-xs text-[9px] font-ui-mono flex items-center gap-0.5 transition-colors cursor-pointer ${
studyFilter.gridMode !== 'none'
? 'bg-ui-accent-subtle text-ui-accent ring-1 ring-inset ring-ui-accent-border'
@@ -2146,7 +2156,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-tone-toggle"
aria-pressed={showTonePopover || hasToneAdjust}
onClick={() => setShowTonePopover((p) => !p)}
- title="Light & Shape Study Settings (Notan Threshold, Brightness, Contrast)"
+ title={t('Light & Shape Study Settings (Notan Threshold, Brightness, Contrast)')}
className={`h-4 w-4 rounded-ui-xs flex items-center justify-center transition-colors cursor-pointer ${
showTonePopover || hasToneAdjust
? 'bg-ui-accent-subtle text-ui-accent'
@@ -2164,7 +2174,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="w-44 p-2 rounded-ui-md bg-ui-elevated/95 backdrop-blur-sm border border-ui-default shadow-ui-popover space-y-1.5 text-[10px]"
>
<div className="flex items-center justify-between">
- <span className="text-[9.5px] font-medium text-ui-primary">Light & Shape Study</span>
+ <span className="text-[9.5px] font-medium text-ui-primary">{t('Light & Shape Study')}</span>
<button
type="button"
onClick={() => setShowTonePopover(false)}
@@ -2187,7 +2197,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
: 'bg-ui-input text-ui-secondary hover:text-ui-primary border border-ui-subtle'
}`}
>
- {steps === 0 ? 'Full' : `${steps}V`}
+ {steps === 0 ? tc('subView', 'Full') : t(VALUE_STEP_LABELS[steps])}
</button>
))}
</div>
@@ -2195,7 +2205,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{studyFilter.valueSteps > 0 && (
<label className="block space-y-0.5">
<div className="flex justify-between text-[9px] text-ui-muted">
- <span>Notan Pivot</span>
+ <span>{t('Notan Pivot')}</span>
<span className="font-ui-mono tabular-nums">{studyFilter.notanThreshold}</span>
</div>
<input
@@ -2216,7 +2226,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
<label className="block space-y-0.5">
<div className="flex justify-between text-[9px] text-ui-muted">
- <span>Brightness</span>
+ <span>{t('Brightness')}</span>
<span className="font-ui-mono tabular-nums">
{studyFilter.brightness > 0
? `+${studyFilter.brightness}`
@@ -2240,7 +2250,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
<label className="block space-y-0.5">
<div className="flex justify-between text-[9px] text-ui-muted">
- <span>Contrast</span>
+ <span>{t('Contrast')}</span>
<span className="font-ui-mono tabular-nums">
{studyFilter.contrast > 0
? `+${studyFilter.contrast}`
@@ -2267,14 +2277,14 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-sample-tone-toggle"
onClick={() => subViewStoreActions.toggleSampleDisplayTone()}
- title="When enabled, eyedropper picks the filtered B/W or Notan tone instead of the original color"
+ title={t('When enabled, eyedropper picks the filtered B/W or Notan tone instead of the original color')}
className={`text-[9px] px-1.5 py-0.5 rounded-ui-xs cursor-pointer transition-colors ${
sampleDisplayTone
? 'bg-ui-accent-subtle text-ui-accent'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {sampleDisplayTone ? 'Pick: Study Tone' : 'Pick: Original'}
+ {sampleDisplayTone ? t('Pick: Study Tone') : t('Pick: Original')}
</button>
<button
type="button"
@@ -2282,7 +2292,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={() => subViewStoreActions.resetStudyFilter()}
className="text-[9px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Reset
+ {t('Reset')}
</button>
</div>
</div>
@@ -2294,16 +2304,16 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{items.length > 0 && studyFilter.splitBw && (
<>
<span className="pointer-events-none absolute bottom-1.5 left-1.5 z-10 px-1 py-[1px] rounded-ui-xs bg-ui-floating border border-ui-default text-[8px] font-ui-mono uppercase text-ui-primary">
- CLR
+ {t('CLR')}
</span>
<span className="pointer-events-none absolute bottom-1.5 right-1.5 z-10 px-1 py-[1px] rounded-ui-xs bg-ui-floating border border-ui-default text-[8px] font-ui-mono uppercase text-ui-primary">
- B/W
+ {t('B/W')}
</span>
<div
role="slider"
tabIndex={0}
data-testid="subview-split-handle"
- aria-label="Reference Color and B/W Split Position"
+ aria-label={t('Reference Color and B/W Split Position')}
aria-valuemin={5}
aria-valuemax={95}
aria-valuenow={Math.round(studyFilter.splitRatio * 100)}
@@ -2316,7 +2326,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
subViewStoreActions.updateStudyFilter({ splitRatio: 0.5 }, true);
}}
style={{ left: `${splitLineLeft}px` }}
- title="Drag to compare Color | B/W (Double-click to center)"
+ title={t('Drag to compare Color | B/W (Double-click to center)')}
className="absolute top-0 bottom-0 z-20 w-3 -ml-1.5 flex items-center justify-center cursor-ew-resize group"
>
<div className="w-[1.5px] h-full bg-white/85 shadow-[0_0_2px_rgba(0,0,0,0.85)] group-hover:bg-ui-accent transition-colors" />
@@ -2345,14 +2355,14 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
grayscale: !activeItem.grayscale,
})
}
- title="Toggle Per-Card B/W (independent of other references)"
+ title={t('Toggle Per-Card B/W (independent of other references)')}
className={`h-4 px-1 rounded-ui-xs text-[8.5px] font-ui-mono cursor-pointer transition-colors ${
activeItem.grayscale
? 'bg-ui-accent text-ui-accent-contrast font-medium'
: 'text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- BW
+ {t('BW')}
</button>
<button
type="button"
@@ -2363,7 +2373,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
boardFlipX: !activeItem.boardFlipX,
})
}
- title="Flip Selected Reference Horizontally"
+ title={t('Flip Selected Reference Horizontally')}
className={`h-4 w-4 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeItem.boardFlipX
? 'bg-ui-accent-subtle text-ui-accent'
@@ -2381,7 +2391,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
boardFlipY: !activeItem.boardFlipY,
})
}
- title="Flip Selected Reference Vertically"
+ title={t('Flip Selected Reference Vertically')}
className={`h-4 w-4 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeItem.boardFlipY
? 'bg-ui-accent-subtle text-ui-accent'
@@ -2398,7 +2408,9 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
activeItem.opacity > 0.85 ? 0.65 : activeItem.opacity > 0.45 ? 0.35 : 1;
subViewStoreActions.updateCardBoardProps(activeItem.id, { opacity: nextOp });
}}
- title={`Card Opacity: ${Math.round(activeItem.opacity * 100)}% (Click to cycle)`}
+ title={t('Card Opacity: {percent}% (Click to cycle)', {
+ percent: Math.round(activeItem.opacity * 100),
+ })}
className="h-4 px-1 rounded-ui-xs text-[8.5px] font-ui-mono tabular-nums text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
{`${Math.round(activeItem.opacity * 100)}%`}
@@ -2407,7 +2419,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-card-front"
onClick={() => subViewStoreActions.bringCardToFront(activeItem.id)}
- title="Bring Card to Front"
+ title={t('Bring Card to Front')}
className="h-4 w-4 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<BringToFront className="w-2.5 h-2.5" />
@@ -2416,7 +2428,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-card-back"
onClick={() => subViewStoreActions.sendCardToBack(activeItem.id)}
- title="Send Card to Back"
+ title={t('Send Card to Back')}
className="h-4 w-4 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<SendToBack className="w-2.5 h-2.5" />
@@ -2425,7 +2437,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-card-duplicate"
onClick={() => subViewStoreActions.duplicateCard(activeItem.id)}
- title="Duplicate Reference Card"
+ title={t('Duplicate Reference Card')}
className="h-4 w-4 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<Copy className="w-2.5 h-2.5" />
@@ -2439,7 +2451,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
locked: !activeItem.locked,
})
}
- title={activeItem.locked ? 'Unlock Card' : 'Lock Card'}
+ title={activeItem.locked ? t('Unlock Card') : t('Lock Card')}
className={`h-4 w-4 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
activeItem.locked
? 'text-ui-warning bg-ui-warning/15'
@@ -2456,7 +2468,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
type="button"
data-testid="subview-card-focus"
onClick={() => handleFitSelectedCard(activeItem.id)}
- title="Focus / Fit Selected Card"
+ title={t('Focus / Fit Selected Card')}
className="h-4 w-4 rounded-ui-xs flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<Focus className="w-2.5 h-2.5" />
@@ -2474,10 +2486,10 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="flex flex-col items-center gap-1 px-3 py-2 rounded-ui-sm border border-dashed border-ui-default hover:border-ui-accent text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
>
<ImagePlus className="w-4 h-4 opacity-75" />
- <span className="text-[10px]">Drop images, click +, or Ctrl+V</span>
+ <span className="text-[10px]">{t('Drop images, click +, or Ctrl+V')}</span>
</button>
<span className="text-[9px] text-ui-muted/80">
- PureRef Board · Multi-ref · B/W & Notan Study
+ {t('PureRef Board · Multi-ref · B/W & Notan Study')}
</span>
</div>
)}
@@ -2486,7 +2498,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{viewMode === 'single' && activeItem && !activeItem.src && (
<div className="z-10 flex flex-col items-center gap-1 px-2 text-center">
<span className="text-[10px] text-ui-secondary">
- {activeItem.name} (reload file)
+ {t('{name} (reload file)', { name: activeItem.name })}
</span>
<button
type="button"
@@ -2494,7 +2506,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="h-5 px-2 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer transition-colors"
>
<RefreshCw className="w-3 h-3" />
- <span>Re-open</span>
+ <span>{t('Re-open')}</span>
</button>
</div>
)}
@@ -2544,7 +2556,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-zoom-out"
disabled={items.length === 0}
onClick={() => handleSubZoomBy(1 / 1.25)}
- title="References Zoom Out"
+ title={t('References Zoom Out')}
className={`${btnBase} w-5`}
>
<ZoomOut className="w-3 h-3" />
@@ -2554,7 +2566,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-zoom-in"
disabled={items.length === 0}
onClick={() => handleSubZoomBy(1.25)}
- title="References Zoom In"
+ title={t('References Zoom In')}
className={`${btnBase} w-5`}
>
<ZoomIn className="w-3 h-3" />
@@ -2566,8 +2578,8 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={handleSubFit}
title={
viewMode === 'board'
- ? 'Fit All References & Reset Board View (Shortcut: F)'
- : 'Reset Reference View (Fit, 0°, Unflip)'
+ ? t('Fit All References & Reset Board View (Shortcut: F)')
+ : t('Reset Reference View (Fit, 0°, Unflip)')
}
className={`${btnBase} w-5`}
>
@@ -2581,7 +2593,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-arrange-btn"
disabled={items.length === 0}
onClick={() => setShowArrangeMenu((p) => !p)}
- title="Auto-Arrange PureRef Board (Pack Grid, Row, Column)"
+ title={t('Auto-Arrange PureRef Board (Pack Grid, Row, Column)')}
className={`${btnBase} w-5 ${showArrangeMenu ? btnActive : ''}`}
>
<LayoutGrid className="w-3 h-3" />
@@ -2598,7 +2610,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="flex items-center gap-1.5 px-1.5 py-1 rounded-ui-xs text-left hover:bg-ui-control-hover cursor-pointer"
>
<LayoutGrid className="w-3 h-3 text-ui-icon-muted" />
- <span>Pack Grid</span>
+ <span>{t('Pack Grid')}</span>
</button>
<button
type="button"
@@ -2607,7 +2619,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="flex items-center gap-1.5 px-1.5 py-1 rounded-ui-xs text-left hover:bg-ui-control-hover cursor-pointer"
>
<Columns3 className="w-3 h-3 text-ui-icon-muted" />
- <span>Horizontal Strip</span>
+ <span>{t('Horizontal Strip')}</span>
</button>
<button
type="button"
@@ -2616,7 +2628,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className="flex items-center gap-1.5 px-1.5 py-1 rounded-ui-xs text-left hover:bg-ui-control-hover cursor-pointer"
>
<Rows3 className="w-3 h-3 text-ui-icon-muted" />
- <span>Vertical Stack</span>
+ <span>{t('Vertical Stack')}</span>
</button>
</div>
)}
@@ -2631,7 +2643,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-rotate-left"
disabled={items.length === 0}
onClick={() => handleSubRotateBy(-15)}
- title="Rotate Left (-15°, or Shift+Wheel)"
+ title={t('Rotate Left (-15°, or Shift+Wheel)')}
className={`${btnBase} w-5`}
>
<RotateCcw className="w-3 h-3" />
@@ -2641,7 +2653,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-reset-rotation"
disabled={items.length === 0}
onClick={handleSubResetRotation}
- title="Reset Rotation (0°)"
+ title={t('Reset Rotation (0°)')}
className={`${btnBase} px-1 font-ui-mono tabular-nums`}
>
{`${Math.round(activeTransform?.rotation ?? 0)}°`}
@@ -2651,7 +2663,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-rotate-right"
disabled={items.length === 0}
onClick={() => handleSubRotateBy(15)}
- title="Rotate Right (+15°, or Shift+Wheel)"
+ title={t('Rotate Right (+15°, or Shift+Wheel)')}
className={`${btnBase} w-5`}
>
<RotateCw className="w-3 h-3" />
@@ -2662,7 +2674,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
disabled={items.length === 0}
aria-pressed={Boolean(activeTransform?.flipX)}
onClick={handleSubToggleFlipX}
- title="Flip View Horizontally (Shortcut: H)"
+ title={t('Flip View Horizontally (Shortcut: H)')}
className={`${btnBase} w-5 ${activeTransform?.flipX ? btnActive : ''}`}
>
<FlipHorizontal className="w-3 h-3" />
@@ -2678,7 +2690,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-tool-select"
aria-pressed={boardTool === 'select'}
onClick={() => subViewStoreActions.setBoardTool('select')}
- title="Arrange Cards (Drag cards to move, drag corners to resize, top handle to rotate; drag empty space to pan)"
+ title={t('Arrange Cards (Drag cards to move, drag corners to resize, top handle to rotate; drag empty space to pan)')}
className={`${btnBase} w-5 ${boardTool === 'select' ? btnActive : ''}`}
>
<MousePointer2 className="w-3 h-3" />
@@ -2688,7 +2700,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-tool-pan"
aria-pressed={boardTool === 'pan'}
onClick={() => subViewStoreActions.setBoardTool('pan')}
- title="Pan Board (or hold Space / Middle-click anywhere)"
+ title={t('Pan Board (or hold Space / Middle-click anywhere)')}
className={`${btnBase} w-5 ${boardTool === 'pan' ? btnActive : ''}`}
>
<Hand className="w-3 h-3" />
@@ -2700,11 +2712,11 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={() =>
subViewStoreActions.setBoardTool(boardTool === 'eyedrop' ? 'select' : 'eyedrop')
}
- title="Eyedropper Mode (Click any reference to pick color; Alt+Click works from any tool)"
+ title={t('Eyedropper Mode (Click any reference to pick color; Alt+Click works from any tool)')}
className={`${btnBase} gap-0.5 px-1 ${boardTool === 'eyedrop' ? btnActive : ''}`}
>
<Pipette className="w-3 h-3" />
- <span>Pick</span>
+ <span>{t('Pick')}</span>
</button>
</>
) : (
@@ -2714,11 +2726,11 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
data-testid="subview-auto-eyedropper"
aria-pressed={autoEyedropper}
onClick={() => subViewStoreActions.toggleAutoEyedropper()}
- title="Switch to Eyedropper Automatically on Hover/Click (CSP mode)"
+ title={t('Switch to Eyedropper Automatically on Hover/Click (CSP mode)')}
className={`${btnBase} gap-0.5 px-1 ${autoEyedropper ? btnActive : ''}`}
>
<Pipette className="w-3 h-3" />
- <span>Auto</span>
+ <span>{t('Auto')}</span>
</button>
{!autoEyedropper && (
<button
@@ -2728,8 +2740,8 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={() => subViewStoreActions.setManualEyedropper(!manualEyedropper)}
title={
manualEyedropper
- ? 'Eyedropper Active (click for Pan)'
- : 'Pan Active (click for Eyedropper)'
+ ? t('Eyedropper Active (click for Pan)')
+ : t('Pan Active (click for Eyedropper)')
}
className={`${btnBase} w-5 ${manualEyedropper ? btnActive : ''}`}
>
diff --git a/src/components/TextEditorOverlay.tsx b/src/components/TextEditorOverlay.tsx
index 109893c..957c01c 100644
--- a/src/components/TextEditorOverlay.tsx
+++ b/src/components/TextEditorOverlay.tsx
@@ -26,6 +26,7 @@ import {
TEXT_FONT_PRESETS,
TEXT_QUICK_COLORS,
} from '../utils/textSettings';
+import { isImeComposing, useI18n } from '../i18n';
interface TextEditorOverlayProps {
x: number;
@@ -62,6 +63,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onCancel,
onDelete,
}) => {
+ const { t, tc, td } = useI18n();
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
const previewCanvasRef = useRef<HTMLCanvasElement | null>(null);
@@ -318,6 +320,11 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
// Stop propagation so global canvas shortcuts never fire while typing
e.stopPropagation();
+ // Never intercept keys during Japanese/CJK IME conversion (Enter/Escape confirm or cancel candidates)
+ if (isImeComposing(e)) {
+ return;
+ }
+
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
onConfirm();
@@ -475,7 +482,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
whiteSpace: 'nowrap',
}}
>
- Type text...
+ {t('Type text...')}
</div>
)}
@@ -484,7 +491,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<textarea
ref={textareaRef}
data-testid="text-editor-textarea"
- aria-label="Canvas text input"
+ aria-label={t('Canvas text input')}
value={settings.text}
onChange={(e) => onUpdateSettings((prev) => ({ ...prev, text: e.target.value }))}
onKeyDown={handleEditorKeyDown}
@@ -522,7 +529,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onPointerMove={handleDragMove}
onPointerUp={handleDragUp}
className="absolute inset-0 cursor-move"
- title="Drag to reposition vertical text"
+ title={t('Drag to reposition vertical text')}
/>
)}
@@ -532,7 +539,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onPointerDown={(e) => startDrag('move', e)}
onPointerMove={handleDragMove}
onPointerUp={handleDragUp}
- title="Drag to move text (or Alt+Drag / Alt+Arrow keys)"
+ title={t('Drag to move text (or Alt+Drag / Alt+Arrow keys)')}
className="absolute flex items-center justify-center rounded-full bg-sky-500 text-white shadow cursor-move hover:bg-sky-400 transition-colors"
style={{
left: `${-handleSize * 1.1}px`,
@@ -557,8 +564,10 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
}}
title={
settings.maxWidth
- ? `Wrap width: ${settings.maxWidth}px (drag to resize, double-click for auto width)`
- : 'Drag to set word-wrap box width'
+ ? t('Wrap width: {width}px (drag to resize, double-click for auto width)', {
+ width: settings.maxWidth,
+ })
+ : t('Drag to set word-wrap box width')
}
className="absolute top-1/2 -translate-y-1/2 rounded-full bg-white border border-sky-500 shadow cursor-ew-resize hover:bg-sky-100"
style={{
@@ -575,7 +584,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onPointerDown={(e) => startDrag('scale-font', e)}
onPointerMove={handleDragMove}
onPointerUp={handleDragUp}
- title="Drag diagonally to scale font size"
+ title={t('Drag diagonally to scale font size')}
className="absolute rounded-[2px] bg-white border border-sky-500 shadow cursor-nwse-resize hover:bg-sky-100"
style={{
right: `${-handleSize * 0.75}px`,
@@ -602,7 +611,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onPointerDown={(e) => startDrag('move', e)}
onPointerMove={handleDragMove}
onPointerUp={handleDragUp}
- title="Drag to move text"
+ title={t('Drag to move text')}
className="p-0.5 text-ui-muted hover:text-ui-primary cursor-move shrink-0"
>
<GripVertical className="w-3.5 h-3.5" />
@@ -610,7 +619,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
{/* Font Family */}
<select
- aria-label="Font Family"
+ aria-label={t('Font Family')}
value={settings.fontFamily}
onFocus={handleLoadSystemFonts}
onChange={(e) => onUpdateSettings((prev) => ({ ...prev, fontFamily: e.target.value }))}
@@ -624,7 +633,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
className="bg-ui-elevated text-ui-primary"
style={{ fontFamily: f.value }}
>
- {f.label}
+ {td(f.label)}
</option>
))}
</select>
@@ -634,7 +643,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
type="button"
onClick={() => stepFontSize(-2)}
- title="Decrease font size (Ctrl+[)"
+ title={t('Decrease font size (Ctrl+[)')}
className="w-5 h-full flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<Minus className="w-2.5 h-2.5" />
@@ -642,12 +651,13 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<input
type="text"
inputMode="numeric"
- aria-label="Font Size"
+ aria-label={t('Font Size')}
value={fontSizeInput}
onChange={(e) => setFontSizeInput(e.target.value.replace(/[^0-9]/g, ''))}
onBlur={commitFontSizeInput}
onKeyDown={(e) => {
e.stopPropagation();
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
commitFontSizeInput();
textareaRef.current?.focus();
@@ -664,7 +674,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
type="button"
onClick={() => stepFontSize(2)}
- title="Increase font size (Ctrl+])"
+ title={t('Increase font size (Ctrl+])')}
className="w-5 h-full flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<Plus className="w-2.5 h-2.5" />
@@ -677,7 +687,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
data-testid="text-color-trigger"
onClick={() => setShowColorPopover((v) => !v)}
- title={`Text Color (${settings.color || '#ffffff'})`}
+ title={t('Text Color ({color})', { color: settings.color || '#ffffff' })}
className="w-6 h-6 rounded-ui-xs border border-ui-default hover:border-ui-strong flex items-center justify-center bg-ui-input cursor-pointer"
>
<span
@@ -689,7 +699,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
{showColorPopover && (
<div className="absolute left-0 top-7 z-50 p-2 bg-ui-floating border border-ui-default rounded-ui-md shadow-ui-popover flex flex-col gap-2 w-44">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Text Color</span>
+ <span>{t('Text Color')}</span>
<span className="font-ui-mono uppercase">{settings.color || '#ffffff'}</span>
</div>
<div className="flex items-center gap-1.5 flex-wrap">
@@ -697,7 +707,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
key={swatch.hex}
type="button"
- title={swatch.label}
+ title={td(swatch.label)}
onClick={() => {
onUpdateSettings((prev) => ({ ...prev, color: swatch.hex }));
setShowColorPopover(false);
@@ -721,7 +731,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
}
className="w-5 h-5 bg-transparent cursor-pointer border border-ui-default rounded-ui-xs"
/>
- <span>Custom</span>
+ <span>{t('Custom')}</span>
</label>
{primaryColor && (
<button
@@ -730,11 +740,11 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onUpdateSettings((prev) => ({ ...prev, color: primaryColor }));
setShowColorPopover(false);
}}
- title={`Use current brush color (${primaryColor})`}
+ title={t('Use current brush color ({color})', { color: primaryColor })}
className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary cursor-pointer"
>
<Pipette className="w-2.5 h-2.5" />
- <span>Brush</span>
+ <span>{t('Brush')}</span>
</button>
)}
</div>
@@ -750,7 +760,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
aria-pressed={settings.bold}
onClick={() => onUpdateSettings((prev) => ({ ...prev, bold: !prev.bold }))}
- title="Bold (Ctrl+B)"
+ title={t('Bold (Ctrl+B)')}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center border transition-colors cursor-pointer ${
settings.bold
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -763,7 +773,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
aria-pressed={settings.italic}
onClick={() => onUpdateSettings((prev) => ({ ...prev, italic: !prev.italic }))}
- title="Italic (Ctrl+I)"
+ title={t('Italic (Ctrl+I)')}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center border transition-colors cursor-pointer ${
settings.italic
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -778,7 +788,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onClick={() =>
onUpdateSettings((prev) => ({ ...prev, underline: !prev.underline }))
}
- title="Underline (Ctrl+U)"
+ title={t('Underline (Ctrl+U)')}
className={`w-6 h-6 rounded-ui-xs flex items-center justify-center border transition-colors cursor-pointer ${
settings.underline
? 'bg-ui-accent-subtle text-ui-accent border-ui-accent-border'
@@ -801,7 +811,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
key={a.id}
type="button"
- title={a.label}
+ title={t(a.label)}
onClick={() => onUpdateSettings((prev) => ({ ...prev, align: a.id }))}
className={`w-5 h-5 rounded-[2px] flex items-center justify-center cursor-pointer transition-colors ${
settings.align === a.id
@@ -819,26 +829,26 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
type="button"
onClick={() => onUpdateSettings((prev) => ({ ...prev, writingMode: 'horizontal-tb' }))}
- title="Horizontal Text"
+ title={t('Horizontal Text')}
className={`px-1.5 h-5 rounded-[2px] text-[10px] font-medium cursor-pointer transition-colors ${
!isVertical
? 'bg-ui-control-active text-ui-primary'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- H
+ {tc('writingMode', 'H')}
</button>
<button
type="button"
onClick={() => onUpdateSettings((prev) => ({ ...prev, writingMode: 'vertical-rl' }))}
- title="Vertical Text (Tate-gaki)"
+ title={t('Vertical Text (Tate-gaki)')}
className={`px-1.5 h-5 rounded-[2px] text-[10px] font-medium cursor-pointer transition-colors ${
isVertical
? 'bg-ui-accent-subtle text-ui-accent'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- V
+ {tc('writingMode', 'V')}
</button>
</div>
@@ -848,7 +858,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
data-testid="text-more-style-btn"
aria-expanded={showMoreStyle}
onClick={() => setShowMoreStyle((v) => !v)}
- title="Spacing, opacity, and outline options"
+ title={t('Spacing, opacity, and outline options')}
className={`h-6 px-1.5 rounded-ui-xs border text-[10.5px] inline-flex items-center gap-1 cursor-pointer transition-colors shrink-0 ${
showMoreStyle || settings.outline
? 'bg-ui-control-active border-ui-accent-border text-ui-primary'
@@ -856,7 +866,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
}`}
>
<SlidersHorizontal className="w-3 h-3" />
- <span>Style</span>
+ <span>{t('Style')}</span>
</button>
<span className="h-4 w-px bg-ui-subtle shrink-0" />
@@ -867,7 +877,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
data-testid="text-delete-btn"
onClick={onDelete}
- title="Delete text layer"
+ title={t('Delete text layer')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-danger hover:bg-ui-danger/15 transition-colors cursor-pointer shrink-0"
>
<Trash2 className="w-3.5 h-3.5" />
@@ -877,7 +887,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
data-testid="text-cancel-btn"
onClick={onCancel}
- title="Cancel (Esc)"
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-xs flex items-center justify-center bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer shrink-0"
>
<X className="w-3.5 h-3.5" />
@@ -886,11 +896,11 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
type="button"
data-testid="text-confirm-btn"
onClick={onConfirm}
- title="Apply text (Ctrl+Enter or click outside)"
+ title={t('Apply text (Ctrl+Enter or click outside)')}
className="h-6 px-2 rounded-ui-xs inline-flex items-center gap-1 bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[11px] font-medium transition-opacity cursor-pointer shrink-0"
>
<Check className="w-3.5 h-3.5" />
- <span>Done</span>
+ <span>{t('Done')}</span>
</button>
</div>
@@ -900,11 +910,11 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<textarea
ref={textareaRef}
data-testid="text-editor-textarea"
- aria-label="Vertical text input"
+ aria-label={t('Vertical text input')}
value={settings.text}
onChange={(e) => onUpdateSettings((prev) => ({ ...prev, text: e.target.value }))}
onKeyDown={handleEditorKeyDown}
- placeholder="Type vertical text (Enter starts next column)..."
+ placeholder={t('Type vertical text (Enter starts next column)...')}
rows={2}
className="w-full bg-ui-input text-ui-primary placeholder:text-ui-muted text-xs border border-ui-subtle rounded-ui-sm p-1.5 focus:border-ui-focus focus:outline-none resize-none"
/>
@@ -916,8 +926,8 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<div className="px-3 py-2.5 border-t border-ui-subtle bg-ui-header/70 space-y-2 text-[11px]">
<div className="grid grid-cols-2 gap-x-4 gap-y-2">
<label className="flex items-center gap-2">
- <span className="text-ui-muted w-16 shrink-0 tabular-nums">
- Line {(settings.lineSpacing ?? 1.25).toFixed(2)}
+ <span className="text-ui-muted min-w-16 shrink-0 whitespace-nowrap tabular-nums">
+ {t('Line {value}', { value: (settings.lineSpacing ?? 1.25).toFixed(2) })}
</span>
<input
type="range"
@@ -933,8 +943,8 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
</label>
<label className="flex items-center gap-2">
- <span className="text-ui-muted w-16 shrink-0 tabular-nums">
- Track {(settings.letterSpacing ?? 0).toFixed(0)}px
+ <span className="text-ui-muted min-w-16 shrink-0 whitespace-nowrap tabular-nums">
+ {t('Track {value}px', { value: (settings.letterSpacing ?? 0).toFixed(0) })}
</span>
<input
type="range"
@@ -953,8 +963,8 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
</label>
<label className="flex items-center gap-2">
- <span className="text-ui-muted w-16 shrink-0 tabular-nums">
- Opacity {Math.round((settings.opacity ?? 1) * 100)}%
+ <span className="text-ui-muted min-w-16 shrink-0 whitespace-nowrap tabular-nums">
+ {t('Opacity {value}%', { value: Math.round((settings.opacity ?? 1) * 100) })}
</span>
<input
type="range"
@@ -979,16 +989,16 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
}
className="cursor-pointer"
/>
- <span>Outline</span>
+ <span>{t('Outline')}</span>
</label>
<button
type="button"
onClick={handleResetToStandard}
- title="Reset to plain white text without outline"
+ title={t('Reset to plain white text without outline')}
className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer"
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Plain White</span>
+ <span>{t('Plain White')}</span>
</button>
</div>
</div>
@@ -997,7 +1007,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<div className="flex items-center gap-3 pt-1.5 border-t border-ui-subtle">
<label className="flex items-center gap-2 flex-1">
<span className="text-ui-muted tabular-nums shrink-0">
- Width {settings.outlineWidth}px
+ {tc('outline', 'Width {value}px', { value: settings.outlineWidth })}
</span>
<input
type="range"
@@ -1015,7 +1025,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
</label>
<div className="flex items-center gap-1 shrink-0">
- <span className="text-ui-muted">Color:</span>
+ <span className="text-ui-muted">{t('Color:')}</span>
<button
type="button"
onClick={() =>
@@ -1027,7 +1037,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
: 'border-ui-default'
}`}
style={{ backgroundColor: '#000000' }}
- title="Black outline"
+ title={t('Black outline')}
/>
<button
type="button"
@@ -1040,11 +1050,11 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
: 'border-ui-default'
}`}
style={{ backgroundColor: '#ffffff' }}
- title="White outline"
+ title={t('White outline')}
/>
<input
type="color"
- aria-label="Outline Color"
+ aria-label={t('Outline Color')}
value={settings.outlineColor || '#000000'}
onChange={(e) =>
onUpdateSettings((prev) => ({ ...prev, outlineColor: e.target.value }))
@@ -1056,8 +1066,8 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
)}
<div className="flex items-center justify-between text-[10px] text-ui-muted pt-1 border-t border-ui-subtle">
- <span>Click outside or Ctrl+Enter to apply</span>
- <span>Alt+Arrows to nudge • Drag edge to wrap</span>
+ <span>{t('Click outside or Ctrl+Enter to apply')}</span>
+ <span>{t('Alt+Arrows to nudge • Drag edge to wrap')}</span>
</div>
</div>
)}
diff --git a/src/components/TimelapseExportModal.tsx b/src/components/TimelapseExportModal.tsx
index 8b05ad9..f0d1665 100644
--- a/src/components/TimelapseExportModal.tsx
+++ b/src/components/TimelapseExportModal.tsx
@@ -52,6 +52,7 @@ import {
} from './timelapse/useTimelapsePreviewPlayer';
import { TimelapseFullscreenViewer } from './timelapse/TimelapseFullscreenViewer';
import { TimelapseWatermarkControls } from './timelapse/TimelapseWatermarkControls';
+import { isImeComposing, useI18n } from '../i18n';
interface TimelapseExportModalProps {
isOpen: boolean;
@@ -128,20 +129,6 @@ const ASPECT_RATIO_OPTIONS: Array<{ value: TimelapseAspectRatio; label: string }
const SPEED_CYCLE: TimelapsePlaybackSpeed[] = [0.5, 1, 2];
-function formatRelativeDate(ts: number): string {
- if (!ts) return 'Unknown date';
- try {
- return new Date(ts).toLocaleString(undefined, {
- month: 'short',
- day: 'numeric',
- hour: '2-digit',
- minute: '2-digit',
- });
- } catch {
- return 'Saved locally';
- }
-}
-
export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
isOpen,
onClose,
@@ -150,8 +137,23 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
onCaptureNow,
showToast,
}) => {
+ const { t, tc, td, formatDateTime } = useI18n();
const userName = useUiStore((s) => s.appSettings.userName);
+ const formatRecordedDate = useCallback(
+ (ts: number): string => {
+ if (!ts) return t('Unknown date');
+ const formatted = formatDateTime(ts, {
+ month: 'short',
+ day: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
+ });
+ return formatted || t('Saved locally');
+ },
+ [formatDateTime, t]
+ );
+
// Export & Preview Settings
const [duration, setDuration] = useState<TimelapseDurationPreset>('30s');
const [customDurationSec, setCustomDurationSec] = useState<number>(45);
@@ -265,6 +267,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
const target = e.target as HTMLElement | null;
const isTextInput =
target &&
@@ -328,9 +331,9 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
documentStoreActions.markDocumentDirty(documentId, true);
if (next) {
onCaptureNow?.();
- showToast?.('Time-lapse recording enabled (saved locally)');
+ showToast?.(t('Time-lapse recording enabled (saved locally)'));
} else {
- showToast?.('Time-lapse recording paused');
+ showToast?.(t('Time-lapse recording paused'));
}
};
@@ -340,7 +343,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
documentStoreActions.markDocumentDirty(documentId, true);
setOpenDropdown(null);
const label = CAPTURE_AREA_OPTIONS.find((o) => o.value === area)?.label ?? area;
- showToast?.(`Capture area set to ${label}`);
+ showToast?.(t('Capture area set to {label}', { label: t(label) }));
};
const handleSelectCaptureResolution = (res: TimelapseCaptureResolution) => {
@@ -356,7 +359,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
setIsFullscreen(false);
await globalTimelapseManager.clearSession(documentId);
documentStoreActions.markDocumentDirty(documentId, true);
- showToast?.('Time-lapse recording cleared');
+ showToast?.(t('Time-lapse recording cleared'));
if (activeTab === 'library') {
void refreshStoredRecordings();
}
@@ -371,13 +374,18 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
cleanDocName
);
documentStoreActions.markDocumentDirty(documentId, true);
- showToast?.(`Attached "${rec.documentName}" (${res.frameCount} frames)`);
+ showToast?.(
+ t('Attached "{name}" ({count} frames)', {
+ name: rec.documentName,
+ count: res.frameCount,
+ })
+ );
setActiveTab('export');
};
const handleDeleteStoredRecording = async (rec: StoredRecordingSummary) => {
await globalTimelapseManager.deleteStoredRecording(rec.recordingId);
- showToast?.(`Deleted local recording "${rec.documentName}"`);
+ showToast?.(t('Deleted local recording "{name}"', { name: rec.documentName }));
void refreshStoredRecordings();
};
@@ -418,19 +426,23 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
data: result.blob,
suggestedName,
mimeType: result.mimeType,
- description: result.extension === '.mp4' ? 'MP4 Video' : 'WebM Video',
+ description: result.extension === '.mp4' ? t('MP4 Video') : t('WebM Video'),
extensions: [result.extension],
category: 'timelapse',
- title: 'Save Time-lapse Video As',
+ title: t('Save Time-lapse Video As'),
});
if (saveRes.canceled) {
return;
}
showToast?.(
- `Exported ${result.durationSec.toFixed(1)}s time-lapse (${fps} FPS, ${result.extension})`
+ t('Exported {duration}s time-lapse ({fps} FPS, {ext})', {
+ duration: result.durationSec.toFixed(1),
+ fps,
+ ext: result.extension,
+ })
);
} catch (err) {
- setErrorMsg(err instanceof Error ? err.message : 'Time-lapse export failed');
+ setErrorMsg(err instanceof Error ? err.message : t('Time-lapse export failed'));
} finally {
setIsExporting(false);
}
@@ -438,10 +450,10 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
const storageLabel =
stats.storageBackend === 'disk'
- ? 'Local app storage'
+ ? t('Local app storage')
: stats.storageBackend === 'indexeddb'
- ? 'Browser storage'
- : 'Session RAM';
+ ? t('Browser storage')
+ : t('Session RAM');
const progressPct =
player.totalTimelineFrames > 1
@@ -467,14 +479,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="h-10 px-4 bg-ui-header border-b border-ui-subtle flex items-center justify-between shrink-0">
<div className="flex items-center gap-2 font-medium text-ui-primary">
<Film className="w-3.5 h-3.5 text-ui-accent" />
- <span id="timelapse-modal-title">Time-lapse Studio</span>
+ <span id="timelapse-modal-title">{t('Time-lapse Studio')}</span>
</div>
<button
type="button"
onClick={onClose}
disabled={isExporting}
- aria-label="Close"
- title="Close (Esc)"
+ aria-label={t('Close')}
+ title={t('Close (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer disabled:opacity-40"
>
<X className="w-3.5 h-3.5" />
@@ -491,7 +503,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="flex items-end gap-2.5">
{/* Capture Area Dropdown */}
<div className="relative">
- <span className="block text-[10px] text-ui-muted mb-1">Capture</span>
+ <span className="block text-[10px] text-ui-muted mb-1">{t('Capture')}</span>
<button
type="button"
disabled={!documentId || isExporting}
@@ -506,7 +518,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
: 'border-ui-default hover:border-ui-strong'
}`}
>
- <span>{activeAreaMeta.label}</span>
+ <span>{t(activeAreaMeta.label)}</span>
<ChevronDown
className={`w-3 h-3 text-ui-muted transition-transform ${
openDropdown === 'capture' ? 'rotate-180' : ''
@@ -517,7 +529,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{openDropdown === 'capture' && (
<div
role="listbox"
- aria-label="Capture area"
+ aria-label={t('Capture area')}
className="absolute left-0 top-full mt-1 w-64 z-30 bg-ui-floating border border-ui-strong rounded-ui-md shadow-ui-popover p-1 space-y-0.5"
>
{CAPTURE_AREA_OPTIONS.map((opt) => {
@@ -540,10 +552,10 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
</span>
<span className="min-w-0">
<span className="block text-xs font-medium leading-tight">
- {opt.label}
+ {t(opt.label)}
</span>
<span className="block text-[10px] text-ui-muted leading-snug mt-0.5">
- {opt.description}
+ {t(opt.description)}
</span>
</span>
</button>
@@ -555,7 +567,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Maximum Capture Resolution Dropdown */}
<div className="relative">
- <span className="block text-[10px] text-ui-muted mb-1">Maximum</span>
+ <span className="block text-[10px] text-ui-muted mb-1">{t('Maximum')}</span>
<button
type="button"
disabled={!documentId || isExporting}
@@ -581,7 +593,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{openDropdown === 'max-size' && (
<div
role="listbox"
- aria-label="Maximum capture resolution"
+ aria-label={t('Maximum capture resolution')}
className="absolute left-0 top-full mt-1 w-32 z-30 bg-ui-floating border border-ui-strong rounded-ui-md shadow-ui-popover p-1 space-y-0.5"
>
{CAPTURE_RES_OPTIONS.map((opt) => {
@@ -626,12 +638,12 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{stats.enabled ? (
<>
<Square className="w-3 h-3 fill-current" />
- <span>Pause Recording</span>
+ <span>{t('Pause Recording')}</span>
</>
) : (
<>
<Circle className="w-3 h-3 text-ui-danger fill-ui-danger" />
- <span>{stats.frameCount > 0 ? 'Continue Recording' : 'Record'}</span>
+ <span>{stats.frameCount > 0 ? t('Continue Recording') : t('Record')}</span>
</>
)}
</button>
@@ -640,7 +652,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={!documentId || !stats.enabled || isExporting}
onClick={() => onCaptureNow?.()}
- title="Capture keyframe now"
+ title={t('Capture keyframe now')}
className="h-7 px-2 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer disabled:opacity-35"
>
<Camera className="w-3.5 h-3.5" />
@@ -650,7 +662,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={!documentId || stats.frameCount === 0 || isExporting}
onClick={handleClear}
- title="Clear recorded keyframes"
+ title={t('Clear recorded keyframes')}
className="h-7 px-2 rounded-ui-sm bg-ui-control hover:bg-ui-danger/15 border border-ui-subtle hover:border-ui-danger/40 text-ui-muted hover:text-ui-danger transition-colors cursor-pointer disabled:opacity-35"
>
<Trash2 className="w-3.5 h-3.5" />
@@ -667,16 +679,23 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
}`}
/>
<span className="text-ui-secondary font-medium truncate max-w-[180px]">
- {cleanDocName}
+ {td(cleanDocName)}
</span>
<span className="font-ui-mono tabular-nums">
- · {stats.frameCount} frame{stats.frameCount === 1 ? '' : 's'} ·{' '}
- {formatTimelapseBytes(stats.storageBytes)}
+ ·{' '}
+ {stats.frameCount === 1
+ ? t('{count} frame', { count: 1 })
+ : t('{count} frames', { count: stats.frameCount })}{' '}
+ · {formatTimelapseBytes(stats.storageBytes)}
</span>
</div>
<div className="flex items-center gap-1.5 text-[10px] text-ui-muted">
<HardDrive className="w-3 h-3 text-ui-accent" />
- <span>{storageLabel} · resumes automatically after restart</span>
+ <span>
+ {t('{storage} · resumes automatically after restart', {
+ storage: storageLabel,
+ })}
+ </span>
</div>
</div>
</div>
@@ -693,33 +712,36 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
ref={player.modalCanvasRef}
onClick={player.togglePlay}
onDoubleClick={() => setIsFullscreen(true)}
- title="Click to Play/Pause · Double-click for Full-Screen"
+ title={t('Click to Play/Pause · Double-click for Full-Screen')}
className="max-h-full max-w-full object-contain cursor-pointer"
/>
{/* Top-left info badge */}
<div className="absolute top-2 left-2 px-2 py-0.5 rounded-ui-xs bg-black/65 text-white/90 text-[10px] font-ui-mono tabular-nums pointer-events-none">
{player.outputDims.width}×{player.outputDims.height} · {fps} FPS
- {watermark.enabled ? ' · WM' : ''}
+ {watermark.enabled ? ` · ${t('WM')}` : ''}
</div>
{/* Top-right Full-Screen Trigger */}
<button
type="button"
onClick={() => setIsFullscreen(true)}
- aria-label="View in full-screen"
- title="Full-Screen Preview (F)"
+ aria-label={t('View in full-screen')}
+ title={t('Full-Screen Preview (F)')}
className="absolute top-2 right-2 px-2 py-1 rounded-ui-sm bg-black/65 hover:bg-black/85 text-white text-[10px] flex items-center gap-1 cursor-pointer transition-colors"
>
<Maximize2 className="w-3 h-3" />
- <span>Full-screen</span>
+ <span>{t('Full-screen')}</span>
</button>
</>
) : (
<div className="text-[11px] text-ui-muted text-center px-6 space-y-1.5">
<Film className="w-6 h-6 mx-auto text-ui-disabled" />
- <div className="text-ui-secondary font-medium">No time-lapse frames yet</div>
+ <div className="text-ui-secondary font-medium">
+ {t('No time-lapse frames yet')}
+ </div>
<div>
- Click <span className="text-ui-primary font-medium">Record</span> and draw
- strokes to capture keyframes automatically in external storage.
+ {t(
+ 'Click Record and draw strokes to capture keyframes automatically in external storage.'
+ )}
</div>
</div>
)}
@@ -728,7 +750,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Direct In-App Preview Interval Switcher (15s / 30s / 60s / 2m / Full / Custom) */}
<div className="flex flex-wrap items-center justify-between gap-2 bg-ui-header rounded-ui-md border border-ui-subtle px-2.5 py-1.5">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- Preview clip
+ {t('Preview clip')}
</span>
<div className="flex items-center gap-1 flex-wrap">
{DURATION_OPTIONS.map((opt) => (
@@ -743,7 +765,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
: 'bg-ui-control text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {opt.label}
+ {opt.value === 'full' ? tc('timelapse', opt.label) : t(opt.label)}
</button>
))}
{duration === 'custom' && (
@@ -759,10 +781,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
Math.max(2, Math.min(600, Number(e.target.value) || 30))
)
}
- aria-label="Custom duration seconds"
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
+ aria-label={t('Custom duration seconds')}
className="w-12 h-5 px-1 rounded-ui-xs bg-ui-input border border-ui-default text-[10px] font-ui-mono text-ui-primary text-right"
/>
- <span className="text-[10px] text-ui-muted">s</span>
+ <span className="text-[10px] text-ui-muted">{tc('unit', 's')}</span>
</div>
)}
</div>
@@ -776,7 +802,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
</span>
<input
type="range"
- aria-label="Time-lapse preview timeline"
+ aria-label={t('Time-lapse preview timeline')}
disabled={stats.frameCount === 0}
min={0}
max={Math.max(0, player.totalTimelineFrames - 1)}
@@ -801,7 +827,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={stats.frameCount === 0}
onClick={player.restart}
- title="Jump to start"
+ title={t('Jump to start')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary cursor-pointer disabled:opacity-35"
>
<SkipBack className="w-3 h-3" />
@@ -810,7 +836,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={stats.frameCount === 0}
onClick={() => player.stepBy(-1)}
- title="Previous frame (Left Arrow)"
+ title={t('Previous frame (Left Arrow)')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary cursor-pointer disabled:opacity-35"
>
<ChevronLeft className="w-3 h-3" />
@@ -819,18 +845,18 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={stats.frameCount <= 1}
onClick={player.togglePlay}
- title="Play / Pause (Space)"
+ title={t('Play / Pause (Space)')}
className="px-2.5 py-1 rounded-ui-sm bg-ui-control-active hover:bg-ui-control-hover border border-ui-default text-ui-primary flex items-center gap-1 text-[11px] font-medium cursor-pointer disabled:opacity-35"
>
{player.isPlaying ? (
<>
<Pause className="w-3 h-3" />
- <span>Pause</span>
+ <span>{t('Pause')}</span>
</>
) : (
<>
<Play className="w-3 h-3" />
- <span>Play</span>
+ <span>{t('Play')}</span>
</>
)}
</button>
@@ -838,7 +864,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
type="button"
disabled={stats.frameCount === 0}
onClick={() => player.stepBy(1)}
- title="Next frame (Right Arrow)"
+ title={t('Next frame (Right Arrow)')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary cursor-pointer disabled:opacity-35"
>
<ChevronRight className="w-3 h-3" />
@@ -846,7 +872,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<button
type="button"
onClick={() => setLoop((l) => !l)}
- title={loop ? 'Loop playback on' : 'Loop playback off'}
+ title={loop ? t('Loop playback on') : t('Loop playback off')}
className={`p-1 rounded-ui-sm border cursor-pointer transition-colors ${
loop
? 'bg-ui-accent-subtle border-ui-accent-border text-ui-accent'
@@ -858,7 +884,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<button
type="button"
onClick={handleCycleSpeed}
- title="Preview playback speed"
+ title={t('Preview playback speed')}
className="px-1.5 py-0.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] font-ui-mono tabular-nums text-ui-secondary cursor-pointer"
>
{playbackSpeed}×
@@ -868,14 +894,17 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="flex items-center gap-2">
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{stats.frameCount > 0
- ? `Key ${Math.min(player.currentSourceFrameIndex + 1, stats.frameCount)}/${stats.frameCount}`
+ ? t('Key {current}/{total}', {
+ current: Math.min(player.currentSourceFrameIndex + 1, stats.frameCount),
+ total: stats.frameCount,
+ })
: '0/0'}
</span>
<button
type="button"
disabled={stats.frameCount === 0}
onClick={() => setIsFullscreen(true)}
- title="Full-Screen Preview (F)"
+ title={t('Full-Screen Preview (F)')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary cursor-pointer disabled:opacity-35"
>
<Maximize2 className="w-3 h-3" />
@@ -899,7 +928,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
}`}
>
<SlidersHorizontal className="w-3 h-3" />
- <span>Export</span>
+ <span>{t('Export')}</span>
</button>
<button
type="button"
@@ -911,7 +940,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
}`}
>
<Stamp className="w-3 h-3" />
- <span>Watermark</span>
+ <span>{t('Watermark')}</span>
{watermark.enabled && (
<span className="w-1.5 h-1.5 rounded-full bg-ui-accent" />
)}
@@ -926,7 +955,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
}`}
>
<FolderClock className="w-3 h-3" />
- <span>Library</span>
+ <span>{t('Library')}</span>
</button>
</div>
@@ -960,7 +989,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Quality
+ {t('Quality')}
</label>
<div className="grid grid-cols-4 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{QUALITY_OPTIONS.map((q) => (
@@ -975,7 +1004,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {q.label}
+ {t(q.label)}
</button>
))}
</div>
@@ -985,7 +1014,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Export Resolution */}
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Export Resolution
+ {t('Export Resolution')}
</label>
<div className="grid grid-cols-4 gap-1 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{EXPORT_RES_OPTIONS.map((res) => (
@@ -1009,7 +1038,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Aspect Ratio */}
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Aspect Ratio
+ {t('Aspect Ratio')}
</label>
<div className="grid grid-cols-5 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{ASPECT_RATIO_OPTIONS.map((ar) => (
@@ -1024,7 +1053,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {ar.label}
+ {ar.value === 'original' ? t(ar.label) : ar.label}
</button>
))}
</div>
@@ -1033,7 +1062,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Letterbox Backdrop */}
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Letterbox Backdrop
+ {t('Letterbox Backdrop')}
</label>
<div className="grid grid-cols-4 gap-1 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{(
@@ -1055,13 +1084,13 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {bg.label}
+ {tc('backdrop', bg.label)}
</button>
))}
</div>
{backgroundMode === 'custom' && (
<div className="flex items-center justify-between bg-ui-header border border-ui-subtle rounded-ui-sm px-2.5 py-1 mt-1">
- <span className="text-[10px] text-ui-muted">Background color</span>
+ <span className="text-[10px] text-ui-muted">{t('Background color')}</span>
<div className="flex items-center gap-1.5">
<span className="text-[10px] font-ui-mono text-ui-secondary uppercase">
{customBgColor}
@@ -1083,17 +1112,17 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="flex items-center justify-between bg-ui-header border border-ui-subtle px-2.5 py-2 rounded-ui-sm">
<div>
<div className="text-[11px] text-ui-primary font-medium">
- Native FFmpeg (.mp4)
+ {t('Native FFmpeg (.mp4)')}
</div>
<div className="text-[10px] text-ui-muted">
- Fast H.264 encode with watermark &amp; CRF quality
+ {t('Fast H.264 encode with watermark & CRF quality')}
</div>
</div>
<ToggleSwitch
checked={preferFfmpeg}
onChange={setPreferFfmpeg}
disabled={isExporting}
- aria-label="Use native FFmpeg encoder"
+ aria-label={t('Use native FFmpeg encoder')}
/>
</div>
)}
@@ -1107,13 +1136,16 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="flex items-center gap-2 min-w-0">
<Stamp className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<div className="min-w-0">
- <div className="text-[11px] text-ui-primary font-medium">Watermark</div>
+ <div className="text-[11px] text-ui-primary font-medium">{t('Watermark')}</div>
<div className="text-[10px] text-ui-muted truncate">
{watermark.enabled
? watermark.mode === 'image'
- ? 'Custom logo enabled'
- : `"${watermark.text || 'Text'}" · ${watermark.position}`
- : 'Off — click to add text or logo'}
+ ? t('Custom logo enabled')
+ : t('"{text}" · {position}', {
+ text: watermark.text || t('Text'),
+ position: td(watermark.position),
+ })
+ : t('Off — click to add text or logo')}
</div>
</div>
</div>
@@ -1135,13 +1167,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="space-y-2.5">
<div className="flex items-center justify-between">
<div className="text-[10px] text-ui-muted leading-snug">
- Saved locally outside your <span className="font-ui-mono">.ink</span>{' '}
- files so projects stay fast &amp; lightweight.
+ {t(
+ 'Saved locally outside your .ink files so projects stay fast & lightweight.'
+ )}
</div>
<button
type="button"
onClick={() => void refreshStoredRecordings()}
- title="Refresh local recordings"
+ title={t('Refresh local recordings')}
className="p-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-muted hover:text-ui-primary cursor-pointer shrink-0"
>
<RefreshCw
@@ -1152,7 +1185,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{storedRecordings.length === 0 ? (
<div className="py-8 text-center text-[11px] text-ui-muted bg-ui-header/50 rounded-ui-md border border-ui-subtle">
- No locally stored recordings found yet.
+ {t('No locally stored recordings found yet.')}
</div>
) : (
<div className="space-y-1.5">
@@ -1174,13 +1207,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
</span>
{isCurrent && (
<span className="px-1 py-0.2 rounded-ui-xs bg-ui-accent text-ui-accent-contrast text-[9px] font-semibold">
- Active
+ {t('Active')}
</span>
)}
</div>
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- {rec.frameCount} frames · {formatTimelapseBytes(rec.totalBytes)} ·{' '}
- {formatRelativeDate(rec.updatedAt)}
+ {t('{count} frames', { count: rec.frameCount })} ·{' '}
+ {formatTimelapseBytes(rec.totalBytes)} ·{' '}
+ {formatRecordedDate(rec.updatedAt)}
</div>
</div>
<div className="flex items-center gap-1 shrink-0">
@@ -1191,14 +1225,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
onClick={() => void handleAttachRecording(rec)}
className="px-2 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary cursor-pointer"
>
- Load
+ {t('Load')}
</button>
)}
<button
type="button"
disabled={isExporting}
onClick={() => void handleDeleteStoredRecording(rec)}
- title="Delete recording from local storage"
+ title={t('Delete recording from local storage')}
className="p-1 rounded-ui-xs bg-ui-control hover:bg-ui-danger/15 border border-ui-subtle text-ui-muted hover:text-ui-danger cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -1226,7 +1260,11 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
<div className="px-4 py-2 bg-ui-header border-t border-ui-subtle space-y-1 shrink-0">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
<span>
- Encoding {player.outputDims.width}×{player.outputDims.height} @ {fps} FPS...
+ {t('Encoding {width}×{height} @ {fps} FPS...', {
+ width: player.outputDims.width,
+ height: player.outputDims.height,
+ fps,
+ })}
</span>
<span className="font-ui-mono tabular-nums">
{Math.round(exportProgress * 100)}%
@@ -1244,9 +1282,14 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{/* Footer */}
<div className="px-4 py-2.5 bg-ui-header border-t border-ui-subtle flex flex-wrap items-center justify-between gap-2 shrink-0">
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- Output: {player.outputDims.width}×{player.outputDims.height} · {fps} FPS ·{' '}
- {player.totalDurationSec.toFixed(1)}s · {quality}
- {ffmpegAvailable && preferFfmpeg ? ' · MP4' : ' · WebM'}
+ {t('Output: {width}×{height} · {fps} FPS · {duration}s · {quality} · {format}', {
+ width: player.outputDims.width,
+ height: player.outputDims.height,
+ fps,
+ duration: player.totalDurationSec.toFixed(1),
+ quality: td(quality, 'timelapseQuality'),
+ format: ffmpegAvailable && preferFfmpeg ? 'MP4' : 'WebM',
+ })}
</div>
<div className="flex items-center gap-2">
@@ -1256,7 +1299,7 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
disabled={isExporting}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary font-medium transition-colors cursor-pointer disabled:opacity-40"
>
- Close
+ {t('Close')}
</button>
<button
type="button"
@@ -1267,12 +1310,12 @@ export const TimelapseExportModal: React.FC<TimelapseExportModalProps> = ({
{isExporting ? (
<>
<Loader2 className="w-3.5 h-3.5 animate-spin" />
- <span>Exporting...</span>
+ <span>{t('Exporting...')}</span>
</>
) : (
<>
<Download className="w-3.5 h-3.5" />
- <span>Export Video</span>
+ <span>{t('Export Video')}</span>
</>
)}
</button>
diff --git a/src/components/TonalCorrectionModal.tsx b/src/components/TonalCorrectionModal.tsx
index fef1313..7115568 100644
--- a/src/components/TonalCorrectionModal.tsx
+++ b/src/components/TonalCorrectionModal.tsx
@@ -10,6 +10,7 @@ import {
TileHistogramMap,
computeHistogram,
} from '../utils/tonalEngine';
+import { isImeComposing, useI18n } from '../i18n';
interface TonalCorrectionModalProps {
isOpen: boolean;
@@ -60,6 +61,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
onApply,
onPreviewChange,
}) => {
+ const { t, tc } = useI18n();
const [preview, setPreview] = useState(true);
// Filter-specific parameter states
@@ -286,6 +288,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
onClose();
@@ -304,17 +307,17 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
const getTitle = () => {
switch (type) {
case 'brightness-contrast':
- return 'Brightness / Contrast';
+ return t('Brightness / Contrast');
case 'binarization':
- return 'Binarization (Threshold)';
+ return t('Binarization (Threshold)');
case 'hue-saturation':
- return 'Hue / Saturation / Luminosity';
+ return t('Hue / Saturation / Luminosity');
case 'posterization':
- return 'Posterization';
+ return t('Posterization');
case 'level-correction':
- return 'Level Correction';
+ return t('Level Correction');
default:
- return 'Tonal Correction';
+ return t('Tonal Correction');
}
};
@@ -348,8 +351,8 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={tc('action', 'Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -363,7 +366,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div className="space-y-4">
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Brightness</span>
+ <span className="text-[11px] text-ui-muted">{t('Brightness')}</span>
<input
type="number"
min={-100}
@@ -392,7 +395,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Contrast</span>
+ <span className="text-[11px] text-ui-muted">{t('Contrast')}</span>
<input
type="number"
min={-100}
@@ -426,7 +429,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div className="space-y-4">
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Threshold</span>
+ <span className="text-[11px] text-ui-muted">{t('Threshold')}</span>
<input
type="number"
min={1}
@@ -449,9 +452,9 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
className="w-full"
/>
<div className="flex justify-between text-[10px] font-ui-mono tabular-nums text-ui-muted mt-1">
- <span>Black (1)</span>
- <span>Mid (128)</span>
- <span>White (255)</span>
+ <span>{t('Black (1)')}</span>
+ <span>{t('Mid (128)')}</span>
+ <span>{t('White (255)')}</span>
</div>
</div>
</div>
@@ -462,7 +465,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div className="space-y-4">
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Hue</span>
+ <span className="text-[11px] text-ui-muted">{t('Hue')}</span>
<input
type="number"
min={-180}
@@ -491,7 +494,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Saturation</span>
+ <span className="text-[11px] text-ui-muted">{t('Saturation')}</span>
<input
type="number"
min={-100}
@@ -520,7 +523,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Luminosity</span>
+ <span className="text-[11px] text-ui-muted">{t('Luminosity')}</span>
<input
type="number"
min={-100}
@@ -554,7 +557,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div className="space-y-4">
<div>
<div className="flex items-center justify-between mb-1">
- <span className="text-[11px] text-ui-muted">Gradation Levels</span>
+ <span className="text-[11px] text-ui-muted">{t('Gradation Levels')}</span>
<input
type="number"
min={2}
@@ -577,9 +580,9 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
className="w-full"
/>
<div className="flex justify-between text-[10px] font-ui-mono tabular-nums text-ui-muted mt-1">
- <span>2 (High Contrast)</span>
+ <span>{t('2 (High Contrast)')}</span>
<span>16</span>
- <span>32 (Smooth)</span>
+ <span>{t('32 (Smooth)')}</span>
</div>
</div>
</div>
@@ -590,7 +593,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<div className="space-y-3.5">
{/* Channel Selector */}
<div className="flex items-center justify-between">
- <span className="text-[11px] text-ui-muted">Channel</span>
+ <span className="text-[11px] text-ui-muted">{t('Channel')}</span>
<div className="flex gap-1">
{(['rgb', 'r', 'g', 'b'] as const).map((ch) => (
<button
@@ -622,18 +625,18 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
{/* Input Levels */}
<div>
<div className="flex items-center justify-between text-[11px] text-ui-muted mb-1">
- <span>Input Levels (Shadow / Gamma / Highlight)</span>
+ <span>{t('Input Levels (Shadow / Gamma / Highlight)')}</span>
<button
type="button"
onClick={handleAutoLevels}
className="text-ui-accent hover:underline cursor-pointer"
>
- Auto
+ {t('Auto')}
</button>
</div>
<div className="grid grid-cols-3 gap-2">
<div>
- <label className="text-[10px] text-ui-muted block mb-0.5">Shadow</label>
+ <label className="text-[10px] text-ui-muted block mb-0.5">{t('Shadow')}</label>
<input
type="number"
min={0}
@@ -652,7 +655,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
/>
</div>
<div>
- <label className="text-[10px] text-ui-muted block mb-0.5">Gamma</label>
+ <label className="text-[10px] text-ui-muted block mb-0.5">{t('Gamma')}</label>
<input
type="number"
step={0.05}
@@ -669,7 +672,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
/>
</div>
<div>
- <label className="text-[10px] text-ui-muted block mb-0.5">Highlight</label>
+ <label className="text-[10px] text-ui-muted block mb-0.5">{t('Highlight')}</label>
<input
type="number"
min={Math.min(255, levels.inputMin + 2)}
@@ -692,7 +695,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
{/* Range Slider for Shadows & Highlights */}
<div className="mt-2 space-y-1.5">
<div className="flex items-center space-x-2">
- <span className="text-[10px] text-ui-muted w-12">Shadow</span>
+ <span className="text-[10px] text-ui-muted w-12">{t('Shadow')}</span>
<input
type="range"
min={0}
@@ -705,7 +708,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
/>
</div>
<div className="flex items-center space-x-2">
- <span className="text-[10px] text-ui-muted w-12">Highlight</span>
+ <span className="text-[10px] text-ui-muted w-12">{t('Highlight')}</span>
<input
type="range"
min={Math.min(255, levels.inputMin + 2)}
@@ -723,11 +726,11 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
{/* Output Levels */}
<div className="pt-2 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[11px] text-ui-muted mb-1">
- <span>Output Levels</span>
+ <span>{t('Output Levels')}</span>
</div>
<div className="grid grid-cols-2 gap-2">
<div>
- <label className="text-[10px] text-ui-muted block mb-0.5">Min (Black)</label>
+ <label className="text-[10px] text-ui-muted block mb-0.5">{t('Min (Black)')}</label>
<input
type="number"
min={0}
@@ -743,7 +746,7 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
/>
</div>
<div>
- <label className="text-[10px] text-ui-muted block mb-0.5">Max (White)</label>
+ <label className="text-[10px] text-ui-muted block mb-0.5">{t('Max (White)')}</label>
<input
type="number"
min={levels.outputMin}
@@ -773,15 +776,15 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
checked={preview}
onChange={(e) => setPreview(e.target.checked)}
/>
- <span className="text-[11px]">Preview</span>
+ <span className="text-[11px]">{t('Preview')}</span>
</label>
<button
type="button"
onClick={handleReset}
className="text-[11px] text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
- title="Reset parameters"
+ title={t('Reset parameters')}
>
- Reset
+ {t('Reset')}
</button>
</div>
@@ -791,14 +794,14 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary rounded-ui-sm text-xs font-medium transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
<button
type="button"
onClick={() => onApply(type, currentParams)}
className="px-4 py-1.5 bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm text-xs font-medium transition-opacity cursor-pointer"
>
- OK
+ {t('OK')}
</button>
</div>
</div>
diff --git a/src/components/Tool3DPropertyInspector.tsx b/src/components/Tool3DPropertyInspector.tsx
index 6620056..e3c27a5 100644
--- a/src/components/Tool3DPropertyInspector.tsx
+++ b/src/components/Tool3DPropertyInspector.tsx
@@ -32,6 +32,7 @@ import {
useDocumentStore,
useUiStore,
} from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
type Inspector3DTab = 'transform' | 'light' | 'scene' | 'pose';
@@ -77,6 +78,10 @@ const NumericAxisRow: React.FC<NumericAxisRowProps> = ({
onChangeAxis(idx, parsed);
}
}}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
className="w-full min-w-0 bg-transparent text-[10px] font-ui-mono tabular-nums text-ui-primary outline-none text-right"
/>
</label>
@@ -86,6 +91,7 @@ const NumericAxisRow: React.FC<NumericAxisRowProps> = ({
);
export const Tool3DPropertyInspector: React.FC = () => {
+ const { t, tc, td } = useI18n();
const hasOpenDocument = useDocumentStore(selectHasOpenDocument);
const is3DLayerOpen = useUiStore((s) => s.is3DLayerOpen);
@@ -127,9 +133,9 @@ export const Tool3DPropertyInspector: React.FC = () => {
if (!hasOpenDocument) {
return (
<div className="p-2.5 space-y-2 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">3D Studio Tool</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('3D Studio Tool')}</div>
<p className="text-[10px] text-ui-muted leading-relaxed">
- Open or create a canvas document to use the 3D reference stage.
+ {t('Open or create a canvas document to use the 3D reference stage.')}
</p>
</div>
);
@@ -138,16 +144,16 @@ export const Tool3DPropertyInspector: React.FC = () => {
if (!is3DLayerOpen) {
return (
<div className="p-2.5 space-y-2.5 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">3D Studio Tool</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('3D Studio Tool')}</div>
<p className="text-[10px] text-ui-muted leading-relaxed">
- Open the 3D reference stage to create primitives or drop .glb / .gltf / .obj models directly onto the canvas.
+ {t('Open the 3D reference stage to create primitives or drop .glb / .gltf / .obj models directly onto the canvas.')}
</p>
<button
type="button"
onClick={() => uiStoreActions.set3DLayerOpen(true)}
className="w-full py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-[11px] font-medium hover:opacity-90 transition-opacity cursor-pointer"
>
- Open 3D Stage
+ {t('Open 3D Stage')}
</button>
</div>
);
@@ -179,10 +185,10 @@ export const Tool3DPropertyInspector: React.FC = () => {
const uniformScalePct = Math.round(modelTransform.scale[0] * 100);
const tabs: Array<[Inspector3DTab, string]> = [
- ['transform', 'Edit'],
- ['light', 'Light'],
- ['scene', 'View'],
- ...(isMannequinActive ? ([['pose', 'Pose']] as Array<[Inspector3DTab, string]>) : []),
+ ['transform', t('Edit')],
+ ['light', tc('3d', 'Light')],
+ ['scene', t('View')],
+ ...(isMannequinActive ? ([['pose', t('Pose')]] as Array<[Inspector3DTab, string]>) : []),
];
return (
@@ -196,13 +202,13 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="flex items-center gap-1 min-w-0">
<Box className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<span className="text-[11px] font-medium truncate">
- {loadedModelName || '3D Studio'}
+ {loadedModelName ? td(loadedModelName) : t('3D Studio')}
</span>
</div>
<button
type="button"
onClick={() => store3DActions.toggleReferenceVisible()}
- title={isReferenceVisible ? 'Hide 3D Reference' : 'Show 3D Reference'}
+ title={isReferenceVisible ? t('Hide 3D Reference') : t('Show 3D Reference')}
className="p-1 rounded-ui-xs text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer shrink-0"
>
{isReferenceVisible ? <Eye className="w-3 h-3" /> : <EyeOff className="w-3 h-3" />}
@@ -212,17 +218,17 @@ export const Tool3DPropertyInspector: React.FC = () => {
<button
type="button"
onClick={() => scene3DBridge.triggerFilePicker?.()}
- title="Click to browse or drag & drop .glb, .gltf, or .obj onto canvas"
+ title={t('Click to browse or drag & drop .glb, .gltf, or .obj onto canvas')}
className="w-full flex items-center justify-center gap-1.5 py-1 rounded-ui-sm bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
<Upload className="w-3 h-3 text-ui-accent" />
- <span>Import 3D Model (.glb / .obj)</span>
+ <span>{t('Import 3D Model (.glb / .obj)')}</span>
</button>
{/* Quick 3D Primitives */}
<div className="space-y-1">
<span className="text-[9px] uppercase tracking-wider text-ui-muted">
- Primitives
+ {t('Primitives')}
</span>
<div className="grid grid-cols-5 gap-0.5">
{PRIMITIVE_3D_ITEMS.map((item) => {
@@ -232,7 +238,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
key={item.type}
type="button"
onClick={() => scene3DBridge.createPrimitive?.(item.type)}
- title={item.description}
+ title={td(item.description)}
data-testid={`inspector-3d-primitive-${item.type}`}
className={`flex flex-col items-center justify-center gap-0.5 py-1 px-0.5 rounded-ui-xs border text-[8.5px] leading-tight transition-colors cursor-pointer ${
isSelected
@@ -241,7 +247,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
}`}
>
<Primitive3DIcon type={item.type} className="w-3.5 h-3.5 shrink-0" />
- <span className="truncate max-w-full">{item.label}</span>
+ <span className="truncate max-w-full">{td(item.label)}</span>
</button>
);
})}
@@ -278,7 +284,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Canvas Drag Sub-Mode */}
<div className="space-y-1">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- Canvas Tool Mode
+ {t('Canvas Tool Mode')}
</span>
<div className="grid grid-cols-2 gap-1">
{(
@@ -303,7 +309,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {label}
+ {t(label)}
</button>
))}
</div>
@@ -313,17 +319,17 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<div className="flex items-center justify-between">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- On-Canvas Gizmo
+ {t('On-Canvas Gizmo')}
</span>
<button
type="button"
onClick={() =>
store3DActions.setGizmoSpace(gizmoSpace === 'local' ? 'world' : 'local')
}
- title="Toggle Local vs World Gizmo Axes"
+ title={t('Toggle Local vs World Gizmo Axes')}
className="text-[9px] font-ui-mono px-1.5 py-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- {gizmoSpace === 'local' ? 'Local' : 'World'}
+ {gizmoSpace === 'local' ? t('Local') : t('World')}
</button>
</div>
<div className="grid grid-cols-4 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
@@ -345,12 +351,12 @@ export const Tool3DPropertyInspector: React.FC = () => {
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {lbl}
+ {tc('3dGizmo', lbl)}
</button>
))}
</div>
<label className="flex items-center justify-between text-[10px] text-ui-muted cursor-pointer">
- <span>Snap (15° / 10% · Shift)</span>
+ <span>{t('Snap (15° / 10% · Shift)')}</span>
<input
type="checkbox"
checked={snapEnabled}
@@ -362,25 +368,25 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Live Numeric Position / Rotation / Scale */}
<div className="space-y-2.5 pt-1 border-t border-ui-subtle">
<NumericAxisRow
- label="Position"
+ label={t('Position')}
values={modelTransform.position}
step={0.1}
- suffix="units"
+ suffix={t('units')}
onChangeAxis={updatePosAxis}
/>
<NumericAxisRow
- label="Rotation"
+ label={t('Rotation')}
values={modelTransform.rotation}
step={5}
- suffix="deg"
+ suffix={t('deg')}
onChangeAxis={updateRotAxis}
/>
{/* Scale with Uniform Lock */}
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Scale</span>
+ <span className="text-ui-muted">{t('Scale')}</span>
<div className="flex items-center gap-1">
<span className="font-ui-mono tabular-nums text-ui-primary">{uniformScalePct}%</span>
<button
@@ -392,8 +398,8 @@ export const Tool3DPropertyInspector: React.FC = () => {
}
title={
modelTransform.uniformScale
- ? 'Uniform scale locked (click to unlock X/Y/Z)'
- : 'Non-uniform X/Y/Z scale (click to lock)'
+ ? t('Uniform scale locked (click to unlock X/Y/Z)')
+ : t('Non-uniform X/Y/Z scale (click to lock)')
}
className="p-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary transition-colors cursor-pointer"
>
@@ -454,7 +460,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
className="flex items-center justify-center gap-1 py-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary disabled:opacity-40 transition-colors cursor-pointer"
>
<Magnet className="w-3 h-3 text-ui-accent" />
- <span>Snap Floor</span>
+ <span>{t('Snap Floor')}</span>
</button>
<button
type="button"
@@ -463,7 +469,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
className="flex items-center justify-center gap-1 py-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-muted hover:text-ui-primary disabled:opacity-40 transition-colors cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
</div>
@@ -475,7 +481,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Key Light Toggle + Interactive 3D Sphere */}
<div className="space-y-1.5">
<label className="flex items-center justify-between text-[11px] text-ui-secondary cursor-pointer">
- <span>Key Light Enabled</span>
+ <span>{t('Key Light Enabled')}</span>
<input
type="checkbox"
checked={lighting.keyLight.enabled}
@@ -516,13 +522,13 @@ export const Tool3DPropertyInspector: React.FC = () => {
checked={lighting.rimLight.enabled}
onChange={(e) => store3DActions.updateRimLight({ enabled: e.target.checked })}
/>
- <span>Light 2 (Rim / Fill)</span>
+ <span>{t('Light 2 (Rim / Fill)')}</span>
</label>
<input
type="color"
value={lighting.rimLight.color}
onChange={(e) => store3DActions.updateRimLight({ color: e.target.value })}
- title="Rim Light Color"
+ title={t('Rim Light Color')}
className="w-5 h-4 bg-transparent border-0 cursor-pointer p-0"
/>
</div>
@@ -531,7 +537,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="space-y-1.5 bg-ui-input p-2 rounded-ui-sm border border-ui-subtle">
<div className="space-y-0.5">
<div className="flex justify-between text-[10px]">
- <span className="text-ui-muted">Angle</span>
+ <span className="text-ui-muted">{t('Angle')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{lighting.rimLight.azimuth}°</span>
</div>
<input
@@ -548,7 +554,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
</div>
<div className="space-y-0.5">
<div className="flex justify-between text-[10px]">
- <span className="text-ui-muted">Height</span>
+ <span className="text-ui-muted">{t('Height')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{lighting.rimLight.elevation}°</span>
</div>
<input
@@ -565,7 +571,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
</div>
<div className="space-y-0.5">
<div className="flex justify-between text-[10px]">
- <span className="text-ui-muted">Intensity</span>
+ <span className="text-ui-muted">{t('Intensity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round(lighting.rimLight.intensity * 100)}%
</span>
@@ -589,7 +595,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Ambient Tint & Ground Shadow */}
<div className="space-y-1.5 pt-2 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[10px]">
- <span className="text-ui-muted">Ambient Color</span>
+ <span className="text-ui-muted">{t('Ambient Color')}</span>
<input
type="color"
value={lighting.ambientColor}
@@ -598,7 +604,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
/>
</div>
<label className="flex items-center justify-between text-[10px] text-ui-secondary cursor-pointer">
- <span>Cast Ground Shadow</span>
+ <span>{t('Cast Ground Shadow')}</span>
<input
type="checkbox"
checked={lighting.castGroundShadow}
@@ -610,7 +616,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{lighting.castGroundShadow && (
<div className="space-y-0.5">
<div className="flex justify-between text-[10px]">
- <span className="text-ui-muted">Shadow Strength</span>
+ <span className="text-ui-muted">{t('Shadow Strength')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round(lighting.shadowOpacity * 100)}%
</span>
@@ -638,14 +644,14 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="space-y-1">
<div className="flex items-center justify-between">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- Camera Angle
+ {t('Camera Angle')}
</span>
<button
type="button"
onClick={() => scene3DBridge.resetCamera?.()}
className="text-[10px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Reset
+ {t('Reset')}
</button>
</div>
<div className="grid grid-cols-3 gap-1">
@@ -665,7 +671,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => scene3DBridge.setCameraPreset?.(preset)}
className="py-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- {lbl}
+ {tc('3dCam', lbl)}
</button>
))}
</div>
@@ -673,7 +679,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Shading Style */}
<div className="space-y-1 pt-1 border-t border-ui-subtle">
- <span className="text-[10px] uppercase tracking-wider text-ui-muted">Shading</span>
+ <span className="text-[10px] uppercase tracking-wider text-ui-muted">{t('Shading')}</span>
<div className="grid grid-cols-3 gap-1">
{(
[
@@ -694,7 +700,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {lbl}
+ {tc('3dShading', lbl)}
</button>
))}
</div>
@@ -702,7 +708,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{(shadingMode === 'shaded' || shadingMode === 'smooth') && (
<div className="space-y-0.5 pt-1">
<div className="flex justify-between text-[10px]">
- <span className="text-ui-muted">Roughness</span>
+ <span className="text-ui-muted">{t('Roughness')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{Math.round(materialRoughness * 100)}%
</span>
@@ -720,7 +726,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
)}
<label className="flex items-center justify-between text-[10px] text-ui-secondary pt-1 cursor-pointer">
- <span>Manga Outline Preview</span>
+ <span>{t('Manga Outline Preview')}</span>
<input
type="checkbox"
checked={toonOutline}
@@ -733,7 +739,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="space-y-2 pt-1 border-t border-ui-subtle">
<div>
<div className="flex justify-between text-[10px] mb-0.5">
- <span className="text-ui-muted">Perspective (FOV)</span>
+ <span className="text-ui-muted">{t('Perspective (FOV)')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">
{perspective.toFixed(1)}x · {fov}°
</span>
@@ -751,7 +757,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div>
<div className="flex justify-between text-[10px] mb-0.5">
- <span className="text-ui-muted">Stage Opacity</span>
+ <span className="text-ui-muted">{t('Stage Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{Math.round(opacity * 100)}%</span>
</div>
<input
@@ -769,7 +775,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
{/* Guides & Perspective Ruler Sync */}
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<label className="flex items-center justify-between text-[10px] text-ui-secondary cursor-pointer">
- <span>Floor Grid</span>
+ <span>{t('Floor Grid')}</span>
<input
type="checkbox"
checked={showGrid}
@@ -777,7 +783,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
/>
</label>
<label className="flex items-center justify-between text-[10px] text-ui-secondary cursor-pointer">
- <span>Live Sync Perspective Ruler</span>
+ <span>{t('Live Sync Perspective Ruler')}</span>
<input
type="checkbox"
checked={syncCameraPerspective}
@@ -790,7 +796,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
className="w-full flex items-center justify-center gap-1 py-1 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
<Compass className="w-3 h-3 text-ui-accent" />
- <span>Sync Ruler to Camera Now</span>
+ <span>{t('Sync Ruler to Camera Now')}</span>
</button>
</div>
</>
@@ -800,7 +806,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
<>
<div className="space-y-1">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- Pose Presets
+ {t('Pose Presets')}
</span>
<div className="grid grid-cols-2 gap-1">
{(
@@ -818,7 +824,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => scene3DBridge.applyPosePreset?.(preset)}
className="py-1.5 px-2 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary text-left transition-colors cursor-pointer"
>
- {lbl}
+ {td(lbl)}
</button>
))}
</div>
@@ -827,7 +833,7 @@ export const Tool3DPropertyInspector: React.FC = () => {
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<div className="flex items-center justify-between">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- IK Limb Handles
+ {t('IK Limb Handles')}
</span>
{activeIKHandle && (
<button
@@ -835,12 +841,12 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => scene3DBridge.selectIKTarget?.(null)}
className="text-[10px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Done
+ {t('Done')}
</button>
)}
</div>
<p className="text-[10px] text-ui-muted leading-snug">
- Click any colored joint sphere on the canvas or pick a limb below to drag it.
+ {t('Click any colored joint sphere on the canvas or pick a limb below to drag it.')}
</p>
<div className="grid grid-cols-3 gap-1">
{(
@@ -864,12 +870,12 @@ export const Tool3DPropertyInspector: React.FC = () => {
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {lbl}
+ {t(lbl)}
</button>
))}
</div>
<label className="flex items-center justify-between text-[10px] text-ui-secondary pt-1 cursor-pointer">
- <span>Show Joint Spheres</span>
+ <span>{t('Show Joint Spheres')}</span>
<input
type="checkbox"
checked={showIKHandles}
@@ -887,15 +893,15 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => setShowRules((v) => !v)}
className="w-full flex items-center justify-between text-[10px] text-ui-muted hover:text-ui-primary py-0.5 cursor-pointer"
>
- <span>Controls & Rules</span>
- <span>{showRules ? 'Hide' : 'Show'}</span>
+ <span>{t('Controls & Rules')}</span>
+ <span>{showRules ? t('Hide') : t('Show')}</span>
</button>
{showRules && (
<div className="mt-1.5 space-y-1 bg-ui-input rounded-ui-xs p-1.5 border border-ui-subtle">
{TOOL_3D_BEHAVIOR_RULES.map((rule) => (
<div key={rule.gesture} className="text-[9px] leading-tight">
- <span className="font-ui-mono text-ui-primary">{rule.gesture}: </span>
- <span className="text-ui-muted">{rule.action}</span>
+ <span className="font-ui-mono text-ui-primary">{td(rule.gesture)}: </span>
+ <span className="text-ui-muted">{td(rule.action)}</span>
</div>
))}
</div>
@@ -911,11 +917,11 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => {
void scene3DBridge.bakeTo2D?.(false);
}}
- title="Bake a 2D raster copy while keeping the 3D stage open"
+ title={t('Bake a 2D raster copy while keeping the 3D stage open')}
className="flex items-center justify-center gap-1 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-primary disabled:opacity-40 transition-colors cursor-pointer"
>
<CopyPlus className="w-3 h-3" />
- <span>Stamp</span>
+ <span>{t('Stamp')}</span>
</button>
<button
type="button"
@@ -923,11 +929,11 @@ export const Tool3DPropertyInspector: React.FC = () => {
onClick={() => {
void scene3DBridge.bakeTo2D?.(true);
}}
- title="Rasterize 3D model into a 2D Layer and close stage"
+ title={t('Rasterize 3D model into a 2D Layer and close stage')}
className="flex items-center justify-center gap-1 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[10px] font-medium disabled:opacity-40 transition-opacity cursor-pointer"
>
<Layers className="w-3 h-3" />
- <span>{isBaking ? 'Baking...' : 'Bake Layer'}</span>
+ <span>{isBaking ? t('Baking...') : t('Bake Layer')}</span>
</button>
</div>
</div>
diff --git a/src/components/ToolOptionsBar.tsx b/src/components/ToolOptionsBar.tsx
index 4540a9b..2c04a79 100644
--- a/src/components/ToolOptionsBar.tsx
+++ b/src/components/ToolOptionsBar.tsx
@@ -71,6 +71,7 @@ import {
workspaceStoreActions,
} from '../stores';
import { ScrubSlider } from './ui';
+import { isImeComposing, useI18n } from '../i18n';
export interface ToolOptionsBarProps {
/** Optional override to force visibility (useful in isolated tests/previews). */
@@ -228,6 +229,7 @@ const compactSelectClass =
* only updates this row and never touches Header, DockWorkspace, or Layers.
*/
const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool }) => {
+ const { t, tc, td } = useI18n();
const brushSettings = useToolStore((s) => s.brushSettings);
const activePresetId = useToolStore((s) => s.activePresetId);
const isTransparentColor = useToolStore((s) => s.isTransparentColor);
@@ -274,6 +276,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
setPickerOpen(false);
};
const onKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') setPickerOpen(false);
};
window.addEventListener('mousedown', onOutside);
@@ -290,21 +293,29 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
);
const activeBrushName = useMemo(() => {
- if (isEraser) return 'Eraser';
- if (brushSettings.brushName?.trim()) return brushSettings.brushName.trim();
+ if (isEraser) return t('Eraser');
+ if (brushSettings.brushName?.trim()) return td(brushSettings.brushName.trim(), 'brushName');
const builtin = ALL_BUILTIN_BRUSHES.find((b) => b.id === normalizedPresetId);
- if (builtin) return builtin.name;
+ if (builtin) return td(builtin.name, 'brushName');
const custom = customBrushes.find((b) => b.id === normalizedPresetId);
if (custom) return custom.name;
- return String(normalizedPresetId || 'Brush');
- }, [brushSettings.brushName, customBrushes, isEraser, normalizedPresetId]);
+ return td(String(normalizedPresetId || 'Brush'));
+ }, [brushSettings.brushName, customBrushes, isEraser, normalizedPresetId, t, td]);
const filteredBrushes = useMemo(() => {
const q = searchQuery.trim().toLowerCase();
const items: Array<{ id: string; name: string; category: string; isCustom?: boolean }> = [];
for (const b of ALL_BUILTIN_BRUSHES) {
if (filterCat !== 'all' && filterCat !== b.category) continue;
- if (q && !b.name.toLowerCase().includes(q) && !b.category.toLowerCase().includes(q)) continue;
+ if (
+ q &&
+ !b.name.toLowerCase().includes(q) &&
+ !td(b.name, 'brushName').toLowerCase().includes(q) &&
+ !b.category.toLowerCase().includes(q) &&
+ !td(b.category, 'brushCategory').toLowerCase().includes(q)
+ ) {
+ continue;
+ }
items.push({ id: b.id, name: b.name, category: b.category });
}
if (filterCat === 'all' || filterCat === 'custom') {
@@ -314,7 +325,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
}
}
return items;
- }, [customBrushes, filterCat, searchQuery]);
+ }, [customBrushes, filterCat, searchQuery, td]);
const handleSelectBrushPreset = useCallback(
(presetId: string) => {
@@ -341,7 +352,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
type="button"
data-testid="tool-options-brush-picker"
aria-expanded={pickerOpen}
- title={`Active Brush: ${activeBrushName} — Click to switch preset`}
+ title={t('Active Brush: {name} — Click to switch preset', { name: activeBrushName })}
onClick={() => {
setPickerOpen((prev) => {
if (!prev) {
@@ -386,8 +397,8 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
- placeholder="Search brushes..."
- aria-label="Search brush presets"
+ placeholder={t('Search brushes...')}
+ aria-label={t('Search brush presets')}
className="w-full h-6 pl-6 pr-2 rounded-ui-xs bg-ui-input border border-ui-subtle text-[10.5px] text-ui-primary"
/>
</div>
@@ -404,14 +415,16 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
: 'text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {cat.label}
+ {t(cat.label)}
</button>
))}
</div>
<div className="max-h-56 overflow-y-auto space-y-0.5 pr-0.5">
{filteredBrushes.length === 0 ? (
- <div className="py-3 text-center text-[10px] text-ui-muted">No matching brushes</div>
+ <div className="py-3 text-center text-[10px] text-ui-muted">
+ {t('No matching brushes')}
+ </div>
) : (
filteredBrushes.map((item) => {
const isCurrent = !isEraser && item.id === normalizedPresetId;
@@ -426,9 +439,9 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
: 'text-ui-secondary hover:bg-ui-control-hover hover:text-ui-primary'
}`}
>
- <span className="truncate">{item.name}</span>
+ <span className="truncate">{item.isCustom ? item.name : td(item.name, 'brushName')}</span>
<span className="text-[9px] uppercase font-ui-mono text-ui-muted shrink-0">
- {item.isCustom ? 'Custom' : item.category}
+ {item.isCustom ? t('Custom') : td(item.category, 'brushCategory')}
</span>
</button>
);
@@ -444,9 +457,9 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<>
<BarDivider />
<label className="flex items-center gap-1 shrink-0">
- <span className="text-[10px] text-ui-muted">Mode</span>
+ <span className="text-[10px] text-ui-muted">{t('Mode')}</span>
<select
- aria-label="Brush Blend Mode"
+ aria-label={t('Brush Blend Mode')}
data-testid="tool-options-blend-mode"
value={combineMode}
onChange={(e) =>
@@ -458,7 +471,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
>
{BRUSH_COMBINE_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {tc('blendMode', opt.label)}
</option>
))}
</select>
@@ -472,7 +485,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<div className="w-[118px] shrink-0">
<ScrubSlider
data-testid="tool-options-size-slider"
- label="Size"
+ label={t('Size')}
size="xs"
variant="size"
logarithmic
@@ -491,7 +504,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<div className="w-[104px] shrink-0">
<ScrubSlider
data-testid="tool-options-opacity-slider"
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -508,7 +521,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<div className="w-[96px] shrink-0">
<ScrubSlider
data-testid="tool-options-flow-slider"
- label="Flow"
+ label={t('Flow')}
size="xs"
variant="opacity"
min={1}
@@ -527,7 +540,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<div className="w-[92px] shrink-0">
<ScrubSlider
data-testid="tool-options-stab-slider"
- label="Stab"
+ label={t('Stab')}
size="xs"
min={0}
max={100}
@@ -544,8 +557,8 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<ToggleChip
data-testid="tool-options-pressure-toggle"
active={Boolean(brushSettings.usePressure)}
- label="Pressure"
- title="Toggle Stylus Pressure Sensitivity"
+ label={t('Pressure')}
+ title={t('Toggle Stylus Pressure Sensitivity')}
onClick={() =>
toolStoreActions.updateBrushSettings({ usePressure: !brushSettings.usePressure })
}
@@ -554,8 +567,8 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<ToggleChip
data-testid="tool-options-smoothing-toggle"
active={Boolean(brushSettings.smoothing)}
- label="Smooth"
- title="Toggle Bézier Stroke Smoothing"
+ label={t('Smooth')}
+ title={t('Toggle Bézier Stroke Smoothing')}
onClick={() =>
toolStoreActions.updateBrushSettings({ smoothing: !brushSettings.smoothing })
}
@@ -565,8 +578,8 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<ToggleChip
data-testid="tool-options-transparent-toggle"
active={isTransparentColor}
- label="Erase Ink"
- title="Paint with Transparent Ink (C)"
+ label={t('Erase Ink')}
+ title={t('Paint with Transparent Ink (C)')}
onClick={() => toolStoreActions.toggleTransparentColor()}
/>
)}
@@ -578,8 +591,8 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
<ActionChip
data-testid="tool-options-brush-studio-btn"
icon={<Sliders className="w-3 h-3 text-ui-accent" />}
- label="Brush Studio"
- title="Open Full Brush Studio"
+ label={t('Brush Studio')}
+ title={t('Open Full Brush Studio')}
onClick={() => uiStoreActions.setBrushStudioModalOpen(true)}
/>
</>
@@ -590,6 +603,7 @@ const BrushOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool })
BrushOptionsSegment.displayName = 'BrushOptionsSegment';
const FillOptionsSegment: React.FC = React.memo(() => {
+ const { t, tc } = useI18n();
const fillSettings = useToolStore((s) => s.fillSettings);
const isTransparentColor = useToolStore((s) => s.isTransparentColor);
const method = fillSettings.method ?? 'refer-all';
@@ -597,9 +611,9 @@ const FillOptionsSegment: React.FC = React.memo(() => {
return (
<>
- <ToolLabelBadge icon={<PaintBucket className="w-3 h-3" />} label="Fill" />
+ <ToolLabelBadge icon={<PaintBucket className="w-3 h-3" />} label={t('Fill')} />
<select
- aria-label="Fill Method"
+ aria-label={t('Fill Method')}
data-testid="tool-options-fill-method"
value={method}
onChange={(e) => toolStoreActions.updateFillSettings({ method: e.target.value as FillMethod })}
@@ -607,7 +621,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
>
{FILL_METHOD_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
@@ -617,7 +631,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
{method === 'paint-unfilled' && (
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Size"
+ label={t('Size')}
size="xs"
variant="size"
logarithmic
@@ -634,7 +648,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
<div className="w-[102px] shrink-0">
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -651,7 +665,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
<>
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Tol"
+ label={t('Tol')}
size="xs"
min={0}
max={100}
@@ -664,7 +678,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
<div className="w-[96px] shrink-0">
<ScrubSlider
- label="Gap"
+ label={t('Gap')}
size="xs"
min={0}
max={isSmart ? 40 : 20}
@@ -680,7 +694,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
<div className="w-[98px] shrink-0">
<ScrubSlider
- label="Scale"
+ label={tc('fill', 'Scale')}
size="xs"
min={-20}
max={20}
@@ -702,7 +716,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
<ToggleChip
active={fillSettings.antiAlias ?? true}
- label="Anti-Alias"
+ label={t('Anti-Alias')}
onClick={() =>
toolStoreActions.updateFillSettings({ antiAlias: !(fillSettings.antiAlias ?? true) })
}
@@ -711,7 +725,7 @@ const FillOptionsSegment: React.FC = React.memo(() => {
{(method === 'lasso' || method === 'enclose-and-fill') && (
<ToggleChip
active={isTransparentColor}
- label="Erase"
+ label={t('Erase')}
onClick={() => toolStoreActions.toggleTransparentColor()}
/>
)}
@@ -736,6 +750,7 @@ const SelectionOptionsSegment: React.FC<{
onExpandSelection,
onFeatherSelection,
}) => {
+ const { t } = useI18n();
const wandSettings = useToolStore((s) => s.wandSettings);
const brushSize = useToolStore((s) => s.brushSettings.size);
@@ -749,7 +764,7 @@ const SelectionOptionsSegment: React.FC<{
return (
<>
- <ToolLabelBadge icon={<SquareDashed className="w-3 h-3" />} label="Select" />
+ <ToolLabelBadge icon={<SquareDashed className="w-3 h-3" />} label={t('Select')} />
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle rounded-ui-xs p-0.5 shrink-0">
{subTools.map((st) => (
<button
@@ -762,7 +777,7 @@ const SelectionOptionsSegment: React.FC<{
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {st.label}
+ {t(st.label)}
</button>
))}
</div>
@@ -772,7 +787,7 @@ const SelectionOptionsSegment: React.FC<{
<BarDivider />
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Tol"
+ label={t('Tol')}
size="xs"
min={0}
max={100}
@@ -784,21 +799,21 @@ const SelectionOptionsSegment: React.FC<{
</div>
<ToggleChip
active={wandSettings.contiguous}
- label="Contiguous"
+ label={t('Contiguous')}
onClick={() =>
toolStoreActions.updateWandSettings({ contiguous: !wandSettings.contiguous })
}
/>
<ToggleChip
active={wandSettings.antiAlias}
- label="Anti-Alias"
+ label={t('Anti-Alias')}
onClick={() =>
toolStoreActions.updateWandSettings({ antiAlias: !wandSettings.antiAlias })
}
/>
<ToggleChip
active={wandSettings.referMode === 'all'}
- label={wandSettings.referMode === 'all' ? 'Refer: All' : 'Refer: Active'}
+ label={wandSettings.referMode === 'all' ? t('Refer: All') : t('Refer: Active')}
onClick={() =>
toolStoreActions.updateWandSettings({
referMode: wandSettings.referMode === 'all' ? 'active' : 'all',
@@ -813,7 +828,7 @@ const SelectionOptionsSegment: React.FC<{
<BarDivider />
<div className="w-[114px] shrink-0">
<ScrubSlider
- label="Size"
+ label={t('Size')}
size="xs"
variant="size"
logarithmic
@@ -832,22 +847,22 @@ const SelectionOptionsSegment: React.FC<{
<BarDivider />
<ActionChip
icon={<Scaling className="w-3 h-3" />}
- label="Transform"
- title="Transform Selection (Ctrl+T)"
+ label={t('Transform')}
+ title={t('Transform Selection (Ctrl+T)')}
onClick={onTransformSelection}
/>
- <ActionChip label="Invert" title="Invert Selection" onClick={onInvertSelection} />
+ <ActionChip label={t('Invert')} title={t('Invert Selection')} onClick={onInvertSelection} />
<ActionChip
- label="Expand +5px"
- title="Expand Selection by 5px"
+ label={t('Expand +5px')}
+ title={t('Expand Selection by 5px')}
onClick={onExpandSelection ? () => onExpandSelection(5) : undefined}
/>
<ActionChip
- label="Feather"
- title="Feather Selection (5px)"
+ label={t('Feather')}
+ title={t('Feather Selection (5px)')}
onClick={onFeatherSelection ? () => onFeatherSelection(5) : undefined}
/>
- <ActionChip label="Deselect" title="Deselect (Ctrl+D)" onClick={onDeselect} />
+ <ActionChip label={t('Deselect')} title={t('Deselect (Ctrl+D)')} onClick={onDeselect} />
</>
);
}
@@ -855,11 +870,12 @@ const SelectionOptionsSegment: React.FC<{
SelectionOptionsSegment.displayName = 'SelectionOptionsSegment';
const GradientOptionsSegment: React.FC = React.memo(() => {
+ const { t, tc } = useI18n();
const gs = useToolStore((s) => s.gradientSettings);
return (
<>
- <ToolLabelBadge icon={<Sparkles className="w-3 h-3" />} label="Gradient" />
+ <ToolLabelBadge icon={<Sparkles className="w-3 h-3" />} label={t('Gradient')} />
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle rounded-ui-xs p-0.5 shrink-0">
{(['linear', 'radial', 'mesh'] as GradientType[]).map((gt) => (
<button
@@ -872,7 +888,7 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {gt}
+ {tc('gradientType', gt)}
</button>
))}
</div>
@@ -881,7 +897,7 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -897,7 +913,7 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
{gs.type !== 'mesh' && (
<>
<select
- aria-label="Gradient Repeat"
+ aria-label={t('Gradient Repeat')}
value={gs.repeat}
onChange={(e) =>
toolStoreActions.updateGradientSettings({
@@ -906,13 +922,13 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
}
className={compactSelectClass}
>
- <option value="none">Clamp</option>
- <option value="repeat">Repeat</option>
- <option value="mirror">Mirror</option>
+ <option value="none">{t('Clamp')}</option>
+ <option value="repeat">{t('Repeat')}</option>
+ <option value="mirror">{t('Mirror')}</option>
</select>
<select
- aria-label="Gradient Blend Mode"
+ aria-label={t('Gradient Blend Mode')}
value={gs.blendMode}
onChange={(e) =>
toolStoreActions.updateGradientSettings({
@@ -921,17 +937,17 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
}
className={compactSelectClass}
>
- <option value="normal">Normal</option>
- <option value="multiply">Multiply</option>
- <option value="screen">Screen</option>
- <option value="overlay">Overlay</option>
- <option value="darken">Darken</option>
- <option value="lighten">Lighten</option>
+ <option value="normal">{tc('blendMode', 'Normal')}</option>
+ <option value="multiply">{tc('blendMode', 'Multiply')}</option>
+ <option value="screen">{tc('blendMode', 'Screen')}</option>
+ <option value="overlay">{tc('blendMode', 'Overlay')}</option>
+ <option value="darken">{tc('blendMode', 'Darken')}</option>
+ <option value="lighten">{tc('blendMode', 'Lighten')}</option>
</select>
<ToggleChip
active={gs.useForegroundBackground}
- label="FG/BG"
+ label={t('FG/BG')}
onClick={() =>
toolStoreActions.updateGradientSettings({
useForegroundBackground: !gs.useForegroundBackground,
@@ -940,12 +956,12 @@ const GradientOptionsSegment: React.FC = React.memo(() => {
/>
<ToggleChip
active={gs.reverse}
- label="Reverse"
+ label={t('Reverse')}
onClick={() => toolStoreActions.updateGradientSettings({ reverse: !gs.reverse })}
/>
<ToggleChip
active={gs.dither}
- label="Dither"
+ label={t('Dither')}
onClick={() => toolStoreActions.updateGradientSettings({ dither: !gs.dither })}
/>
</>
@@ -962,43 +978,47 @@ const TransformOptionsSegment: React.FC<{
onFlipVertical?: () => void;
onResetRotation?: () => void;
}> = React.memo(
- ({ tool, onTransformSelection, onFlipHorizontal, onFlipVertical, onResetRotation }) => (
- <>
- <ToolLabelBadge
- icon={<Scaling className="w-3 h-3" />}
- label={tool === 'object' ? 'Object' : 'Transform'}
- />
- <ActionChip
- icon={<Scaling className="w-3 h-3 text-ui-accent" />}
- label="Free Transform"
- title="Start Free Transform (Ctrl+T)"
- onClick={onTransformSelection}
- />
- <BarDivider />
- <ActionChip
- icon={<FlipHorizontal className="w-3 h-3" />}
- label="Flip View H"
- onClick={onFlipHorizontal}
- />
- <ActionChip
- icon={<FlipVertical className="w-3 h-3" />}
- label="Flip View V"
- onClick={onFlipVertical}
- />
- <ActionChip
- icon={<RotateCcw className="w-3 h-3" />}
- label="Reset Angle"
- onClick={onResetRotation}
- />
- <span className="text-[10px] text-ui-muted pl-1">
- Shift: keep aspect · Enter: apply · Esc: cancel
- </span>
- </>
- )
+ ({ tool, onTransformSelection, onFlipHorizontal, onFlipVertical, onResetRotation }) => {
+ const { t } = useI18n();
+ return (
+ <>
+ <ToolLabelBadge
+ icon={<Scaling className="w-3 h-3" />}
+ label={tool === 'object' ? t('Object') : t('Transform')}
+ />
+ <ActionChip
+ icon={<Scaling className="w-3 h-3 text-ui-accent" />}
+ label={t('Free Transform')}
+ title={t('Start Free Transform (Ctrl+T)')}
+ onClick={onTransformSelection}
+ />
+ <BarDivider />
+ <ActionChip
+ icon={<FlipHorizontal className="w-3 h-3" />}
+ label={t('Flip View H')}
+ onClick={onFlipHorizontal}
+ />
+ <ActionChip
+ icon={<FlipVertical className="w-3 h-3" />}
+ label={t('Flip View V')}
+ onClick={onFlipVertical}
+ />
+ <ActionChip
+ icon={<RotateCcw className="w-3 h-3" />}
+ label={t('Reset Angle')}
+ onClick={onResetRotation}
+ />
+ <span className="text-[10px] text-ui-muted pl-1">
+ {t('Shift: keep aspect · Enter: apply · Esc: cancel')}
+ </span>
+ </>
+ );
+ }
);
TransformOptionsSegment.displayName = 'TransformOptionsSegment';
const TextOptionsSegment: React.FC = React.memo(() => {
+ const { t } = useI18n();
const ts = useToolStore((s) => s.textSettings);
const [systemFonts, setSystemFonts] = useState<string[]>([]);
const fontOptions = useMemo(
@@ -1015,9 +1035,9 @@ const TextOptionsSegment: React.FC = React.memo(() => {
return (
<>
- <ToolLabelBadge icon={<Type className="w-3 h-3" />} label="Text" />
+ <ToolLabelBadge icon={<Type className="w-3 h-3" />} label={t('Text')} />
<select
- aria-label="Font Family"
+ aria-label={t('Font Family')}
value={ts.fontFamily}
onFocus={handleLoadSystemFonts}
onChange={(e) => toolStoreActions.updateTextSettings({ fontFamily: e.target.value })}
@@ -1033,7 +1053,7 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Size"
+ label={t('Size')}
size="xs"
min={6}
max={400}
@@ -1046,12 +1066,12 @@ const TextOptionsSegment: React.FC = React.memo(() => {
</div>
<label
- title={`Text Color (${ts.color || '#ffffff'})`}
+ title={t('Text Color ({color})', { color: ts.color || '#ffffff' })}
className="w-[22px] h-[22px] rounded-ui-xs border border-ui-subtle hover:border-ui-strong bg-ui-input flex items-center justify-center cursor-pointer shrink-0 overflow-hidden"
>
<input
type="color"
- aria-label="Text Color"
+ aria-label={t('Text Color')}
value={ts.color || '#ffffff'}
onChange={(e) => toolStoreActions.updateTextSettings({ color: e.target.value })}
className="w-6 h-6 p-0 border-0 bg-transparent cursor-pointer"
@@ -1060,7 +1080,7 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<div className="w-[92px] shrink-0">
<ScrubSlider
- label="Lead"
+ label={t('Lead')}
size="xs"
min={0.7}
max={3.0}
@@ -1073,7 +1093,7 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<div className="w-[92px] shrink-0">
<ScrubSlider
- label="Track"
+ label={t('Track')}
size="xs"
min={-10}
max={40}
@@ -1090,21 +1110,21 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<ToggleChip
active={ts.bold}
label=""
- title="Bold (Ctrl+B)"
+ title={t('Bold (Ctrl+B)')}
icon={<Bold className="w-3 h-3" />}
onClick={() => toolStoreActions.updateTextSettings({ bold: !ts.bold })}
/>
<ToggleChip
active={ts.italic}
label=""
- title="Italic (Ctrl+I)"
+ title={t('Italic (Ctrl+I)')}
icon={<Italic className="w-3 h-3" />}
onClick={() => toolStoreActions.updateTextSettings({ italic: !ts.italic })}
/>
<ToggleChip
active={Boolean(ts.underline)}
label=""
- title="Underline (Ctrl+U)"
+ title={t('Underline (Ctrl+U)')}
icon={<Underline className="w-3 h-3" />}
onClick={() => toolStoreActions.updateTextSettings({ underline: !ts.underline })}
/>
@@ -1112,15 +1132,15 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle rounded-ui-xs p-0.5 shrink-0">
{(
[
- { id: 'left', icon: <AlignLeft className="w-3 h-3" /> },
- { id: 'center', icon: <AlignCenter className="w-3 h-3" /> },
- { id: 'right', icon: <AlignRight className="w-3 h-3" /> },
+ { id: 'left', title: 'Align left', icon: <AlignLeft className="w-3 h-3" /> },
+ { id: 'center', title: 'Align center', icon: <AlignCenter className="w-3 h-3" /> },
+ { id: 'right', title: 'Align right', icon: <AlignRight className="w-3 h-3" /> },
] as const
).map((a) => (
<button
key={a.id}
type="button"
- title={`Align ${a.id}`}
+ title={t(a.title)}
onClick={() => toolStoreActions.updateTextSettings({ align: a.id })}
className={`w-5 h-[18px] rounded-[2px] flex items-center justify-center cursor-pointer transition-colors ${
ts.align === a.id
@@ -1135,8 +1155,8 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<ToggleChip
active={ts.writingMode === 'vertical-rl'}
- label={ts.writingMode === 'vertical-rl' ? 'Vert' : 'Horiz'}
- title="Toggle Horizontal / Vertical Writing Mode"
+ label={ts.writingMode === 'vertical-rl' ? t('Vert') : t('Horiz')}
+ title={t('Toggle Horizontal / Vertical Writing Mode')}
onClick={() =>
toolStoreActions.updateTextSettings({
writingMode: ts.writingMode === 'vertical-rl' ? 'horizontal-tb' : 'vertical-rl',
@@ -1148,14 +1168,14 @@ const TextOptionsSegment: React.FC = React.memo(() => {
<ToggleChip
active={ts.outline}
- label="Outline"
+ label={t('Outline')}
onClick={() => toolStoreActions.updateTextSettings({ outline: !ts.outline })}
/>
{ts.outline && (
<>
<div className="w-[88px] shrink-0">
<ScrubSlider
- label="Width"
+ label={t('Width')}
size="xs"
min={1}
max={24}
@@ -1167,12 +1187,12 @@ const TextOptionsSegment: React.FC = React.memo(() => {
/>
</div>
<label
- title={`Outline Color (${ts.outlineColor || '#000000'})`}
+ title={t('Outline Color ({color})', { color: ts.outlineColor || '#000000' })}
className="w-[22px] h-[22px] rounded-ui-xs border border-ui-subtle hover:border-ui-strong bg-ui-input flex items-center justify-center cursor-pointer shrink-0 overflow-hidden"
>
<input
type="color"
- aria-label="Outline Color"
+ aria-label={t('Outline Color')}
value={ts.outlineColor || '#000000'}
onChange={(e) => toolStoreActions.updateTextSettings({ outlineColor: e.target.value })}
className="w-6 h-6 p-0 border-0 bg-transparent cursor-pointer"
@@ -1182,8 +1202,8 @@ const TextOptionsSegment: React.FC = React.memo(() => {
)}
<ActionChip
- label="Reset"
- title="Reset to plain white text without outline"
+ label={t('Reset')}
+ title={t('Reset to plain white text without outline')}
icon={<RotateCcw className="w-3 h-3" />}
onClick={() => toolStoreActions.resetTextSettings()}
/>
@@ -1193,6 +1213,7 @@ const TextOptionsSegment: React.FC = React.memo(() => {
TextOptionsSegment.displayName = 'TextOptionsSegment';
const Scene3DOptionsSegment: React.FC = React.memo(() => {
+ const { t } = useI18n();
const activeMode = use3DStore((s) => s.activeMode);
const gizmoMode = use3DStore((s) => s.gizmoMode);
const gizmoSpace = use3DStore((s) => s.gizmoSpace);
@@ -1206,19 +1227,19 @@ const Scene3DOptionsSegment: React.FC = React.memo(() => {
return (
<>
- <ToolLabelBadge icon={<Box className="w-3 h-3" />} label="3D Stage" />
+ <ToolLabelBadge icon={<Box className="w-3 h-3" />} label={t('3D Stage')} />
<select
- aria-label="3D Tool Mode"
+ aria-label={t('3D Tool Mode')}
value={activeMode}
onChange={(e) => store3DActions.setActiveMode(e.target.value as Tool3DMode)}
className={compactSelectClass}
>
- <option value="smart">Smart</option>
- <option value="camera-orbit">Camera Orbit</option>
- <option value="camera-pan">Camera Pan</option>
- <option value="model-rotate">Model Rotate</option>
- <option value="model-move">Model Move</option>
- <option value="model-scale">Model Scale</option>
+ <option value="smart">{t('Smart')}</option>
+ <option value="camera-orbit">{t('Camera Orbit')}</option>
+ <option value="camera-pan">{t('Camera Pan')}</option>
+ <option value="model-rotate">{t('Model Rotate')}</option>
+ <option value="model-move">{t('Model Move')}</option>
+ <option value="model-scale">{t('Model Scale')}</option>
</select>
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle rounded-ui-xs p-0.5 shrink-0">
@@ -1239,36 +1260,36 @@ const Scene3DOptionsSegment: React.FC = React.memo(() => {
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {g.label}
+ {t(g.label)}
</button>
))}
</div>
<ToggleChip
active={gizmoSpace === 'world'}
- label={gizmoSpace === 'world' ? 'World' : 'Local'}
- title="Toggle Gizmo Coordinate Space"
+ label={gizmoSpace === 'world' ? t('World') : t('Local')}
+ title={t('Toggle Gizmo Coordinate Space')}
onClick={() => store3DActions.setGizmoSpace(gizmoSpace === 'world' ? 'local' : 'world')}
/>
<BarDivider />
<select
- aria-label="3D Shading"
+ aria-label={t('3D Shading')}
value={shadingMode}
onChange={(e) => store3DActions.setShadingMode(e.target.value as Shading3DMode)}
className={compactSelectClass}
>
- <option value="shaded">Shaded</option>
- <option value="smooth">Smooth</option>
- <option value="toon">Toon</option>
- <option value="wireframe">Wireframe</option>
- <option value="silhouette">Silhouette</option>
+ <option value="shaded">{t('Shaded')}</option>
+ <option value="smooth">{t('Smooth')}</option>
+ <option value="toon">{t('Toon')}</option>
+ <option value="wireframe">{t('Wireframe')}</option>
+ <option value="silhouette">{t('Silhouette')}</option>
</select>
<div className="w-[96px] shrink-0">
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={10}
@@ -1283,7 +1304,7 @@ const Scene3DOptionsSegment: React.FC = React.memo(() => {
<div className="w-[86px] shrink-0">
<ScrubSlider
- label="FOV"
+ label={t('FOV')}
size="xs"
min={18}
max={95}
@@ -1300,23 +1321,23 @@ const Scene3DOptionsSegment: React.FC = React.memo(() => {
<ToggleChip
active={snapEnabled}
icon={<Magnet className="w-3 h-3" />}
- label="Snap"
+ label={t('Snap')}
onClick={() => store3DActions.setSnapEnabled(!snapEnabled)}
/>
<ToggleChip
active={showGrid}
icon={<Grid3x3 className="w-3 h-3" />}
- label="Grid"
+ label={t('Grid')}
onClick={() => store3DActions.setShowGrid(!showGrid)}
/>
<ToggleChip
active={toonOutline}
- label="Outline"
+ label={t('Outline')}
onClick={() => store3DActions.setToonOutline(!toonOutline)}
/>
<ToggleChip
active={isReferenceVisible}
- label="Visible"
+ label={t('Visible')}
onClick={() => store3DActions.toggleReferenceVisible()}
/>
</>
@@ -1325,19 +1346,20 @@ const Scene3DOptionsSegment: React.FC = React.memo(() => {
Scene3DOptionsSegment.displayName = 'Scene3DOptionsSegment';
const ShapeOptionsSegment: React.FC = React.memo(() => {
+ const { t, tc } = useI18n();
const ss = useToolStore((s) => s.shapeSettings);
return (
<>
- <ToolLabelBadge icon={<Shapes className="w-3 h-3" />} label="Shape" />
+ <ToolLabelBadge icon={<Shapes className="w-3 h-3" />} label={t('Shape')} />
<select
- aria-label="Shape Type"
+ aria-label={t('Shape Type')}
value={ss.shape}
onChange={(e) => toolStoreActions.updateShapeSettings({ shape: e.target.value as ShapeKind })}
className={compactSelectClass}
>
{SHAPE_KIND_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
@@ -1353,14 +1375,14 @@ const ShapeOptionsSegment: React.FC = React.memo(() => {
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {m}
+ {tc('shapeDrawMode', m)}
</button>
))}
</div>
<BarDivider />
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Stroke"
+ label={tc('layerStyle', 'Stroke')}
size="xs"
min={1}
max={100}
@@ -1373,7 +1395,7 @@ const ShapeOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -1387,7 +1409,7 @@ const ShapeOptionsSegment: React.FC = React.memo(() => {
</div>
<ToggleChip
active={ss.antiAlias}
- label="Anti-Alias"
+ label={t('Anti-Alias')}
onClick={() => toolStoreActions.updateShapeSettings({ antiAlias: !ss.antiAlias })}
/>
</>
@@ -1396,10 +1418,11 @@ const ShapeOptionsSegment: React.FC = React.memo(() => {
ShapeOptionsSegment.displayName = 'ShapeOptionsSegment';
const PenOptionsSegment: React.FC = React.memo(() => {
+ const { t, tc } = useI18n();
const ps = useToolStore((s) => s.penSettings);
return (
<>
- <ToolLabelBadge icon={<PenTool className="w-3 h-3" />} label="Pen" />
+ <ToolLabelBadge icon={<PenTool className="w-3 h-3" />} label={t('Pen')} />
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle rounded-ui-xs p-0.5 shrink-0">
{(['draw', 'edit'] as PenToolMode[]).map((m) => (
<button
@@ -1412,14 +1435,14 @@ const PenOptionsSegment: React.FC = React.memo(() => {
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {m}
+ {tc('penMode', m)}
</button>
))}
</div>
<BarDivider />
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Width"
+ label={t('Width')}
size="xs"
min={1}
max={80}
@@ -1432,7 +1455,7 @@ const PenOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -1446,12 +1469,12 @@ const PenOptionsSegment: React.FC = React.memo(() => {
</div>
<ToggleChip
active={ps.strokeEnabled}
- label="Stroke"
+ label={tc('layerStyle', 'Stroke')}
onClick={() => toolStoreActions.updatePenSettings({ strokeEnabled: !ps.strokeEnabled })}
/>
<ToggleChip
active={ps.fillEnabled}
- label="Fill"
+ label={t('Fill')}
onClick={() => toolStoreActions.updatePenSettings({ fillEnabled: !ps.fillEnabled })}
/>
</>
@@ -1460,26 +1483,27 @@ const PenOptionsSegment: React.FC = React.memo(() => {
PenOptionsSegment.displayName = 'PenOptionsSegment';
const LiquifyOptionsSegment: React.FC = React.memo(() => {
+ const { t } = useI18n();
const ls = useToolStore((s) => s.liquifySettings);
return (
<>
- <ToolLabelBadge icon={<Waves className="w-3 h-3" />} label="Liquify" />
+ <ToolLabelBadge icon={<Waves className="w-3 h-3" />} label={t('Liquify')} />
<select
- aria-label="Liquify Mode"
+ aria-label={t('Liquify Mode')}
value={ls.mode}
onChange={(e) => toolStoreActions.updateLiquifySettings({ mode: e.target.value as LiquifyMode })}
className={compactSelectClass}
>
{LIQUIFY_MODE_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
<BarDivider />
<div className="w-[108px] shrink-0">
<ScrubSlider
- label="Size"
+ label={t('Size')}
size="xs"
variant="size"
logarithmic
@@ -1494,7 +1518,7 @@ const LiquifyOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Strength"
+ label={t('Strength')}
size="xs"
min={1}
max={100}
@@ -1507,7 +1531,7 @@ const LiquifyOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Hardness"
+ label={t('Hardness')}
size="xs"
min={0}
max={100}
@@ -1520,7 +1544,7 @@ const LiquifyOptionsSegment: React.FC = React.memo(() => {
</div>
<ToggleChip
active={Boolean(ls.multiLayer)}
- label="Multi-Layer"
+ label={t('Multi-Layer')}
onClick={() => toolStoreActions.updateLiquifySettings({ multiLayer: !ls.multiLayer })}
/>
</>
@@ -1529,26 +1553,27 @@ const LiquifyOptionsSegment: React.FC = React.memo(() => {
LiquifyOptionsSegment.displayName = 'LiquifyOptionsSegment';
const RetouchOptionsSegment: React.FC = React.memo(() => {
+ const { t } = useI18n();
const rs = useToolStore((s) => s.retouchSettings);
return (
<>
- <ToolLabelBadge icon={<Sparkles className="w-3 h-3" />} label="Retouch" />
+ <ToolLabelBadge icon={<Sparkles className="w-3 h-3" />} label={t('Retouch')} />
<select
- aria-label="Retouch Mode"
+ aria-label={t('Retouch Mode')}
value={rs.mode}
onChange={(e) => toolStoreActions.updateRetouchSettings({ mode: e.target.value as RetouchMode })}
className={compactSelectClass}
>
{RETOUCH_MODE_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
- {opt.label}
+ {t(opt.label)}
</option>
))}
</select>
<BarDivider />
<div className="w-[106px] shrink-0">
<ScrubSlider
- label="Size"
+ label={t('Size')}
size="xs"
variant="size"
logarithmic
@@ -1563,7 +1588,7 @@ const RetouchOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Strength"
+ label={t('Strength')}
size="xs"
min={1}
max={100}
@@ -1576,7 +1601,7 @@ const RetouchOptionsSegment: React.FC = React.memo(() => {
</div>
<div className="w-[100px] shrink-0">
<ScrubSlider
- label="Hardness"
+ label={t('Hardness')}
size="xs"
min={0}
max={100}
@@ -1589,7 +1614,7 @@ const RetouchOptionsSegment: React.FC = React.memo(() => {
</div>
<ToggleChip
active={rs.usePressure}
- label="Pressure"
+ label={t('Pressure')}
onClick={() => toolStoreActions.updateRetouchSettings({ usePressure: !rs.usePressure })}
/>
</>
@@ -1598,6 +1623,7 @@ const RetouchOptionsSegment: React.FC = React.memo(() => {
RetouchOptionsSegment.displayName = 'RetouchOptionsSegment';
const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool }) => {
+ const { t, tc } = useI18n();
const frameSettings = useToolStore((s) => s.frameSettings);
const balloonSettings = useToolStore((s) => s.balloonSettings);
const vectorEditSettings = useToolStore((s) => s.vectorEditSettings);
@@ -1605,10 +1631,10 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
if (tool === 'frame') {
return (
<>
- <ToolLabelBadge icon={<Shapes className="w-3 h-3" />} label="Frame" />
+ <ToolLabelBadge icon={<Shapes className="w-3 h-3" />} label={t('Frame')} />
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Border"
+ label={t('Border')}
size="xs"
min={1}
max={30}
@@ -1621,7 +1647,7 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
</div>
<ToggleChip
active={frameSettings.fillBackground}
- label="Fill Paper"
+ label={t('Fill Paper')}
onClick={() =>
toolStoreActions.updateFrameSettings({ fillBackground: !frameSettings.fillBackground })
}
@@ -1633,10 +1659,10 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
if (tool === 'balloon') {
return (
<>
- <ToolLabelBadge icon={<Type className="w-3 h-3" />} label="Balloon" />
+ <ToolLabelBadge icon={<Type className="w-3 h-3" />} label={t('Balloon')} />
<div className="w-[104px] shrink-0">
<ScrubSlider
- label="Stroke"
+ label={tc('layerStyle', 'Stroke')}
size="xs"
min={1}
max={20}
@@ -1649,7 +1675,7 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
</div>
<div className="w-[98px] shrink-0">
<ScrubSlider
- label="Font"
+ label={t('Font')}
size="xs"
min={10}
max={96}
@@ -1662,7 +1688,7 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
</div>
<ToggleChip
active={balloonSettings.vertical}
- label="Vertical"
+ label={t('Vertical')}
onClick={() =>
toolStoreActions.updateBalloonSettings({ vertical: !balloonSettings.vertical })
}
@@ -1674,10 +1700,10 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
if (tool === 'vector-edit') {
return (
<>
- <ToolLabelBadge icon={<Spline className="w-3 h-3" />} label="Correct Line" />
+ <ToolLabelBadge icon={<Spline className="w-3 h-3" />} label={t('Correct Line')} />
<div className="w-[106px] shrink-0">
<ScrubSlider
- label="Radius"
+ label={t('Radius')}
size="xs"
min={5}
max={160}
@@ -1694,9 +1720,11 @@ const MiscToolOptionsSegment: React.FC<{ tool: ToolType }> = React.memo(({ tool
return (
<>
- <ToolLabelBadge icon={<Pipette className="w-3 h-3" />} label="Eyedropper" />
+ <ToolLabelBadge icon={<Pipette className="w-3 h-3" />} label={t('Eyedropper')} />
<span className="text-[10.5px] text-ui-muted">
- Click or drag on canvas to sample color · Hold Alt with any brush for temporary eyedropper
+ {t(
+ 'Click or drag on canvas to sample color · Hold Alt with any brush for temporary eyedropper'
+ )}
</span>
</>
);
@@ -1714,6 +1742,7 @@ const ToolOptionsBarInner: React.FC<Omit<ToolOptionsBarProps, 'forceVisible'>> =
onFlipVertical,
onResetRotation,
}) => {
+ const { t } = useI18n();
const tool = useToolStore((s) => s.tool);
const renderToolSegment = () => {
@@ -1779,7 +1808,7 @@ const ToolOptionsBarInner: React.FC<Omit<ToolOptionsBarProps, 'forceVisible'>> =
return (
<div
role="toolbar"
- aria-label="Contextual Tool Options"
+ aria-label={t('Contextual Tool Options')}
data-testid="tool-options-bar"
data-chrome-bar="options"
data-active-tool={tool}
@@ -1791,8 +1820,8 @@ const ToolOptionsBarInner: React.FC<Omit<ToolOptionsBarProps, 'forceVisible'>> =
type="button"
data-testid="tool-options-bar-close"
onClick={() => workspaceStoreActions.setShowToolOptionsBar(false)}
- title="Hide Tool Options Bar (Window → Tool Options Bar)"
- aria-label="Hide Tool Options Bar"
+ title={t('Hide Tool Options Bar (Window → Tool Options Bar)')}
+ aria-label={t('Hide Tool Options Bar')}
className="w-5 h-5 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors shrink-0 cursor-pointer"
>
<X className="w-3 h-3" />
diff --git a/src/components/ToolPropertyInspector.tsx b/src/components/ToolPropertyInspector.tsx
index fa7f7ba..6d255bb 100644
--- a/src/components/ToolPropertyInspector.tsx
+++ b/src/components/ToolPropertyInspector.tsx
@@ -91,6 +91,7 @@ import {
formatNumericValue,
type ScrubSliderVariant,
} from './ui';
+import { useI18n } from '../i18n';
interface CompactSliderProps {
label: string;
@@ -112,12 +113,23 @@ function inferUnitFromValueLabel(valueLabel: string): string {
function inferCompactVariant(label: string): ScrubSliderVariant {
const lower = label.toLowerCase();
- if (lower.includes('opacity')) return 'opacity';
+ if (lower.includes('opacity') || label.includes('不透明度')) return 'opacity';
if (
- (lower.includes('size') || lower.includes('stroke') || lower.includes('radius') || lower.includes('width')) &&
+ (lower.includes('size') ||
+ lower.includes('stroke') ||
+ lower.includes('radius') ||
+ lower.includes('width') ||
+ label.includes('サイズ') ||
+ label.includes('線幅') ||
+ label.includes('半径') ||
+ label.includes('太さ') ||
+ label.includes('幅')) &&
!lower.includes('jitter') &&
!lower.includes('min') &&
- !lower.includes('adjust')
+ !lower.includes('adjust') &&
+ !label.includes('ジッター') &&
+ !label.includes('最小') &&
+ !label.includes('調整')
) {
return 'size';
}
@@ -226,6 +238,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onFeatherSelection,
onInvertSelection,
}) => {
+ const { t, tc, td } = useI18n();
const currentTool = useToolStore((s) => s.tool);
const brushSettings = useToolStore((s) => s.brushSettings);
const fillSettings = useToolStore((s) => s.fillSettings);
@@ -513,10 +526,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
const paintUnfilledSize = Math.max(2, Math.min(300, Math.round(fillSettings.brushSize ?? 24)));
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Fill</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Fill')}</div>
<div className="space-y-1">
<div className="text-[10px] uppercase tracking-wider text-ui-muted px-1 pb-0.5">
- Bucket Fill
+ {t('Bucket Fill')}
</div>
{(
[
@@ -535,11 +548,11 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {m.label}
+ {t(m.label)}
</button>
))}
<div className="text-[10px] uppercase tracking-wider text-ui-muted px-1 pt-1.5 pb-0.5">
- Smart Line Fill
+ {t('Smart Line Fill')}
</div>
{(
[
@@ -563,7 +576,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
key={m.id}
type="button"
- title={m.title}
+ title={t(m.title)}
onClick={() => toolStoreActions.updateFillSettings({ method: m.id })}
className={`w-full px-2 py-1 rounded-ui-sm text-left text-[11px] transition-colors cursor-pointer ${
method === m.id
@@ -571,14 +584,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {m.label}
+ {t(m.label)}
</button>
))}
</div>
{method === 'lasso' ? (
<div className="space-y-2.5 pt-1 border-t border-ui-subtle">
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round((fillSettings.opacity ?? 1) * 100)}%`}
min={1}
max={100}
@@ -589,19 +602,19 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Transparent (Erase)"
+ label={t('Transparent (Erase)')}
checked={isTransparentColor}
onChange={() => toolStoreActions.toggleTransparentColor()}
/>
<div className="text-[10px] text-ui-muted">
- Draw a closed shape on canvas to fill. Press Esc to cancel.
+ {t('Draw a closed shape on canvas to fill. Press Esc to cancel.')}
</div>
</div>
) : isSmartFill ? (
<div className="space-y-2.5 pt-1 border-t border-ui-subtle">
{method === 'paint-unfilled' && (
<CompactSlider
- label="Brush Size"
+ label={t('Brush Size')}
valueLabel={`${paintUnfilledSize}px`}
min={2}
max={300}
@@ -613,38 +626,38 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
)}
<div className="space-y-1">
- <div className="text-[10px] text-ui-muted">Refer Source</div>
+ <div className="text-[10px] text-ui-muted">{t('Refer Source')}</div>
<SegmentedControl
size="xs"
fullWidth
- aria-label="Refer Source"
+ aria-label={t('Refer Source')}
value={smartReferMode}
onChange={(id) => toolStoreActions.updateFillSettings({ smartReferMode: id })}
options={[
- { value: 'refer-reference', label: 'Reference' },
- { value: 'refer-all', label: 'All' },
- { value: 'active', label: 'Active' },
+ { value: 'refer-reference', label: t('Reference') },
+ { value: 'refer-all', label: t('All') },
+ { value: 'active', label: t('Active') },
]}
/>
</div>
{method === 'enclose-and-fill' && (
<div className="space-y-1">
- <div className="text-[10px] text-ui-muted">Target Area</div>
+ <div className="text-[10px] text-ui-muted">{t('Target Area')}</div>
<SegmentedControl
size="xs"
fullWidth
- aria-label="Target Area"
+ aria-label={t('Target Area')}
value={encloseTarget}
onChange={(id) => toolStoreActions.updateFillSettings({ encloseTarget: id })}
options={[
- { value: 'all-enclosed', label: 'All Enclosed' },
- { value: 'unfilled-only', label: 'Unfilled Only' },
+ { value: 'all-enclosed', label: t('All Enclosed') },
+ { value: 'unfilled-only', label: t('Unfilled Only') },
]}
/>
</div>
)}
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round((fillSettings.opacity ?? 1) * 100)}%`}
min={1}
max={100}
@@ -654,7 +667,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFillSettings({ opacity: v / 100 })}
/>
<CompactSlider
- label="Tolerance"
+ label={t('Tolerance')}
valueLabel={`${fillSettings.tolerance ?? 32}`}
min={0}
max={100}
@@ -663,7 +676,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFillSettings({ tolerance: v })}
/>
<CompactSlider
- label="Close Gap"
+ label={tc('fill', 'Close Gap')}
valueLabel={`${fillSettings.smartCloseGap ?? 10}px`}
min={0}
max={40}
@@ -672,7 +685,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFillSettings({ smartCloseGap: v })}
/>
<CompactSlider
- label="Area Scaling"
+ label={t('Area Scaling')}
valueLabel={`${(fillSettings.smartAreaScale ?? 1) > 0 ? '+' : ''}${fillSettings.smartAreaScale ?? 1}px`}
min={-20}
max={20}
@@ -682,7 +695,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Anti-Alias"
+ label={t('Anti-Alias')}
checked={fillSettings.antiAlias ?? true}
onChange={(checked) =>
toolStoreActions.updateFillSettings({ antiAlias: checked })
@@ -691,21 +704,21 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{method === 'enclose-and-fill' && (
<ToggleSwitch
size="xs"
- label="Transparent (Erase)"
+ label={t('Transparent (Erase)')}
checked={isTransparentColor}
onChange={() => toolStoreActions.toggleTransparentColor()}
/>
)}
<div className="text-[10px] text-ui-muted">
{method === 'enclose-and-fill'
- ? 'Lasso around line art (e.g. hair strands) to fill all closed areas inside without affecting the background. Press Esc to cancel.'
- : 'Brush over outlines and tight corners to fill only tiny enclosed unfilled pixels. Press [ / ] to resize, Esc to cancel.'}
+ ? t('Lasso around line art (e.g. hair strands) to fill all closed areas inside without affecting the background. Press Esc to cancel.')
+ : t('Brush over outlines and tight corners to fill only tiny enclosed unfilled pixels. Press [ / ] to resize, Esc to cancel.')}
</div>
</div>
) : (
<>
<CompactSlider
- label="Tolerance"
+ label={t('Tolerance')}
valueLabel={`${fillSettings.tolerance ?? 32}`}
min={0}
max={100}
@@ -714,7 +727,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFillSettings({ tolerance: v })}
/>
<CompactSlider
- label="Close Gap"
+ label={tc('fill', 'Close Gap')}
valueLabel={`${fillSettings.closeGap ?? 0}px`}
min={0}
max={20}
@@ -723,7 +736,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFillSettings({ closeGap: v })}
/>
<CompactSlider
- label="Area Scaling"
+ label={t('Area Scaling')}
valueLabel={`${(fillSettings.areaScale ?? 0) > 0 ? '+' : ''}${fillSettings.areaScale ?? 0}px`}
min={-20}
max={20}
@@ -733,7 +746,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Anti-Alias"
+ label={t('Anti-Alias')}
checked={fillSettings.antiAlias ?? true}
onChange={(checked) =>
toolStoreActions.updateFillSettings({ antiAlias: checked })
@@ -787,18 +800,18 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
return (
<div className="p-2 space-y-3 overflow-y-auto flex-1">
- <div className="px-0.5 text-[11px] font-medium text-ui-primary">Gradient</div>
+ <div className="px-0.5 text-[11px] font-medium text-ui-primary">{t('Gradient')}</div>
<SegmentedControl<GradientType>
size="xs"
fullWidth
- aria-label="Gradient Type"
+ aria-label={t('Gradient Type')}
value={gradientSettings.type}
- onChange={(t) => toolStoreActions.updateGradientSettings({ type: t })}
+ onChange={(gradType) => toolStoreActions.updateGradientSettings({ type: gradType })}
options={[
- { value: 'linear', label: 'Linear' },
- { value: 'radial', label: 'Radial' },
- { value: 'mesh', label: 'Mesh' },
+ { value: 'linear', label: t('Linear') },
+ { value: 'radial', label: t('Radial') },
+ { value: 'mesh', label: t('Mesh') },
]}
/>
@@ -830,14 +843,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-1 rounded-ui-sm text-[10px] text-left bg-ui-input border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer truncate"
>
- {preset.name}
+ {td(preset.name, 'gradientPreset')}
</button>
))}
</div>
<ToggleSwitch
size="xs"
- label="Use FG / BG"
+ label={t('Use FG / BG')}
checked={gradientSettings.useForegroundBackground}
onChange={(checked) =>
toolStoreActions.updateGradientSettings({
@@ -849,7 +862,9 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* Color Stops Editor */}
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span className="tabular-nums">Stops ({gradientSettings.stops.length})</span>
+ <span className="tabular-nums">
+ {t('Stops ({count})', { count: gradientSettings.stops.length })}
+ </span>
<button
type="button"
onClick={() => {
@@ -869,7 +884,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
- + Add
+ {t('+ Add')}
</button>
</div>
<div className="space-y-1 max-h-32 overflow-y-auto pr-0.5">
@@ -890,7 +905,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
className="w-5 h-4 bg-transparent border-0 cursor-pointer shrink-0"
/>
<ScrubSlider
- aria-label={`Stop ${idx + 1} Position`}
+ aria-label={t('Stop {n} Position', { n: idx + 1 })}
size="xs"
hideLabel
hideValue
@@ -905,10 +920,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
toolStoreActions.updateGradientSettings({ stops: next });
}}
className="flex-1 min-w-0"
- title={`Position: ${Math.round(stop.offset * 100)}%`}
+ title={t('Position: {pct}%', { pct: Math.round(stop.offset * 100) })}
/>
<PrecisionNumberInput
- aria-label={`Stop ${idx + 1} Opacity`}
+ aria-label={t('Stop {n} Opacity', { n: idx + 1 })}
size="xs"
min={0}
max={100}
@@ -923,7 +938,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
toolStoreActions.updateGradientSettings({ stops: next });
}}
className="w-14 shrink-0"
- title="Stop Opacity %"
+ title={t('Stop Opacity %')}
/>
{gradientSettings.stops.length > 2 && (
<button
@@ -934,7 +949,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
})
}
className="text-ui-muted hover:text-ui-danger px-0.5 cursor-pointer"
- title="Remove Stop"
+ title={t('Remove Stop')}
>
×
</button>
@@ -945,7 +960,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-secondary">Repeat</span>
+ <span className="text-ui-secondary">{t('Repeat')}</span>
<select
value={gradientSettings.repeat}
onChange={(e) =>
@@ -955,15 +970,15 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-0.5 text-[11px] bg-ui-input border border-ui-subtle text-ui-primary rounded-ui-sm cursor-pointer"
>
- <option value="clamp">None</option>
- <option value="repeat">Repeat</option>
- <option value="reflect">Reflect</option>
+ <option value="clamp">{t('None')}</option>
+ <option value="repeat">{t('Repeat')}</option>
+ <option value="reflect">{t('Reflect')}</option>
</select>
</div>
<ToggleSwitch
size="xs"
- label="Reverse"
+ label={t('Reverse')}
checked={gradientSettings.reverse}
onChange={(checked) =>
toolStoreActions.updateGradientSettings({ reverse: checked })
@@ -973,7 +988,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
) : (
<div className="space-y-2 pt-1 border-t border-ui-subtle">
<CompactSlider
- label="Columns"
+ label={t('Columns')}
valueLabel={`${gradientSettings.meshCols}`}
min={2}
max={6}
@@ -981,7 +996,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateGradientSettings({ meshCols: v })}
/>
<CompactSlider
- label="Rows"
+ label={t('Rows')}
valueLabel={`${gradientSettings.meshRows}`}
min={2}
max={6}
@@ -992,7 +1007,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{activeGradientMesh && (
<div className="space-y-1.5 p-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle">
<CompactSlider
- label="Rotate Mesh"
+ label={t('Rotate Mesh')}
valueLabel={`${meshRotationDeg}°`}
min={-180}
max={180}
@@ -1025,7 +1040,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="space-y-1.5 p-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle">
<div className="flex items-center justify-between text-[10px] text-ui-muted tabular-nums">
<span>
- Vertices ({selectedMeshIndices.length}/{activeGradientMesh.nodes.length})
+ {t('Vertices ({selected}/{total})', {
+ selected: selectedMeshIndices.length,
+ total: activeGradientMesh.nodes.length,
+ })}
</span>
</div>
<div className="grid grid-cols-3 gap-1">
@@ -1034,25 +1052,25 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => toolStoreActions.selectAllActiveGradientMeshNodes()}
className="py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover text-[10px] cursor-pointer"
>
- Select All
+ {t('Select All')}
</button>
<button
type="button"
onClick={() => toolStoreActions.invertActiveGradientMeshSelection()}
className="py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover text-[10px] cursor-pointer"
>
- Invert
+ {t('Invert')}
</button>
<button
type="button"
onClick={() => toolStoreActions.clearActiveGradientMeshSelection()}
className="py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover text-[10px] cursor-pointer"
>
- Clear
+ {t('Clear')}
</button>
</div>
<div className="text-[9px] text-ui-muted">
- Shift+Click or drag box to multi-select vertices
+ {t('Shift+Click or drag box to multi-select vertices')}
</div>
</div>
)}
@@ -1062,8 +1080,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="flex items-center justify-between gap-1 text-[10px]">
<span className="text-ui-secondary truncate tabular-nums">
{selectedMeshIndices.length === 1
- ? `Node #${selectedMeshIndices[0] + 1}`
- : `${selectedMeshIndices.length} Nodes${hasMixedMeshNodeColors ? ' (Mixed)' : ''}`}
+ ? t('Node #{n}', { n: selectedMeshIndices[0] + 1 })
+ : hasMixedMeshNodeColors
+ ? t('{count} Nodes (Mixed)', { count: selectedMeshIndices.length })
+ : t('{count} Nodes', { count: selectedMeshIndices.length })}
</span>
<div className="flex items-center gap-1 shrink-0">
<button
@@ -1073,10 +1093,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
color: primaryColor,
})
}
- title="Apply current foreground color to selected vertices"
+ title={t('Apply current foreground color to selected vertices')}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover text-[9px] cursor-pointer"
>
- Use FG
+ {t('Use FG')}
</button>
<input
type="color"
@@ -1091,7 +1111,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
</div>
<CompactSlider
- label={selectedMeshIndices.length > 1 ? 'Nodes Opacity' : 'Node Opacity'}
+ label={selectedMeshIndices.length > 1 ? t('Nodes Opacity') : t('Node Opacity')}
valueLabel={`${Math.round(selectedMeshAvgOpacity * 100)}%`}
min={0}
max={100}
@@ -1111,7 +1131,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => interactiveToolBridge.initGradientMesh?.()}
className="py-1 rounded-ui-sm bg-ui-control border border-ui-subtle text-ui-primary text-[10px] hover:bg-ui-control-hover cursor-pointer"
>
- {activeGradientMesh ? 'Reset Mesh' : 'Create Mesh'}
+ {activeGradientMesh ? t('Reset Mesh') : t('Create Mesh')}
</button>
{activeGradientMesh && (
<button
@@ -1119,7 +1139,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => interactiveToolBridge.applyGradientMesh?.()}
className="py-1 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-[10px] font-medium cursor-pointer"
>
- Apply (Enter)
+ {t('Apply (Enter)')}
</button>
)}
</div>
@@ -1129,7 +1149,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => interactiveToolBridge.cancelGradientMesh?.()}
className="w-full py-1 rounded-ui-sm bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover text-[10px] cursor-pointer"
>
- Cancel (Esc)
+ {t('Cancel (Esc)')}
</button>
)}
</div>
@@ -1137,7 +1157,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="space-y-2 pt-1 border-t border-ui-subtle">
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round(gradientSettings.opacity * 100)}%`}
min={5}
max={100}
@@ -1145,7 +1165,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateGradientSettings({ opacity: v / 100 })}
/>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-secondary">Blend</span>
+ <span className="text-ui-secondary">{t('Blend')}</span>
<select
value={gradientSettings.blendMode}
onChange={(e) =>
@@ -1155,10 +1175,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-0.5 text-[11px] bg-ui-input border border-ui-subtle text-ui-primary rounded-ui-sm cursor-pointer"
>
- <option value="normal">Normal</option>
- <option value="multiply">Multiply</option>
- <option value="screen">Screen</option>
- <option value="overlay">Overlay</option>
+ <option value="normal">{tc('blendMode', 'Normal')}</option>
+ <option value="multiply">{tc('blendMode', 'Multiply')}</option>
+ <option value="screen">{tc('blendMode', 'Screen')}</option>
+ <option value="overlay">{tc('blendMode', 'Overlay')}</option>
</select>
</div>
<div className="pt-1 border-t border-ui-subtle">
@@ -1174,7 +1194,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
<ToggleSwitch
size="xs"
- label="Dither"
+ label={t('Dither')}
checked={gradientSettings.dither}
onChange={(checked) =>
toolStoreActions.updateGradientSettings({ dither: checked })
@@ -1195,13 +1215,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
];
const strengthLabel =
retouchSettings.mode === 'dodge' || retouchSettings.mode === 'burn'
- ? 'Exposure'
+ ? t('Exposure')
: retouchSettings.mode === 'clone-stamp'
- ? 'Opacity'
- : 'Strength';
+ ? t('Opacity')
+ : t('Strength');
return (
<div className="p-2 space-y-3 overflow-y-auto flex-1">
- <div className="px-0.5 text-[11px] font-medium text-ui-primary">Retouch</div>
+ <div className="px-0.5 text-[11px] font-medium text-ui-primary">{t('Retouch')}</div>
<div className="space-y-0.5">
{retouchModes.map((m) => (
<button
@@ -1214,13 +1234,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {m.label}
+ {t(m.label)}
</button>
))}
</div>
<CompactSlider
- label="Size"
+ label={t('Size')}
valueLabel={`${retouchSettings.size}px`}
min={2}
max={300}
@@ -1236,7 +1256,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateRetouchSettings({ strength: v })}
/>
<CompactSlider
- label="Hardness"
+ label={t('Hardness')}
valueLabel={`${retouchSettings.hardness}%`}
min={0}
max={100}
@@ -1244,7 +1264,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateRetouchSettings({ hardness: v })}
/>
<CompactSlider
- label="Spacing"
+ label={t('Spacing')}
valueLabel={`${Math.round(retouchSettings.spacing * 100)}%`}
min={5}
max={50}
@@ -1254,7 +1274,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<ToggleSwitch
size="xs"
- label="Pressure"
+ label={t('Pressure')}
checked={retouchSettings.usePressure}
onChange={(checked) =>
toolStoreActions.updateRetouchSettings({ usePressure: checked })
@@ -1284,7 +1304,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="pt-1.5 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Finger Painting"
+ label={t('Finger Painting')}
checked={retouchSettings.smudgeFingerPainting}
onChange={(checked) =>
toolStoreActions.updateRetouchSettings({
@@ -1300,23 +1320,23 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{(retouchSettings.mode === 'dodge' || retouchSettings.mode === 'burn') && (
<div className="space-y-2 pt-1 border-t border-ui-subtle">
<div className="space-y-1">
- <div className="text-[11px] text-ui-muted">Range</div>
+ <div className="text-[11px] text-ui-muted">{t('Range')}</div>
<SegmentedControl<RetouchTonalRange>
size="xs"
fullWidth
- aria-label="Tonal Range"
+ aria-label={t('Tonal Range')}
value={retouchSettings.tonalRange}
onChange={(r) => toolStoreActions.updateRetouchSettings({ tonalRange: r })}
options={[
- { value: 'shadows', label: 'Shadows' },
- { value: 'midtones', label: 'Mid' },
- { value: 'highlights', label: 'High' },
+ { value: 'shadows', label: t('Shadows') },
+ { value: 'midtones', label: t('Mid') },
+ { value: 'highlights', label: t('High') },
]}
/>
</div>
<ToggleSwitch
size="xs"
- label="Protect Tones"
+ label={t('Protect Tones')}
checked={retouchSettings.protectTones}
onChange={(checked) =>
toolStoreActions.updateRetouchSettings({ protectTones: checked })
@@ -1336,23 +1356,28 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'bg-ui-control text-ui-primary border-ui-subtle hover:bg-ui-control-hover'
}`}
>
- {isPickingCloneSource ? 'Click Canvas to Set Origin...' : 'Pick Source (Alt+Click)'}
+ {isPickingCloneSource
+ ? t('Click Canvas to Set Origin...')
+ : t('Pick Source (Alt+Click)')}
</button>
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
{cloneSourceAnchor
- ? `Origin: ${Math.round(cloneSourceAnchor.x)}, ${Math.round(cloneSourceAnchor.y)}`
- : 'No source set'}
+ ? t('Origin: {x}, {y}', {
+ x: Math.round(cloneSourceAnchor.x),
+ y: Math.round(cloneSourceAnchor.y),
+ })
+ : t('No source set')}
</div>
<ToggleSwitch
size="xs"
- label="Aligned"
+ label={t('Aligned')}
checked={retouchSettings.cloneAligned}
onChange={(checked) =>
toolStoreActions.updateRetouchSettings({ cloneAligned: checked })
}
/>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-secondary">Sample</span>
+ <span className="text-ui-secondary">{t('Sample')}</span>
<select
value={retouchSettings.cloneSampleMode}
onChange={(e) =>
@@ -1362,8 +1387,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-0.5 text-[11px] bg-ui-input border border-ui-subtle text-ui-primary rounded-ui-sm cursor-pointer"
>
- <option value="active">Active Layer</option>
- <option value="all-visible">All Visible</option>
+ <option value="active">{t('Active Layer')}</option>
+ <option value="all-visible">{t('All Visible')}</option>
</select>
</div>
</div>
@@ -1375,22 +1400,22 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
if (currentTool === 'pen') {
return (
<div className="p-2 space-y-3 overflow-y-auto flex-1">
- <div className="px-0.5 text-[11px] font-medium text-ui-primary">Bézier Pen</div>
+ <div className="px-0.5 text-[11px] font-medium text-ui-primary">{t('Bézier Pen')}</div>
<SegmentedControl<PenToolMode>
size="xs"
fullWidth
- aria-label="Pen Mode"
+ aria-label={t('Pen Mode')}
value={penSettings.mode}
onChange={(m) => toolStoreActions.updatePenSettings({ mode: m })}
options={[
- { value: 'draw', label: 'Draw' },
- { value: 'edit', label: 'Edit Nodes' },
+ { value: 'draw', label: t('Draw') },
+ { value: 'edit', label: t('Edit Nodes') },
]}
/>
<CompactSlider
- label="Stroke Width"
+ label={t('Stroke Width')}
valueLabel={`${penSettings.strokeWidth}px`}
min={1}
max={100}
@@ -1399,7 +1424,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updatePenSettings({ strokeWidth: v })}
/>
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round(penSettings.opacity * 100)}%`}
min={5}
max={100}
@@ -1411,7 +1436,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Stroke Path"
+ label={t('Stroke Path')}
checked={penSettings.strokeEnabled}
onChange={(checked) =>
toolStoreActions.updatePenSettings({ strokeEnabled: checked })
@@ -1419,7 +1444,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Fill Closed Path"
+ label={t('Fill Closed Path')}
checked={penSettings.fillEnabled}
onChange={(checked) =>
toolStoreActions.updatePenSettings({ fillEnabled: checked })
@@ -1430,13 +1455,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl
size="xs"
fullWidth
- aria-label="Fill Color Source"
+ aria-label={t('Fill Color Source')}
value={penSettings.fillColorMode}
onChange={(m) => toolStoreActions.updatePenSettings({ fillColorMode: m })}
options={[
- { value: 'primary', label: 'Primary' },
- { value: 'secondary', label: 'Sub' },
- { value: 'custom', label: 'Custom' },
+ { value: 'primary', label: t('Primary') },
+ { value: 'secondary', label: t('Sub') },
+ { value: 'custom', label: t('Custom') },
]}
/>
{penSettings.fillColorMode === 'custom' && (
@@ -1458,7 +1483,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
)}
<ToggleSwitch
size="xs"
- label="Rubber Band"
+ label={t('Rubber Band')}
checked={penSettings.rubberBandPreview}
onChange={(checked) =>
toolStoreActions.updatePenSettings({ rubberBandPreview: checked })
@@ -1469,8 +1494,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{activePenPointCount > 0 && (
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- Path: {activePenPointCount} anchor{activePenPointCount === 1 ? '' : 's'}
- {activePenClosed ? ' (Closed)' : ''}
+ {activePenClosed
+ ? activePenPointCount === 1
+ ? t('Path: {count} anchor (Closed)', { count: activePenPointCount })
+ : t('Path: {count} anchors (Closed)', { count: activePenPointCount })
+ : activePenPointCount === 1
+ ? t('Path: {count} anchor', { count: activePenPointCount })
+ : t('Path: {count} anchors', { count: activePenPointCount })}
</div>
<div className="grid grid-cols-2 gap-1">
<button
@@ -1479,7 +1509,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
disabled={activePenPointCount < 2}
className="py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] disabled:opacity-40 cursor-pointer"
>
- {activePenClosed ? 'Open Path' : 'Close Path'}
+ {activePenClosed ? t('Open Path') : t('Close Path')}
</button>
<button
type="button"
@@ -1487,14 +1517,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
disabled={activePenSelectedAnchor === null}
className="py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] disabled:opacity-40 cursor-pointer"
>
- Smooth / Corner
+ {t('Smooth / Corner')}
</button>
<button
type="button"
onClick={() => interactiveToolBridge.deleteSelectedPenAnchor?.()}
className="py-1 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary text-[10px] cursor-pointer"
>
- Delete Node
+ {t('Delete Node')}
</button>
<button
type="button"
@@ -1502,7 +1532,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
disabled={activePenPointCount < 2}
className="py-1 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-[10px] font-medium disabled:opacity-40 cursor-pointer"
>
- Commit (Enter)
+ {t('Commit (Enter)')}
</button>
</div>
<button
@@ -1510,13 +1540,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => interactiveToolBridge.cancelPenPath?.()}
className="w-full py-1 rounded-ui-sm bg-ui-input border border-ui-subtle text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover text-[10px] cursor-pointer"
>
- Cancel (Esc)
+ {t('Cancel (Esc)')}
</button>
</div>
)}
<div className="text-[10px] text-ui-muted leading-relaxed pt-1 border-t border-ui-subtle">
- Click: corner · Drag: handles · Alt+Drag: break · Ctrl: edit nodes · Click curve in Edit: split
+ {t('Click: corner · Drag: handles · Alt+Drag: break · Ctrl: edit nodes · Click curve in Edit: split')}
</div>
</div>
);
@@ -1536,7 +1566,9 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
];
return (
<div className="p-2 space-y-3 overflow-y-auto flex-1">
- <div className="px-0.5 text-[11px] font-medium text-ui-primary">Geometric Shape</div>
+ <div className="px-0.5 text-[11px] font-medium text-ui-primary">
+ {t('Geometric Shape')}
+ </div>
<div className="grid grid-cols-2 gap-1">
{shapeOptions.map((opt) => (
@@ -1550,24 +1582,24 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {opt.label}
+ {t(opt.label)}
</button>
))}
</div>
{!openShape && (
<div className="space-y-1">
- <div className="text-[11px] text-ui-muted">Style</div>
+ <div className="text-[11px] text-ui-muted">{t('Style')}</div>
<SegmentedControl<ShapeDrawMode>
size="xs"
fullWidth
- aria-label="Shape Style"
+ aria-label={t('Shape Style')}
value={shapeSettings.mode}
onChange={(m) => toolStoreActions.updateShapeSettings({ mode: m })}
options={[
- { value: 'stroke', label: 'Stroke' },
- { value: 'fill', label: 'Fill' },
- { value: 'both', label: 'Both' },
+ { value: 'stroke', label: tc('shapeDrawMode', 'Stroke') },
+ { value: 'fill', label: t('Fill') },
+ { value: 'both', label: t('Both') },
]}
/>
</div>
@@ -1575,7 +1607,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{(openShape || shapeSettings.mode !== 'fill') && (
<CompactSlider
- label="Stroke"
+ label={tc('shapeDrawMode', 'Stroke')}
+ variant="size"
valueLabel={`${shapeSettings.strokeWidth}px`}
min={1}
max={120}
@@ -1586,7 +1619,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
)}
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round(shapeSettings.opacity * 100)}%`}
min={5}
max={100}
@@ -1597,17 +1630,17 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{!openShape && shapeSettings.mode !== 'stroke' && (
<div className="space-y-1.5">
- <div className="text-[11px] text-ui-muted">Fill Color</div>
+ <div className="text-[11px] text-ui-muted">{t('Fill Color')}</div>
<SegmentedControl<ShapeFillColorMode>
size="xs"
fullWidth
- aria-label="Shape Fill Color"
+ aria-label={t('Shape Fill Color')}
value={shapeSettings.fillColorMode}
onChange={(m) => toolStoreActions.updateShapeSettings({ fillColorMode: m })}
options={[
- { value: 'primary', label: 'Primary' },
- { value: 'secondary', label: 'Sub' },
- { value: 'custom', label: 'Custom' },
+ { value: 'primary', label: t('Primary') },
+ { value: 'secondary', label: t('Sub') },
+ { value: 'custom', label: t('Custom') },
]}
/>
{shapeSettings.fillColorMode === 'custom' && (
@@ -1630,7 +1663,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{shapeSettings.shape === 'rounded-rect' && (
<CompactSlider
- label="Corner Radius"
+ label={t('Corner Radius')}
valueLabel={`${shapeSettings.cornerRadius}px`}
min={0}
max={200}
@@ -1641,7 +1674,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{(shapeSettings.shape === 'polygon' || shapeSettings.shape === 'star') && (
<CompactSlider
- label={shapeSettings.shape === 'star' ? 'Points' : 'Sides'}
+ label={shapeSettings.shape === 'star' ? t('Points') : t('Sides')}
valueLabel={`${shapeSettings.polygonSides}`}
min={3}
max={12}
@@ -1652,7 +1685,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{shapeSettings.shape === 'star' && (
<CompactSlider
- label="Inner Ratio"
+ label={t('Inner Ratio')}
valueLabel={`${Math.round(shapeSettings.starInnerRatio * 100)}%`}
min={15}
max={85}
@@ -1665,7 +1698,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="space-y-2 pt-1 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Dashed Line"
+ label={t('Dashed Line')}
checked={shapeSettings.dashed}
onChange={(checked) =>
toolStoreActions.updateShapeSettings({ dashed: checked })
@@ -1674,7 +1707,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{shapeSettings.dashed && (
<>
<CompactSlider
- label="Dash Length"
+ label={t('Dash Length')}
valueLabel={`${shapeSettings.dashLength}px`}
min={2}
max={100}
@@ -1682,7 +1715,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateShapeSettings({ dashLength: v })}
/>
<CompactSlider
- label="Dash Gap"
+ label={t('Dash Gap')}
valueLabel={`${shapeSettings.dashGap}px`}
min={2}
max={100}
@@ -1693,7 +1726,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
)}
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-secondary">Cap</span>
+ <span className="text-ui-secondary">{t('Cap')}</span>
<select
value={shapeSettings.lineCap}
onChange={(e) =>
@@ -1703,15 +1736,15 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-0.5 text-[11px] bg-ui-input border border-ui-subtle text-ui-primary rounded-ui-sm cursor-pointer"
>
- <option value="round">Round</option>
- <option value="butt">Flat</option>
- <option value="square">Square</option>
+ <option value="round">{tc('lineCap', 'Round')}</option>
+ <option value="butt">{tc('lineCap', 'Flat')}</option>
+ <option value="square">{tc('lineCap', 'Square')}</option>
</select>
</div>
{!openShape && (
<div className="flex items-center justify-between text-[11px]">
- <span className="text-ui-secondary">Corner</span>
+ <span className="text-ui-secondary">{t('Corner')}</span>
<select
value={shapeSettings.lineJoin}
onChange={(e) =>
@@ -1721,9 +1754,9 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="px-1.5 py-0.5 text-[11px] bg-ui-input border border-ui-subtle text-ui-primary rounded-ui-sm cursor-pointer"
>
- <option value="miter">Sharp</option>
- <option value="round">Round</option>
- <option value="bevel">Bevel</option>
+ <option value="miter">{tc('lineJoin', 'Sharp')}</option>
+ <option value="round">{tc('lineJoin', 'Round')}</option>
+ <option value="bevel">{tc('lineJoin', 'Bevel')}</option>
</select>
</div>
)}
@@ -1733,7 +1766,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="space-y-1.5 pt-1 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Anti-aliasing"
+ label={t('Anti-aliasing')}
checked={shapeSettings.antiAlias}
onChange={(checked) =>
toolStoreActions.updateShapeSettings({ antiAlias: checked })
@@ -1741,8 +1774,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Constrain (Shift)"
- title="Lock 1:1 aspect ratio or 15° angle increments (or hold Shift while dragging)"
+ label={t('Constrain (Shift)')}
+ title={t('Lock 1:1 aspect ratio or 15° angle increments (or hold Shift while dragging)')}
checked={shapeSettings.constrainAspect}
onChange={(checked) =>
toolStoreActions.updateShapeSettings({ constrainAspect: checked })
@@ -1750,8 +1783,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="From Center (Alt)"
- title="Draw symmetrically from center (or hold Alt while dragging)"
+ label={t('From Center (Alt)')}
+ title={t('Draw symmetrically from center (or hold Alt while dragging)')}
checked={shapeSettings.fromCenter}
onChange={(checked) =>
toolStoreActions.updateShapeSettings({ fromCenter: checked })
@@ -1766,7 +1799,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
const activeMode = liquifySettings.mode ?? 'push';
return (
<div className="p-2 space-y-3 overflow-y-auto flex-1">
- <div className="px-0.5 text-[11px] font-medium text-ui-primary">Liquify</div>
+ <div className="px-0.5 text-[11px] font-medium text-ui-primary">{t('Liquify')}</div>
<div className="space-y-0.5">
{LIQUIFY_MODES.map((sub) => (
<button
@@ -1779,12 +1812,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {sub.label}
+ {t(sub.label)}
</button>
))}
</div>
<CompactSlider
- label="Size"
+ label={t('Size')}
valueLabel={`${liquifySettings.size ?? 80}px`}
min={4}
max={500}
@@ -1792,7 +1825,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateLiquifySettings({ size: v })}
/>
<CompactSlider
- label="Strength"
+ label={t('Strength')}
valueLabel={`${liquifySettings.strength ?? 50}%`}
min={1}
max={100}
@@ -1800,7 +1833,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateLiquifySettings({ strength: v })}
/>
<CompactSlider
- label="Hardness"
+ label={t('Hardness')}
valueLabel={`${liquifySettings.hardness ?? 50}%`}
min={0}
max={100}
@@ -1809,7 +1842,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Pressure"
+ label={t('Pressure')}
checked={liquifySettings.usePressure ?? true}
onChange={(checked) =>
toolStoreActions.updateLiquifySettings({ usePressure: checked })
@@ -1817,8 +1850,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Multi-layer"
- title="Apply Liquify simultaneously to all visible unlocked layers (or multi-selected layers / active folder)"
+ label={t('Multi-layer')}
+ title={t('Apply Liquify simultaneously to all visible unlocked layers (or multi-selected layers / active folder)')}
checked={liquifySettings.multiLayer ?? false}
onChange={(checked) =>
toolStoreActions.updateLiquifySettings({ multiLayer: checked })
@@ -1837,7 +1870,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
) {
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Selection</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Selection')}</div>
<div className="grid grid-cols-2 gap-1">
{(
[
@@ -1858,14 +1891,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {s.label}
+ {t(s.label)}
</button>
))}
</div>
{(currentTool === 'select-pen' || currentTool === 'select-eraser') && (
<CompactSlider
- label="Brush Size"
+ label={t('Brush Size')}
valueLabel={`${brushSettings.size}px`}
min={1}
max={250}
@@ -1877,7 +1910,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{currentTool === 'select-wand' && (
<div className="space-y-2.5 pt-1">
<CompactSlider
- label="Tolerance"
+ label={t('Tolerance')}
valueLabel={`${wandSettings.tolerance}`}
min={0}
max={255}
@@ -1886,7 +1919,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Contiguous"
+ label={t('Contiguous')}
checked={wandSettings.contiguous}
onChange={(checked) =>
toolStoreActions.updateWandSettings({ contiguous: checked })
@@ -1894,7 +1927,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Anti-Alias"
+ label={t('Anti-Alias')}
checked={wandSettings.antiAlias}
onChange={(checked) =>
toolStoreActions.updateWandSettings({ antiAlias: checked })
@@ -1903,13 +1936,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl
size="xs"
fullWidth
- aria-label="Wand Refer Mode"
+ aria-label={t('Wand Refer Mode')}
value={wandSettings.referMode}
onChange={(mode) => toolStoreActions.updateWandSettings({ referMode: mode })}
options={[
- { value: 'active', label: 'Active' },
- { value: 'all', label: 'All' },
- { value: 'reference', label: 'Ref' },
+ { value: 'active', label: t('Active') },
+ { value: 'all', label: t('All') },
+ { value: 'reference', label: t('Ref') },
]}
/>
</div>
@@ -1920,7 +1953,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
type="button"
onClick={() => onExpandSelection?.(5)}
- title="Expand 5px"
+ title={t('Expand 5px')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary flex items-center justify-center cursor-pointer"
>
<Maximize2 className="w-3 h-3" />
@@ -1928,7 +1961,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
type="button"
onClick={() => onContractSelection?.(5)}
- title="Contract 5px"
+ title={t('Contract 5px')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary flex items-center justify-center cursor-pointer"
>
<Minimize2 className="w-3 h-3" />
@@ -1936,7 +1969,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
type="button"
onClick={() => onFeatherSelection?.(5)}
- title="Feather 5px"
+ title={t('Feather 5px')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-ui-muted hover:text-ui-primary flex items-center justify-center cursor-pointer"
>
<Feather className="w-3 h-3" />
@@ -1946,57 +1979,57 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
type="button"
onClick={onCutSelection}
- title="Cut Selection (Ctrl+X)"
+ title={t('Cut Selection (Ctrl+X)')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 cursor-pointer"
>
<Scissors className="w-3 h-3" />
- <span>Cut</span>
+ <span>{t('Cut')}</span>
</button>
<button
type="button"
onClick={onCopySelection}
- title="Copy Selection (Ctrl+C)"
+ title={t('Copy Selection (Ctrl+C)')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 cursor-pointer"
>
<Copy className="w-3 h-3" />
- <span>Copy</span>
+ <span>{t('Copy')}</span>
</button>
<button
type="button"
onClick={onPasteSelection}
- title="Paste to New Layer (Ctrl+V)"
+ title={t('Paste to New Layer (Ctrl+V)')}
className="py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 cursor-pointer"
>
<ClipboardPaste className="w-3 h-3" />
- <span>Paste</span>
+ <span>{t('Paste')}</span>
</button>
</div>
<button
type="button"
onClick={onMoveSelectionToNewLayer}
- title="Move Selected Section to New Layer (Ctrl+Shift+J)"
+ title={t('Move Selected Section to New Layer (Ctrl+Shift+J)')}
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-accent hover:text-ui-primary flex items-center gap-1.5 cursor-pointer"
>
<Layers className="w-3 h-3" />
- <span>Move to New Layer</span>
+ <span>{t('Move to New Layer')}</span>
</button>
<button
type="button"
onClick={onClearSelection}
- title="Delete Selected Section (Del)"
+ title={t('Delete Selected Section (Del)')}
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-secondary hover:text-ui-danger flex items-center gap-1.5 cursor-pointer"
>
<Trash2 className="w-3 h-3" />
- <span>Delete Section</span>
+ <span>{t('Delete Section')}</span>
</button>
<button
type="button"
onClick={onDeleteOutsideSelection}
- title="Delete Outside Selected Section"
+ title={t('Delete Outside Selected Section')}
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-secondary hover:text-ui-danger flex items-center gap-1.5 cursor-pointer"
>
<Crop className="w-3 h-3" />
- <span>Delete Outside</span>
+ <span>{t('Delete Outside')}</span>
</button>
<button
type="button"
@@ -2004,7 +2037,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-secondary hover:text-ui-primary flex items-center gap-1.5 cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
- <span>Invert</span>
+ <span>{t('Invert')}</span>
</button>
<button
type="button"
@@ -2012,14 +2045,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-secondary hover:text-ui-primary flex items-center gap-1.5 cursor-pointer"
>
<Scaling className="w-3 h-3" />
- <span>Transform</span>
+ <span>{t('Transform')}</span>
</button>
<button
type="button"
onClick={onDeselect}
className="w-full py-1 px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-secondary hover:text-ui-primary cursor-pointer text-left"
>
- Deselect
+ {t('Deselect')}
</button>
</div>
</div>
@@ -2031,20 +2064,20 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
<div className="flex items-center justify-between gap-2">
- <span className="text-[11px] font-medium text-ui-primary">Text</span>
+ <span className="text-[11px] font-medium text-ui-primary">{t('Text')}</span>
<button
type="button"
onClick={() => toolStoreActions.resetTextSettings()}
- title="Reset to plain white text without outline"
+ title={t('Reset to plain white text without outline')}
className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Plain White</span>
+ <span>{t('Plain White')}</span>
</button>
</div>
<select
- aria-label="Font Family"
+ aria-label={t('Font Family')}
value={textSettings.fontFamily}
onFocus={() => {
void queryInstalledSystemFonts();
@@ -2060,7 +2093,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
className="bg-ui-elevated text-ui-primary"
style={{ fontFamily: f.value }}
>
- {f.label}
+ {td(f.label)}
</option>
))}
</select>
@@ -2068,12 +2101,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl
size="xs"
fullWidth
- aria-label="Text Orientation"
+ aria-label={t('Text Orientation')}
value={textSettings.writingMode === 'vertical-rl' ? 'vertical-rl' : 'horizontal-tb'}
onChange={(mode) => toolStoreActions.updateTextSettings({ writingMode: mode })}
options={[
- { value: 'horizontal-tb', label: 'Horizontal' },
- { value: 'vertical-rl', label: 'Vertical' },
+ { value: 'horizontal-tb', label: t('Horizontal') },
+ { value: 'vertical-rl', label: t('Vertical') },
]}
/>
@@ -2082,7 +2115,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
<button
type="button"
- title="Bold (Ctrl+B)"
+ title={t('Bold (Ctrl+B)')}
onClick={() => toolStoreActions.updateTextSettings({ bold: !textSettings.bold })}
className={`w-6 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
textSettings.bold
@@ -2094,7 +2127,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</button>
<button
type="button"
- title="Italic (Ctrl+I)"
+ title={t('Italic (Ctrl+I)')}
onClick={() =>
toolStoreActions.updateTextSettings({ italic: !textSettings.italic })
}
@@ -2108,7 +2141,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</button>
<button
type="button"
- title="Underline (Ctrl+U)"
+ title={t('Underline (Ctrl+U)')}
onClick={() =>
toolStoreActions.updateTextSettings({ underline: !textSettings.underline })
}
@@ -2125,15 +2158,15 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="flex items-center gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{(
[
- { id: 'left', icon: <AlignLeft className="w-3 h-3" /> },
- { id: 'center', icon: <AlignCenter className="w-3 h-3" /> },
- { id: 'right', icon: <AlignRight className="w-3 h-3" /> },
+ { id: 'left', title: 'Align left', icon: <AlignLeft className="w-3 h-3" /> },
+ { id: 'center', title: 'Align center', icon: <AlignCenter className="w-3 h-3" /> },
+ { id: 'right', title: 'Align right', icon: <AlignRight className="w-3 h-3" /> },
] as const
).map((a) => (
<button
key={a.id}
type="button"
- title={`Align ${a.id}`}
+ title={t(a.title)}
onClick={() => toolStoreActions.updateTextSettings({ align: a.id })}
className={`w-6 h-5 rounded-ui-xs flex items-center justify-center cursor-pointer transition-colors ${
textSettings.align === a.id
@@ -2148,7 +2181,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
<CompactSlider
- label="Font Size"
+ label={t('Font Size')}
valueLabel={`${textSettings.fontSize ?? 36}px`}
min={6}
max={400}
@@ -2156,7 +2189,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateTextSettings({ fontSize: v })}
/>
<CompactSlider
- label="Line Height"
+ label={t('Line Height')}
valueLabel={`${(textSettings.lineSpacing ?? 1.25).toFixed(2)}×`}
min={0.7}
max={3.0}
@@ -2165,7 +2198,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateTextSettings({ lineSpacing: v })}
/>
<CompactSlider
- label="Letter Spacing"
+ label={t('Letter Spacing')}
valueLabel={`${(textSettings.letterSpacing ?? 0).toFixed(1)}px`}
min={-10}
max={40}
@@ -2174,7 +2207,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateTextSettings({ letterSpacing: v })}
/>
<CompactSlider
- label="Opacity"
+ label={t('Opacity')}
valueLabel={`${Math.round((textSettings.opacity ?? 1) * 100)}%`}
min={5}
max={100}
@@ -2186,7 +2219,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* Text Color */}
<div className="space-y-1.5 pt-2 border-t border-ui-subtle">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Text Color</span>
+ <span>{t('Text Color')}</span>
<button
type="button"
onClick={() =>
@@ -2194,11 +2227,11 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
color: useToolStore.getState().primaryColor || '#ffffff',
})
}
- title="Copy current brush color"
+ title={t('Copy current brush color')}
className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer"
>
<Pipette className="w-2.5 h-2.5" />
- <span>Brush</span>
+ <span>{t('Brush')}</span>
</button>
</div>
<div className="flex items-center gap-1.5 flex-wrap">
@@ -2206,7 +2239,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
key={swatch.hex}
type="button"
- title={swatch.label}
+ title={td(swatch.label)}
onClick={() => toolStoreActions.updateTextSettings({ color: swatch.hex })}
className={`w-5 h-5 rounded-ui-xs border cursor-pointer ${
(textSettings.color || '#ffffff').toLowerCase() === swatch.hex
@@ -2218,7 +2251,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
))}
<input
type="color"
- aria-label="Custom Text Color"
+ aria-label={t('Custom Text Color')}
value={textSettings.color || '#ffffff'}
onChange={(e) => toolStoreActions.updateTextSettings({ color: e.target.value })}
className="w-6 h-5 bg-transparent cursor-pointer border border-ui-default rounded-ui-xs"
@@ -2229,7 +2262,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* Optional Outline (off by default) */}
<div className="space-y-2 pt-2 border-t border-ui-subtle">
<label className="flex items-center justify-between text-[11px] text-ui-primary cursor-pointer">
- <span>Outline</span>
+ <span>{t('Outline')}</span>
<input
type="checkbox"
checked={Boolean(textSettings.outline)}
@@ -2242,7 +2275,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{textSettings.outline && (
<div className="space-y-2">
<CompactSlider
- label="Outline Width"
+ label={t('Outline Width')}
valueLabel={`${textSettings.outlineWidth ?? 3}px`}
min={1}
max={24}
@@ -2250,10 +2283,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateTextSettings({ outlineWidth: v })}
/>
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Outline Color</span>
+ <span>{t('Outline Color')}</span>
<input
type="color"
- aria-label="Outline Color"
+ aria-label={t('Outline Color')}
value={textSettings.outlineColor || '#000000'}
onChange={(e) =>
toolStoreActions.updateTextSettings({ outlineColor: e.target.value })
@@ -2266,9 +2299,9 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
<div className="text-[10px] text-ui-muted leading-relaxed pt-2 border-t border-ui-subtle space-y-0.5">
- <div>• Click canvas to type, or drag to create a wrapped text box</div>
- <div>• Click existing text to re-edit non-destructively</div>
- <div>• Latest typography settings save automatically</div>
+ <div>{t('• Click canvas to type, or drag to create a wrapped text box')}</div>
+ <div>{t('• Click existing text to re-edit non-destructively')}</div>
+ <div>{t('• Latest typography settings save automatically')}</div>
</div>
</div>
);
@@ -2279,32 +2312,66 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="p-2.5 space-y-2.5 overflow-y-auto flex-1">
<div className="flex items-center gap-1.5 text-[11px] font-medium text-ui-primary">
<Scaling className="w-3.5 h-3.5 text-ui-accent" />
- <span>Transform &amp; Warp</span>
+ <span>{t('Transform & Warp')}</span>
</div>
<p className="text-[10px] text-ui-muted leading-relaxed">
- Use the floating transform bar on the canvas to switch between{' '}
- <span className="text-ui-primary">Free</span>,{' '}
- <span className="text-ui-primary">Perspective</span>,{' '}
- <span className="text-ui-primary">Mesh</span>,{' '}
- <span className="text-ui-primary">Puppet Warp</span>, and{' '}
- <span className="text-ui-primary">Cage Transform</span>.
+ {t('Use the floating transform bar on the canvas to switch between {free}, {perspective}, {mesh}, {puppet}, and {cage}.')
+ .split(/(\{free\}|\{perspective\}|\{mesh\}|\{puppet\}|\{cage\})/)
+ .map((part, idx) => {
+ if (part === '{free}') {
+ return (
+ <span key={idx} className="text-ui-primary">
+ {tc('transformMode', 'Free')}
+ </span>
+ );
+ }
+ if (part === '{perspective}') {
+ return (
+ <span key={idx} className="text-ui-primary">
+ {tc('transformMode', 'Perspective')}
+ </span>
+ );
+ }
+ if (part === '{mesh}') {
+ return (
+ <span key={idx} className="text-ui-primary">
+ {t('Mesh')}
+ </span>
+ );
+ }
+ if (part === '{puppet}') {
+ return (
+ <span key={idx} className="text-ui-primary">
+ {t('Puppet Warp')}
+ </span>
+ );
+ }
+ if (part === '{cage}') {
+ return (
+ <span key={idx} className="text-ui-primary">
+ {t('Cage Transform')}
+ </span>
+ );
+ }
+ return <React.Fragment key={idx}>{part}</React.Fragment>;
+ })}
</p>
<div className="space-y-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle p-2 text-[10px] text-ui-secondary">
- <div className="text-ui-primary font-medium">Puppet Warp Tips</div>
- <div>• Click artwork to place 5–6 joint pins</div>
- <div>• Drag pins to bend arms, head, or folds</div>
- <div>• Drag ring handle or Alt+Drag to tilt/rotate</div>
- <div>• Right-click or Delete removes a pin</div>
+ <div className="text-ui-primary font-medium">{t('Puppet Warp Tips')}</div>
+ <div>{t('• Click artwork to place 5–6 joint pins')}</div>
+ <div>{t('• Drag pins to bend arms, head, or folds')}</div>
+ <div>{t('• Drag ring handle or Alt+Drag to tilt/rotate')}</div>
+ <div>{t('• Right-click or Delete removes a pin')}</div>
</div>
<div className="space-y-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle p-2 text-[10px] text-ui-secondary">
- <div className="text-ui-primary font-medium">Cage Transform Tips</div>
- <div>• Drag vertices or edges to warp smoothly</div>
- <div>• Switch to Edit Cage to add/shape points</div>
- <div>• Click Redraw to outline a specific region</div>
+ <div className="text-ui-primary font-medium">{t('Cage Transform Tips')}</div>
+ <div>{t('• Drag vertices or edges to warp smoothly')}</div>
+ <div>{t('• Switch to Edit Cage to add/shape points')}</div>
+ <div>{t('• Click Redraw to outline a specific region')}</div>
</div>
<div className="text-[10px] text-ui-muted flex items-center justify-between pt-1 border-t border-ui-subtle">
- <span>Apply: Enter</span>
- <span>Cancel: Esc</span>
+ <span>{t('Apply: Enter')}</span>
+ <span>{t('Cancel: Esc')}</span>
</div>
</div>
);
@@ -2313,9 +2380,9 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
if (currentTool === 'object') {
return (
<div className="p-2.5 space-y-2.5 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Object Tool</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Object Tool')}</div>
<p className="text-[10px] text-ui-muted leading-relaxed">
- Click any non-destructive Text or Speech Balloon layer on the canvas to reopen its editor without quality loss.
+ {t('Click any non-destructive Text or Speech Balloon layer on the canvas to reopen its editor without quality loss.')}
</p>
</div>
);
@@ -2326,22 +2393,24 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
const divideMode = frameSettings.divideMode ?? 'same-folder';
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Frame Border Folder</div>
+ <div className="text-[11px] font-medium text-ui-primary">
+ {t('Frame Border Folder')}
+ </div>
<SegmentedControl
size="xs"
fullWidth
- aria-label="Frame Mode"
+ aria-label={t('Frame Mode')}
value={frameMode}
onChange={(mode) => toolStoreActions.updateFrameSettings({ mode })}
options={[
- { value: 'create', label: 'Create' },
- { value: 'divide', label: 'Divide' },
+ { value: 'create', label: t('Create') },
+ { value: 'divide', label: t('Divide') },
]}
/>
{frameMode === 'divide' ? (
<div className="space-y-2.5">
- <div className="text-[10px] text-ui-muted">Divide Method</div>
+ <div className="text-[10px] text-ui-muted">{t('Divide Method')}</div>
<div className="grid grid-cols-1 gap-1 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
<button
type="button"
@@ -2354,7 +2423,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Divide Frame Border (Same Folder)
+ {t('Divide Frame Border (Same Folder)')}
</button>
<button
type="button"
@@ -2367,11 +2436,11 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Divide Frame Folder (2 Folders)
+ {t('Divide Frame Folder (2 Folders)')}
</button>
</div>
<CompactSlider
- label="Vert Gutter"
+ label={t('Vert Gutter')}
valueLabel={`${(frameSettings.gutterVerticalMm ?? 3.0).toFixed(1)}mm`}
min={0.5}
max={20}
@@ -2380,7 +2449,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFrameSettings({ gutterVerticalMm: v })}
/>
<CompactSlider
- label="Horiz Gutter"
+ label={t('Horiz Gutter')}
valueLabel={`${(frameSettings.gutterHorizontalMm ?? 5.0).toFixed(1)}mm`}
min={0.5}
max={25}
@@ -2392,7 +2461,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
) : (
<>
<CompactSlider
- label="Border Width"
+ label={t('Border Width')}
valueLabel={`${frameSettings.thickness ?? 4}px`}
min={1}
max={100}
@@ -2400,7 +2469,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFrameSettings({ thickness: v })}
/>
<CompactSlider
- label="Vert Gutter"
+ label={t('Vert Gutter')}
valueLabel={`${(frameSettings.gutterVerticalMm ?? 3.0).toFixed(1)}mm`}
min={0.5}
max={20}
@@ -2409,7 +2478,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => toolStoreActions.updateFrameSettings({ gutterVerticalMm: v })}
/>
<CompactSlider
- label="Horiz Gutter"
+ label={t('Horiz Gutter')}
valueLabel={`${(frameSettings.gutterHorizontalMm ?? 5.0).toFixed(1)}mm`}
min={0.5}
max={25}
@@ -2420,14 +2489,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl<'white' | 'empty'>
size="xs"
fullWidth
- aria-label="Frame Background"
+ aria-label={t('Frame Background')}
value={frameSettings.fillBackground ? 'white' : 'empty'}
onChange={(v) =>
toolStoreActions.updateFrameSettings({ fillBackground: v === 'white' })
}
options={[
- { value: 'white', label: 'White' },
- { value: 'empty', label: 'Empty' },
+ { value: 'white', label: t('White') },
+ { value: 'empty', label: tc('fillOption', 'Empty') },
]}
/>
</>
@@ -2439,7 +2508,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
if (currentTool === 'balloon') {
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Balloon</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Balloon')}</div>
<div className="space-y-0.5">
{(['ellipse', 'rounded-rect', 'jagged-flash', 'thought'] as const).map((shape) => (
<button
@@ -2452,12 +2521,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {shape.replace('-', ' ')}
+ {tc('balloonShape', shape.replace('-', ' '))}
</button>
))}
</div>
<CompactSlider
- label="Border"
+ label={t('Border')}
valueLabel={`${balloonSettings.strokeWidth ?? 3}px`}
min={1}
max={15}
@@ -2472,7 +2541,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
const activeMode = vectorEditSettings.mode || 'pinch';
return (
<div className="p-2.5 space-y-3 overflow-y-auto flex-1">
- <div className="text-[11px] font-medium text-ui-primary">Correct Line</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Correct Line')}</div>
<div className="space-y-0.5">
{(['pinch', 'width', 'simplify'] as const).map((m) => (
<button
@@ -2485,12 +2554,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
: 'text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- {m}
+ {tc('vectorEditMode', m)}
</button>
))}
</div>
<CompactSlider
- label="Radius"
+ label={t('Radius')}
valueLabel={`${vectorEditSettings.radius ?? 30}px`}
min={5}
max={150}
@@ -2499,7 +2568,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
{activeMode === 'pinch' && (
<CompactSlider
- label="Pinch Level"
+ label={t('Pinch Level')}
valueLabel={`${Math.round((vectorEditSettings.pinchStrength ?? 0.65) * 100)}%`}
min={10}
max={100}
@@ -2511,7 +2580,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
)}
{activeMode === 'width' && (
<CompactSlider
- label="Adjust Width"
+ label={t('Adjust Width')}
valueLabel={`${(vectorEditSettings.widthFactor ?? 1.2) >= 1 ? '+' : ''}${Math.round(((vectorEditSettings.widthFactor ?? 1.2) - 1) * 100)}%`}
min={50}
max={200}
@@ -2523,7 +2592,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
)}
{activeMode === 'simplify' && (
<CompactSlider
- label="Simplify"
+ label={t('Simplify')}
valueLabel={`${(vectorEditSettings.simplifyTolerance ?? 2.0).toFixed(1)}px`}
min={0.5}
max={12}
@@ -2539,7 +2608,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onClick={() => uiStoreActions.setMangaEffectsModalOpen(true)}
className="w-full py-1.5 px-2 rounded-ui-sm bg-ui-control border border-ui-subtle hover:bg-ui-control-hover text-[11px] text-ui-primary cursor-pointer"
>
- Effect Lines...
+ {t('Effect Lines...')}
</button>
</div>
);
@@ -2547,8 +2616,10 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
return (
<div className="p-2.5 text-[11px] text-ui-muted">
- <div className="text-ui-primary font-medium capitalize mb-1">{currentTool}</div>
- <p className="leading-relaxed">Click or drag directly on the canvas.</p>
+ <div className="text-ui-primary font-medium capitalize mb-1">
+ {td(currentTool, 'tool')}
+ </div>
+ <p className="leading-relaxed">{t('Click or drag directly on the canvas.')}</p>
</div>
);
}
@@ -2573,11 +2644,11 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
type="button"
onClick={() => uiStoreActions.setBrushStudioModalOpen(true)}
- title="Open Brush Studio"
+ title={t('Open Brush Studio')}
className="h-8 px-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary flex items-center gap-1 text-[10px] shrink-0 cursor-pointer"
>
<Sliders className="w-3 h-3 text-ui-accent" />
- <span className="hidden sm:inline">Studio</span>
+ <span className="hidden sm:inline">{t('Studio')}</span>
</button>
)}
</div>
@@ -2596,8 +2667,8 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<AlertTriangle className="w-3 h-3 text-ui-warning shrink-0" />
<span className="truncate font-medium tabular-nums">
{activeImportWarnings.length === 1
- ? '1 CSP import notice'
- : `${activeImportWarnings.length} CSP import notices`}
+ ? t('1 CSP import notice')
+ : t('{count} CSP import notices', { count: activeImportWarnings.length })}
</span>
</span>
{warningsExpanded ? (
@@ -2616,7 +2687,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</div>
)}
<ScrubSlider
- label="Size"
+ label={t('Size')}
variant="size"
logarithmic
min={0.5}
@@ -2627,10 +2698,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
formatValue={(v) => `${v < 10 ? v.toFixed(1) : Math.round(v)}px`}
value={brushSettings.size}
onChange={(v) => handleUpdateBrushSettings({ size: v })}
- title={`Brush Size ([ / ]): ${brushSettings.size < 10 ? brushSettings.size.toFixed(1) : Math.round(brushSettings.size)}px`}
+ title={t('Brush Size ([ / ]): {size}px', {
+ size: brushSettings.size < 10 ? brushSettings.size.toFixed(1) : Math.round(brushSettings.size),
+ })}
/>
<ScrubSlider
- label="Opacity"
+ label={t('Opacity')}
variant="opacity"
min={1}
max={100}
@@ -2646,14 +2719,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="shrink-0 bg-ui-panel border-t border-ui-subtle max-h-[50%] overflow-y-auto">
{/* 1. Ink */}
<SectionDisclosure
- title="Ink"
+ title={t('Ink')}
dense
open={openAccordion === 'ink'}
onToggle={() => toggleAccordion('ink')}
summary={`${Math.round((brushSettings.flow ?? 0.85) * 100)}%`}
>
<ScrubSlider
- label="Brush Density"
+ label={t('Brush Density')}
variant="opacity"
min={1}
max={100}
@@ -2667,40 +2740,40 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Adjust by Gap"
+ label={t('Adjust by Gap')}
checked={Boolean(brushSettings.adjustDensityByGap)}
onChange={(checked) =>
handleUpdateBrushSettings({ adjustDensityByGap: checked })
}
/>
<div className="space-y-1">
- <span className="text-[10.5px] text-ui-muted">Blend Tips</span>
+ <span className="text-[10.5px] text-ui-muted">{t('Blend Tips')}</span>
<SegmentedControl<CspBlendTipsMode>
size="xs"
fullWidth
- aria-label="Blend Tips"
+ aria-label={t('Blend Tips')}
value={brushSettings.blendTipsMode ?? 'normal'}
onChange={(mode) => handleUpdateBrushSettings({ blendTipsMode: mode })}
options={[
- { value: 'normal', label: 'Normal' },
- { value: 'darken', label: 'Darken' },
- { value: 'compare', label: 'Compare' },
+ { value: 'normal', label: tc('blendMode', 'Normal') },
+ { value: 'darken', label: tc('blendMode', 'Darken') },
+ { value: 'compare', label: tc('textureMode', 'Compare') },
]}
/>
</div>
<div className="space-y-1">
- <span className="text-[10.5px] text-ui-muted">Anti-Aliasing</span>
+ <span className="text-[10.5px] text-ui-muted">{t('Anti-Aliasing')}</span>
<SegmentedControl<'0' | '1' | '2' | '3'>
size="xs"
fullWidth
- aria-label="Anti-Aliasing"
+ aria-label={t('Anti-Aliasing')}
value={String(currentAntiAlias) as '0' | '1' | '2' | '3'}
onChange={(val) => handleUpdateBrushSettings({ antiAlias: Number(val) as 0 | 1 | 2 | 3 })}
options={[
- { value: '0', label: 'None' },
- { value: '1', label: 'Weak' },
- { value: '2', label: 'Med' },
- { value: '3', label: 'Strong' },
+ { value: '0', label: t('None') },
+ { value: '1', label: t('Weak') },
+ { value: '2', label: t('Med') },
+ { value: '3', label: t('Strong') },
]}
/>
</div>
@@ -2708,14 +2781,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* 2. Brush Tip */}
<SectionDisclosure
- title="Brush Tip"
+ title={t('Brush Tip')}
dense
open={openAccordion === 'tip'}
onToggle={() => toggleAccordion('tip')}
summary={`${Math.round((brushSettings.hardness ?? 1.0) * 100)}%`}
>
<ScrubSlider
- label="Hardness"
+ label={t('Hardness')}
min={5}
max={100}
step={1}
@@ -2725,7 +2798,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ hardness: v / 100 })}
/>
<ScrubSlider
- label="Gap (Spacing)"
+ label={t('Gap (Spacing)')}
min={1}
max={100}
step={1}
@@ -2735,7 +2808,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ spacing: v / 100 })}
/>
<ScrubSlider
- label="Thickness"
+ label={t('Thickness')}
min={5}
max={100}
step={1}
@@ -2747,18 +2820,18 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl<'horizontal' | 'vertical'>
size="xs"
fullWidth
- aria-label="Thickness Axis"
+ aria-label={t('Thickness Axis')}
value={brushSettings.thicknessVertical ? 'vertical' : 'horizontal'}
onChange={(axis) =>
handleUpdateBrushSettings({ thicknessVertical: axis === 'vertical' })
}
options={[
- { value: 'horizontal', label: 'Horizontal' },
- { value: 'vertical', label: 'Vertical' },
+ { value: 'horizontal', label: t('Horizontal') },
+ { value: 'vertical', label: t('Vertical') },
]}
/>
<ScrubSlider
- label="Angle"
+ label={t('Angle')}
min={0}
max={360}
step={1}
@@ -2768,7 +2841,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ customTipAngle: v })}
/>
<div className="space-y-1">
- <span className="text-[10.5px] text-ui-muted">Angle Dynamics</span>
+ <span className="text-[10.5px] text-ui-muted">{t('Angle Dynamics')}</span>
<select
value={brushSettings.customTipAngleDynamics ?? 'none'}
onChange={(e) =>
@@ -2779,19 +2852,19 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="w-full h-6 bg-ui-input border border-ui-subtle text-ui-primary text-[10px] px-1.5 rounded-ui-sm cursor-pointer"
>
- <option value="none">None</option>
- <option value="direction">Direction of Line</option>
- <option value="initial-direction">Initial Direction</option>
- <option value="tilt">Pen Tilt</option>
- <option value="twist">Barrel Twist</option>
- <option value="random">Random</option>
- <option value="direction-random">Direction + Random</option>
+ <option value="none">{t('None')}</option>
+ <option value="direction">{t('Direction of Line')}</option>
+ <option value="initial-direction">{t('Initial Direction')}</option>
+ <option value="tilt">{t('Pen Tilt')}</option>
+ <option value="twist">{t('Barrel Twist')}</option>
+ <option value="random">{t('Random')}</option>
+ <option value="direction-random">{t('Direction + Random')}</option>
</select>
</div>
<ToggleSwitch
size="xs"
- label="This brush rotates"
- title="Rotate the brush cursor silhouette as you move to track brush direction"
+ label={t('This brush rotates')}
+ title={t('Rotate the brush cursor silhouette as you move to track brush direction')}
checked={resolveBrushCursorRotationSpec(brushSettings, currentTool).enabled}
onChange={(checked) =>
handleUpdateBrushSettings({ rotateCursor: checked })
@@ -2799,7 +2872,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<div className="grid grid-cols-2 gap-1.5">
<div className="space-y-0.5">
- <span className="text-[10px] text-ui-muted">Flip H</span>
+ <span className="text-[10px] text-ui-muted">{t('Flip H')}</span>
<select
value={brushSettings.flipH ?? 'none'}
onChange={(e) =>
@@ -2807,13 +2880,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="w-full h-5 bg-ui-input border border-ui-subtle text-ui-primary text-[10px] px-1 rounded-ui-sm cursor-pointer"
>
- <option value="none">None</option>
- <option value="random">Random</option>
- <option value="alternate">Alternate</option>
+ <option value="none">{t('None')}</option>
+ <option value="random">{t('Random')}</option>
+ <option value="alternate">{t('Alternate')}</option>
</select>
</div>
<div className="space-y-0.5">
- <span className="text-[10px] text-ui-muted">Flip V</span>
+ <span className="text-[10px] text-ui-muted">{t('Flip V')}</span>
<select
value={brushSettings.flipV ?? 'none'}
onChange={(e) =>
@@ -2821,15 +2894,15 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="w-full h-5 bg-ui-input border border-ui-subtle text-ui-primary text-[10px] px-1 rounded-ui-sm cursor-pointer"
>
- <option value="none">None</option>
- <option value="random">Random</option>
- <option value="alternate">Alternate</option>
+ <option value="none">{t('None')}</option>
+ <option value="random">{t('Random')}</option>
+ <option value="alternate">{t('Alternate')}</option>
</select>
</div>
</div>
<ToggleSwitch
size="xs"
- label="Ribbon"
+ label={t('Ribbon')}
checked={Boolean(brushSettings.isRibbon)}
onChange={(checked) => handleUpdateBrushSettings({ isRibbon: checked })}
/>
@@ -2837,14 +2910,14 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* 3. Stroke & Stabilization */}
<SectionDisclosure
- title="Stabilization & Stroke"
+ title={t('Stabilization & Stroke')}
dense
open={openAccordion === 'stroke'}
onToggle={() => toggleAccordion('stroke')}
summary={`${brushSettings.stabilization ?? 15}`}
>
<ScrubSlider
- label="Stabilization"
+ label={t('Stabilization')}
min={0}
max={50}
step={1}
@@ -2853,7 +2926,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ stabilization: v })}
/>
<ScrubSlider
- label="Post-Correction"
+ label={t('Post-Correction')}
min={0}
max={5}
step={1}
@@ -2863,7 +2936,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Sharp Angles"
+ label={t('Sharp Angles')}
checked={brushSettings.sharpCorners ?? true}
onChange={(checked) =>
handleUpdateBrushSettings({ sharpCorners: checked })
@@ -2873,20 +2946,20 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="grid grid-cols-2 gap-1.5">
<ToggleSwitch
size="xs"
- label="Taper In"
+ label={t('Taper In')}
checked={Boolean(brushSettings.taper?.useIn)}
onChange={(checked) => handleUpdateTaper({ useIn: checked })}
/>
<ToggleSwitch
size="xs"
- label="Taper Out"
+ label={t('Taper Out')}
checked={Boolean(brushSettings.taper?.useOut)}
onChange={(checked) => handleUpdateTaper({ useOut: checked })}
/>
</div>
{(brushSettings.taper?.useIn || brushSettings.taper?.useOut) && (
<ScrubSlider
- label="Taper Length"
+ label={t('Taper Length')}
min={4}
max={200}
step={1}
@@ -2899,7 +2972,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<ToggleSwitch
size="xs"
- label="Pen Pressure"
+ label={t('Pen Pressure')}
checked={brushSettings.usePressure}
onChange={(checked) =>
handleUpdateBrushSettings({ usePressure: checked })
@@ -2908,7 +2981,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{brushSettings.usePressure && (
<>
<ScrubSlider
- label="Min Width"
+ label={t('Min Width')}
min={0}
max={95}
step={1}
@@ -2918,7 +2991,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ minSizeFactor: v / 100 })}
/>
<div className="space-y-1">
- <span className="text-[10px] text-ui-muted">Pressure Curve</span>
+ <span className="text-[10px] text-ui-muted">{t('Pressure Curve')}</span>
<div className="grid grid-cols-5 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{(
[
@@ -2932,7 +3005,11 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<button
key={p.id}
type="button"
- title={CSP_PRESSURE_CURVE_PRESETS[p.id]?.label}
+ title={
+ CSP_PRESSURE_CURVE_PRESETS[p.id]?.label
+ ? td(CSP_PRESSURE_CURVE_PRESETS[p.id].label)
+ : undefined
+ }
onClick={() =>
handleUpdateBrushSettings({
pressureCurve: CSP_PRESSURE_CURVE_PRESETS[p.id]?.points,
@@ -2940,7 +3017,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="py-0.5 rounded-ui-xs text-[9px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
- {p.short}
+ {tc('pressureShort', p.short)}
</button>
))}
</div>
@@ -2950,13 +3027,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<ToggleSwitch
size="xs"
- label="Stylus Tilt"
+ label={t('Stylus Tilt')}
checked={Boolean(brushSettings.useTilt)}
onChange={(checked) => handleUpdateBrushSettings({ useTilt: checked })}
/>
<ToggleSwitch
size="xs"
- label="Velocity Dynamics"
+ label={t('Velocity Dynamics')}
checked={Boolean(brushSettings.useVelocity)}
onChange={(checked) =>
handleUpdateBrushSettings({ useVelocity: checked })
@@ -2964,7 +3041,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Bezier Smoothing"
+ label={t('Bezier Smoothing')}
checked={brushSettings.smoothing}
onChange={(checked) => handleUpdateBrushSettings({ smoothing: checked })}
/>
@@ -2981,17 +3058,17 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}}
className="w-full py-1 rounded-ui-sm bg-ui-input border border-ui-subtle hover:bg-ui-control-hover text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
>
- Reset Brush to Default
+ {t('Reset Brush to Default')}
</button>
</SectionDisclosure>
{/* 4. Color Mixing & Blending */}
<SectionDisclosure
- title="Blending & Mixing"
+ title={t('Blending & Mixing')}
dense
open={openAccordion === 'mixing'}
onToggle={() => toggleAccordion('mixing')}
- summary={(brushSettings.perceptualMixing ?? true) ? 'Pigment' : 'Regular'}
+ summary={(brushSettings.perceptualMixing ?? true) ? t('Pigment') : t('Regular')}
summaryTone={(brushSettings.perceptualMixing ?? true) ? 'success' : 'muted'}
>
<PigmentBlendControl
@@ -3020,7 +3097,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="pt-1 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Color Mixing"
+ label={t('Color Mixing')}
checked={Boolean(brushSettings.colorMixing)}
onChange={(enabled) => {
handleUpdateBrushSettings({
@@ -3037,26 +3114,26 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<SegmentedControl<'blend' | 'running_color' | 'impasto_mix' | 'smear'>
size="xs"
fullWidth
- aria-label="Mixing Mode"
+ aria-label={t('Mixing Mode')}
value={brushSettings.mixingMode || 'blend'}
onChange={(m) => handleUpdateBrushSettings({ mixingMode: m })}
options={
brushSettings.naturalPaint?.enabled
? [
- { value: 'blend', label: 'Blend' },
- { value: 'running_color', label: 'Running' },
- { value: 'impasto_mix', label: 'Impasto' },
- { value: 'smear', label: 'Smear' },
+ { value: 'blend', label: tc('mixingMode', 'Blend') },
+ { value: 'running_color', label: tc('mixingMode', 'Running') },
+ { value: 'impasto_mix', label: tc('mixingMode', 'Impasto') },
+ { value: 'smear', label: tc('mixingMode', 'Smear') },
]
: [
- { value: 'blend', label: 'Blend' },
- { value: 'running_color', label: 'Running' },
- { value: 'smear', label: 'Smear' },
+ { value: 'blend', label: tc('mixingMode', 'Blend') },
+ { value: 'running_color', label: tc('mixingMode', 'Running') },
+ { value: 'smear', label: tc('mixingMode', 'Smear') },
]
}
/>
<ScrubSlider
- label="Amount of Paint"
+ label={t('Amount of Paint')}
min={0}
max={100}
step={1}
@@ -3077,7 +3154,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}}
/>
<ScrubSlider
- label="Density of Paint"
+ label={t('Density of Paint')}
min={1}
max={100}
step={1}
@@ -3087,7 +3164,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateBrushSettings({ densityOfPaint: v / 100 })}
/>
<ScrubSlider
- label="Color Stretch"
+ label={t('Color Stretch')}
min={0}
max={100}
step={1}
@@ -3098,7 +3175,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Optical Blur"
+ label={t('Optical Blur')}
checked={Boolean(brushSettings.useBlur)}
onChange={(enabled) => {
handleUpdateBrushSettings({
@@ -3111,7 +3188,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
{brushSettings.useBlur && (
<ScrubSlider
- label="Blur Strength"
+ label={t('Blur Strength')}
min={5}
max={100}
step={1}
@@ -3124,7 +3201,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
</>
)}
<ScrubSlider
- label="Watercolor Edge"
+ label={t('Watercolor Edge')}
min={0}
max={100}
step={1}
@@ -3135,7 +3212,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
{(brushSettings.wetEdge ?? 0) > 0.01 && (
<ScrubSlider
- label="Edge Width"
+ label={t('Edge Width')}
variant="size"
min={1}
max={20}
@@ -3150,7 +3227,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* 5. Texture & Spraying Effect */}
<SectionDisclosure
- title="Texture & Spray"
+ title={t('Texture & Spray')}
dense
open={openAccordion === 'texture'}
onToggle={() => toggleAccordion('texture')}
@@ -3158,12 +3235,12 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
(brushSettings.grain ?? 0) > 0.005
? `${Math.round((brushSettings.grain ?? 0) * 100)}%`
: brushSettings.spray?.enabled
- ? 'Spray'
+ ? t('Spray')
: undefined
}
>
<ScrubSlider
- label="Texture Density"
+ label={t('Texture Density')}
min={0}
max={100}
step={1}
@@ -3177,7 +3254,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{(brushSettings.grain ?? 0) > 0.005 && (
<>
<div className="space-y-1">
- <span className="text-[10.5px] text-ui-muted">Texture Mode</span>
+ <span className="text-[10.5px] text-ui-muted">{t('Texture Mode')}</span>
<select
value={brushSettings.paperTextureMode ?? 'subtract'}
onChange={(e) =>
@@ -3187,19 +3264,19 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
className="w-full h-6 bg-ui-input border border-ui-subtle text-ui-primary text-[10px] px-1.5 rounded-ui-sm cursor-pointer"
>
- <option value="normal">Normal</option>
- <option value="multiply">Multiply</option>
- <option value="subtract">Subtract (Valley Fill)</option>
- <option value="compare">Compare Density</option>
- <option value="overlay">Overlay</option>
- <option value="color-burn">Color Burn</option>
- <option value="linear-burn">Linear Burn</option>
- <option value="height">Height</option>
- <option value="outline">Outline</option>
+ <option value="normal">{tc('blendMode', 'Normal')}</option>
+ <option value="multiply">{tc('blendMode', 'Multiply')}</option>
+ <option value="subtract">{t('Subtract (Valley Fill)')}</option>
+ <option value="compare">{tc('blendMode', 'Compare Density')}</option>
+ <option value="overlay">{tc('blendMode', 'Overlay')}</option>
+ <option value="color-burn">{tc('blendMode', 'Color Burn')}</option>
+ <option value="linear-burn">{tc('blendMode', 'Linear Burn')}</option>
+ <option value="height">{tc('textureMode', 'Height')}</option>
+ <option value="outline">{tc('textureMode', 'Outline')}</option>
</select>
</div>
<ScrubSlider
- label="Texture Scale"
+ label={t('Texture Scale')}
min={10}
max={400}
step={5}
@@ -3212,7 +3289,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Invert Texture"
+ label={t('Invert Texture')}
checked={Boolean(brushSettings.paperTextureInverted)}
onChange={(checked) =>
handleUpdateBrushSettings({
@@ -3226,7 +3303,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
<div className="pt-1 border-t border-ui-subtle">
<ToggleSwitch
size="xs"
- label="Spraying Effect"
+ label={t('Spraying Effect')}
checked={Boolean(brushSettings.spray?.enabled)}
onChange={(checked) => handleUpdateSpray({ enabled: checked })}
/>
@@ -3234,7 +3311,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{brushSettings.spray?.enabled && (
<>
<ScrubSlider
- label="Particle Size"
+ label={t('Particle Size')}
variant="size"
min={1}
max={80}
@@ -3245,7 +3322,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateSpray({ size: v })}
/>
<ScrubSlider
- label="Spray Density"
+ label={t('Spray Density')}
min={1}
max={64}
step={1}
@@ -3259,13 +3336,13 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{/* 6. Dynamics & Jitter */}
<SectionDisclosure
- title="Dynamics & Jitter"
+ title={t('Dynamics & Jitter')}
dense
open={openAccordion === 'dynamics'}
onToggle={() => toggleAccordion('dynamics')}
>
<ScrubSlider
- label="Size Jitter"
+ label={t('Size Jitter')}
min={0}
max={100}
step={1}
@@ -3275,7 +3352,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ sizeJitter: v / 100 })}
/>
<ScrubSlider
- label="Angle Jitter"
+ label={t('Angle Jitter')}
min={0}
max={100}
step={1}
@@ -3285,7 +3362,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ angleJitter: v / 100 })}
/>
<ScrubSlider
- label="Roundness Jitter"
+ label={t('Roundness Jitter')}
min={0}
max={95}
step={1}
@@ -3295,7 +3372,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ roundnessJitter: v / 100 })}
/>
<ScrubSlider
- label="Scatter"
+ label={t('Scatter')}
min={0}
max={5}
step={0.1}
@@ -3307,7 +3384,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{(brushSettings.dynamics?.scatter ?? 0) > 0 && (
<ToggleSwitch
size="xs"
- label="Scatter Both Axes"
+ label={t('Scatter Both Axes')}
checked={Boolean(brushSettings.dynamics?.scatterBothAxes)}
onChange={(checked) =>
handleUpdateDynamics({ scatterBothAxes: checked })
@@ -3315,7 +3392,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
)}
<ScrubSlider
- label="Count"
+ label={t('Count')}
min={1}
max={10}
step={1}
@@ -3324,7 +3401,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ count: v })}
/>
<ScrubSlider
- label="Flow Jitter"
+ label={t('Flow Jitter')}
min={0}
max={100}
step={1}
@@ -3335,7 +3412,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
/>
<ToggleSwitch
size="xs"
- label="Color Jitter"
+ label={t('Color Jitter')}
checked={Boolean(brushSettings.dynamics?.colorJitterEnabled)}
onChange={(checked) =>
handleUpdateDynamics({ colorJitterEnabled: checked })
@@ -3344,7 +3421,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
{brushSettings.dynamics?.colorJitterEnabled && (
<>
<ScrubSlider
- label="Hue"
+ label={t('Hue')}
variant="hue"
min={0}
max={100}
@@ -3355,7 +3432,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ hueJitter: v / 100 })}
/>
<ScrubSlider
- label="Saturation"
+ label={t('Saturation')}
min={0}
max={100}
step={1}
@@ -3365,7 +3442,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ saturationJitter: v / 100 })}
/>
<ScrubSlider
- label="Brightness"
+ label={t('Brightness')}
min={0}
max={100}
step={1}
@@ -3375,7 +3452,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
onChange={(v) => handleUpdateDynamics({ brightnessJitter: v / 100 })}
/>
<ScrubSlider
- label="FG / BG Mix"
+ label={t('FG / BG Mix')}
min={0}
max={100}
step={1}
diff --git a/src/components/ToolStrip.tsx b/src/components/ToolStrip.tsx
index 66fe996..34995b0 100644
--- a/src/components/ToolStrip.tsx
+++ b/src/components/ToolStrip.tsx
@@ -37,6 +37,7 @@ import {
documentStoreActions,
selectHasOpenDocument,
} from '../stores';
+import { useI18n } from '../i18n';
export interface ToolStripProps {
onTransformSelection?: () => void;
@@ -46,6 +47,7 @@ export interface ToolStripProps {
export const ToolStrip: React.FC<ToolStripProps> = React.memo(
({ onTransformSelection, onToggleTransparentColor, fluid = false }) => {
+ const { t } = useI18n();
const currentTool = useToolStore((s) => s.tool);
const primaryColor = useToolStore((s) => s.primaryColor);
const secondaryColor = useToolStore((s) => s.secondaryColor);
@@ -60,7 +62,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
} else {
const next = toolStoreActions.toggleTransparentColor();
uiStoreActions.showToast(
- next ? 'Transparent ink mode active' : 'Color ink mode active'
+ next ? t('Transparent ink mode active') : t('Color ink mode active')
);
}
};
@@ -74,7 +76,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
}> = [
{
id: 'brush',
- label: 'Brush (B)',
+ label: t('Brush (B)'),
icon: <Paintbrush className="w-3.5 h-3.5" />,
onClick: () => {
toolStoreActions.selectTool('brush');
@@ -83,56 +85,56 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
},
{
id: 'decoration',
- label: 'Decoration',
+ label: t('Decoration'),
icon: <Sparkles className="w-3.5 h-3.5" />,
onClick: () => {
toolStoreActions.selectTool('decoration');
if (isHidden) uiStoreActions.toggleLeftPanelHidden();
},
},
- { id: 'eraser', label: 'Eraser (E)', icon: <Eraser className="w-3.5 h-3.5" /> },
- { id: 'pipette', label: 'Eyedropper (I)', icon: <Pipette className="w-3.5 h-3.5" /> },
+ { id: 'eraser', label: t('Eraser (E)'), icon: <Eraser className="w-3.5 h-3.5" /> },
+ { id: 'pipette', label: t('Eyedropper (I)'), icon: <Pipette className="w-3.5 h-3.5" /> },
{
id: 'liquify',
- label: 'Liquify (J)',
+ label: t('Liquify (J)'),
icon: <LiquifyIcon className="w-3.5 h-3.5" />,
},
{
id: 'retouch',
- label: 'Retouch: Smudge / Blur / Dodge / Burn / Clone (S)',
+ label: t('Retouch: Smudge / Blur / Dodge / Burn / Clone (S)'),
icon: <Droplets className="w-3.5 h-3.5" />,
dividerAfter: true,
},
{
id: 'transform',
- label: 'Transform (Ctrl+T)',
+ label: t('Transform (Ctrl+T)'),
icon: <Scaling className="w-3.5 h-3.5" />,
onClick: () => {
toolStoreActions.selectTool('transform');
onTransformSelection?.();
},
},
- { id: 'select-rect', label: 'Marquee (M)', icon: <BoxSelect className="w-3.5 h-3.5" /> },
- { id: 'select-lasso', label: 'Lasso (L)', icon: <Lasso className="w-3.5 h-3.5" /> },
- { id: 'select-wand', label: 'Magic Wand (W)', icon: <Wand2 className="w-3.5 h-3.5" /> },
+ { id: 'select-rect', label: t('Marquee (M)'), icon: <BoxSelect className="w-3.5 h-3.5" /> },
+ { id: 'select-lasso', label: t('Lasso (L)'), icon: <Lasso className="w-3.5 h-3.5" /> },
+ { id: 'select-wand', label: t('Magic Wand (W)'), icon: <Wand2 className="w-3.5 h-3.5" /> },
{
id: 'select-pen',
- label: 'Selection Pen',
+ label: t('Selection Pen'),
icon: <PenTool className="w-3.5 h-3.5" />,
dividerAfter: true,
},
- { id: 'fill', label: 'Fill (G)', icon: <PaintBucket className="w-3.5 h-3.5" /> },
- { id: 'gradient', label: 'Gradient: Linear / Radial / Mesh (Shift+G)', icon: <Blend className="w-3.5 h-3.5" /> },
- { id: 'shape', label: 'Shapes (U)', icon: <Shapes className="w-3.5 h-3.5" /> },
- { id: 'pen', label: 'Bézier Pen (P)', icon: <Feather className="w-3.5 h-3.5" /> },
- { id: 'object', label: 'Object (O)', icon: <MousePointer2 className="w-3.5 h-3.5" /> },
- { id: 'text', label: 'Text (T)', icon: <Type className="w-3.5 h-3.5" /> },
- { id: 'frame', label: 'Frame Border (F)', icon: <Frame className="w-3.5 h-3.5" /> },
- { id: 'balloon', label: 'Speech Balloon', icon: <MessageSquare className="w-3.5 h-3.5" /> },
- { id: 'vector-edit', label: 'Correct Line', icon: <Spline className="w-3.5 h-3.5" /> },
+ { id: 'fill', label: t('Fill (G)'), icon: <PaintBucket className="w-3.5 h-3.5" /> },
+ { id: 'gradient', label: t('Gradient: Linear / Radial / Mesh (Shift+G)'), icon: <Blend className="w-3.5 h-3.5" /> },
+ { id: 'shape', label: t('Shapes (U)'), icon: <Shapes className="w-3.5 h-3.5" /> },
+ { id: 'pen', label: t('Bézier Pen (P)'), icon: <Feather className="w-3.5 h-3.5" /> },
+ { id: 'object', label: t('Object (O)'), icon: <MousePointer2 className="w-3.5 h-3.5" /> },
+ { id: 'text', label: t('Text (T)'), icon: <Type className="w-3.5 h-3.5" /> },
+ { id: 'frame', label: t('Frame Border (F)'), icon: <Frame className="w-3.5 h-3.5" /> },
+ { id: 'balloon', label: t('Speech Balloon'), icon: <MessageSquare className="w-3.5 h-3.5" /> },
+ { id: 'vector-edit', label: t('Correct Line'), icon: <Spline className="w-3.5 h-3.5" /> },
{
id: '3d',
- label: '3D Object & Camera Tool (K)',
+ label: t('3D Object & Camera Tool (K)'),
icon: <Box className="w-3.5 h-3.5" />,
onClick: () => {
toolStoreActions.selectTool('3d');
@@ -189,9 +191,9 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
onClick={() => {
if (!hasOpenDocument) return;
const next = documentStoreActions.toggleStraightRuler();
- uiStoreActions.showToast(next.enabled ? 'Straight Ruler: ON' : 'Straight Ruler: OFF');
+ uiStoreActions.showToast(next.enabled ? t('Straight Ruler: ON') : t('Straight Ruler: OFF'));
}}
- title="Straight Ruler (R)"
+ title={t('Straight Ruler (R)')}
data-testid="toolstrip-straight-ruler-btn"
className={`relative w-8 h-7 rounded-ui-sm flex items-center justify-center transition-colors ${
!hasOpenDocument
@@ -213,7 +215,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
<div className="relative w-6 h-6">
<div
onClick={() => toolStoreActions.swapColors()}
- title={`Secondary: ${secondaryColor} (X to swap, D to reset)`}
+ title={t('Secondary: {color} (X to swap, D to reset)', { color: secondaryColor })}
className="absolute bottom-0 right-0 w-4 h-4 rounded-ui-xs cursor-pointer ring-1 ring-ui-strong"
style={{ backgroundColor: secondaryColor }}
/>
@@ -222,7 +224,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
if (isTransparentColor) handleToggleTransparent();
else toolStoreActions.swapColors();
}}
- title={`Primary: ${primaryColor}`}
+ title={t('Primary: {color}', { color: primaryColor })}
className={`absolute top-0 left-0 w-4 h-4 rounded-ui-xs cursor-pointer z-10 ${
!isTransparentColor
? 'ring-[1.5px] ring-ui-accent'
@@ -234,7 +236,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
<div
onClick={handleToggleTransparent}
- title="Transparent Ink (C)"
+ title={t('Transparent Ink (C)')}
className={`w-6 h-2.5 rounded-ui-xs cursor-pointer transition-all ${
isTransparentColor
? 'ring-[1.5px] ring-ui-accent'
@@ -249,7 +251,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
<button
type="button"
onClick={() => toolStoreActions.swapColors()}
- title="Swap Colors (X)"
+ title={t('Swap Colors (X)')}
className="w-7 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<ArrowLeftRight className="w-3 h-3" />
@@ -262,7 +264,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
? workspaceStoreActions.togglePalettesHidden()
: uiStoreActions.toggleLeftPanelHidden()
}
- title={fluid ? 'Hide/Show Palettes (Tab)' : isHidden ? 'Show Panel (Shift+Tab)' : 'Hide Panel (Shift+Tab)'}
+ title={fluid ? t('Hide/Show Palettes (Tab)') : isHidden ? t('Show Panel (Shift+Tab)') : t('Hide Panel (Shift+Tab)')}
className="w-7 h-7 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
{isHidden ? (
diff --git a/src/components/TransformOverlay.tsx b/src/components/TransformOverlay.tsx
index 7610f76..a101342 100644
--- a/src/components/TransformOverlay.tsx
+++ b/src/components/TransformOverlay.tsx
@@ -51,6 +51,7 @@ import {
evaluateCageMesh,
} from '../utils/cageWarpEngine';
import { releaseTemporaryCanvas } from '../utils/tileEngine';
+import { useI18n } from '../i18n';
interface TransformOverlayProps {
session: TransformSession;
@@ -77,6 +78,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
onApply,
onCancel,
}) => {
+ const { t, tc } = useI18n();
const containerRef = useRef<HTMLDivElement>(null);
const docOriginRef = useRef<HTMLDivElement>(null);
const previewCanvasRef = useRef<HTMLCanvasElement>(null);
@@ -1254,7 +1256,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<div
onPointerDown={(e) => startDragAffine('move', e)}
className="absolute inset-0 border-2 border-cyan-400 bg-cyan-400/5 cursor-move"
- title="Drag to Move"
+ title={t('Drag to Move')}
/>
{/* Rotation Stem & Handle */}
@@ -1265,7 +1267,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
transformOrigin: 'bottom center',
}}
onPointerDown={(e) => startDragAffine('rotate', e)}
- title="Drag to Rotate"
+ title={t('Drag to Rotate')}
>
<div className="w-3.5 h-3.5 rounded-full bg-cyan-400 border border-white shadow-md cursor-grab active:cursor-grabbing hover:scale-125 transition-transform" />
<div className="w-0.5 h-2.5 bg-cyan-400" />
@@ -1499,7 +1501,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
transform: `translate(-50%, -50%) scale(${invZoom})`,
transformOrigin: 'center',
}}
- title={`Corner Pin ${idx + 1}`}
+ title={t('Corner Pin {index}', { index: idx + 1 })}
/>
))}
@@ -1523,7 +1525,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
transform: `translate(-50%, -50%) scale(${invZoom})`,
transformOrigin: 'center',
}}
- title={`Mesh Handle [${r}, ${c}]`}
+ title={t('Mesh Handle [{row}, {col}]', { row: r, col: c })}
/>
))
)}
@@ -1568,7 +1570,10 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
e.stopPropagation();
handleResetPinRotation(pin.id);
}}
- title={`Drag to rotate joint (${Math.round(pin.rotation)}°, Shift snaps 15°, double-click resets)`}
+ title={t(
+ 'Drag to rotate joint ({angle}°, Shift snaps 15°, double-click resets)',
+ { angle: Math.round(pin.rotation) }
+ )}
className="absolute w-2.5 h-2.5 rounded-full bg-amber-400 border border-black shadow-md cursor-alias hover:scale-125 transition-transform pointer-events-auto"
style={{
left: `${knobX}px`,
@@ -1599,7 +1604,10 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
e.stopPropagation();
handleDeletePuppetPin(pin.id);
}}
- title={`Pin #${idx + 1} · Drag to move · Alt+Drag or ring to rotate · Right-click or Del to remove`}
+ title={t(
+ 'Pin #{index} · Drag to move · Alt+Drag or ring to rotate · Right-click or Del to remove',
+ { index: idx + 1 }
+ )}
className={`absolute rounded-full shadow-md cursor-grab active:cursor-grabbing hover:scale-125 transition-transform pointer-events-auto flex items-center justify-center ${
isSelected
? 'w-3.5 h-3.5 bg-amber-400 border-2 border-white ring-2 ring-amber-400/40'
@@ -1635,10 +1643,12 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
}}
title={
isCloseTarget
- ? 'Click to close cage & begin deforming'
+ ? t('Click to close cage & begin deforming')
: cageState.phase === 'edit'
- ? `Cage Vertex ${idx + 1} · Drag to shape cage · Right-click to remove`
- : `Cage Vertex ${idx + 1} · Drag to warp`
+ ? t('Cage Vertex {index} · Drag to shape cage · Right-click to remove', {
+ index: idx + 1,
+ })
+ : t('Cage Vertex {index} · Drag to warp', { index: idx + 1 })
}
className={`absolute z-34 rounded-full border-2 shadow-md cursor-grab active:cursor-grabbing hover:scale-125 transition-transform pointer-events-auto ${
isCloseTarget
@@ -1683,68 +1693,68 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={() => handleSwitchMode('affine')}
- title="Free Transform (Affine Scale & Rotate)"
+ title={t('Free Transform (Affine Scale & Rotate)')}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'affine'
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Free
+ {tc('transformMode', 'Free')}
</button>
<button
type="button"
onClick={() => handleSwitchMode('perspective')}
- title="Perspective Quad (4-Point Homography)"
+ title={t('Perspective Quad (4-Point Homography)')}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'perspective'
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Perspective
+ {t('Perspective')}
</button>
<button
type="button"
onClick={() => handleSwitchMode('mesh')}
- title="Mesh Warp (Catmull-Rom Bicubic Lattice)"
+ title={t('Mesh Warp (Catmull-Rom Bicubic Lattice)')}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'mesh'
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Mesh
+ {t('Mesh')}
</button>
<button
type="button"
data-testid="transform-mode-puppet"
onClick={() => handleSwitchMode('puppet')}
- title="Puppet Warp (Place joint pins to bend limbs, tilt head & adjust cloak folds)"
+ title={t('Puppet Warp (Place joint pins to bend limbs, tilt head & adjust cloak folds)')}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'puppet'
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Puppet
+ {t('Puppet')}
</button>
<button
type="button"
data-testid="transform-mode-cage"
onClick={() => handleSwitchMode('cage')}
- title="Cage Transform (Deform artwork inside an editable polygon cage)"
+ title={t('Cage Transform (Deform artwork inside an editable polygon cage)')}
className={`px-2 py-0.5 rounded-ui-xs text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'cage'
? 'bg-ui-accent text-ui-accent-contrast'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- Cage
+ {t('Cage')}
</button>
</div>
@@ -1754,20 +1764,20 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={onApply}
- title="Apply Transform (Enter)"
+ title={t('Apply Transform (Enter)')}
className="px-2.5 py-1 bg-ui-accent text-ui-accent-contrast hover:opacity-90 rounded-ui-sm text-[11px] font-medium cursor-pointer transition-opacity"
>
- Apply
+ {t('Apply')}
</button>
{/* Cancel */}
<button
type="button"
onClick={onCancel}
- title="Cancel Transform (Esc)"
+ title={t('Cancel Transform (Esc)')}
className="px-2 py-1 bg-ui-control hover:bg-ui-control-hover text-ui-primary rounded-ui-sm text-[11px] cursor-pointer transition-colors"
>
- Cancel
+ {t('Cancel')}
</button>
<div className="w-px h-4 bg-ui-subtle" />
@@ -1776,7 +1786,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={handleFlipH}
- title="Flip Horizontal"
+ title={t('Flip Horizontal')}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
session.flipH
? 'bg-ui-accent-subtle text-ui-accent'
@@ -1790,7 +1800,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={handleFlipV}
- title="Flip Vertical"
+ title={t('Flip Vertical')}
className={`p-1 rounded-ui-xs transition-colors cursor-pointer ${
session.flipV
? 'bg-ui-accent-subtle text-ui-accent'
@@ -1804,7 +1814,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={handleReset}
- title="Reset Transform"
+ title={t('Reset Transform')}
className="p-1 text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover rounded-ui-xs transition-colors cursor-pointer"
>
<RotateCcw className="w-3.5 h-3.5" />
@@ -1814,7 +1824,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
{/* Row 2: Mesh Grid Density */}
{mode === 'mesh' && (
<div className="flex items-center space-x-1 pt-0.5 border-t border-ui-subtle w-full justify-center text-[11px] text-ui-muted">
- <span>Grid</span>
+ <span>{t('Grid')}</span>
{[3, 4, 5, 6, 8].map((size) => (
<button
type="button"
@@ -1844,10 +1854,10 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
onClick={() => handleChangePuppetRigidity(rMode)}
title={
rMode === 'rigid'
- ? 'Rigid (Preserves bone/limb rigidity & volume)'
+ ? t('Rigid (Preserves bone/limb rigidity & volume)')
: rMode === 'normal'
- ? 'Normal (Balanced ARAP smooth bending)'
- : 'Distort (Elastic similarity stretch for cloaks & stylization)'
+ ? t('Normal (Balanced ARAP smooth bending)')
+ : t('Distort (Elastic similarity stretch for cloaks & stylization)')
}
className={`px-1.5 py-0.5 rounded-ui-xs capitalize cursor-pointer transition-colors ${
(session.puppet?.rigidity ?? 'normal') === rMode
@@ -1855,7 +1865,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {rMode}
+ {tc('puppetRigidity', rMode)}
</button>
))}
</div>
@@ -1867,14 +1877,16 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
type="button"
key={dMode}
onClick={() => handleChangePuppetMeshParams(dMode, currentExpansion)}
- title={`Mesh Density: ${dMode}`}
+ title={t('Mesh Density: {density}', {
+ density: tc('meshDensity', dMode),
+ })}
className={`px-1.5 py-0.5 rounded-ui-xs capitalize cursor-pointer transition-colors ${
(session.puppet?.density ?? 'normal') === dMode
? 'bg-ui-control-active text-ui-primary font-medium'
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {dMode === 'coarse' ? 'Low' : dMode === 'normal' ? 'Med' : 'Fine'}
+ {dMode === 'coarse' ? t('Low') : dMode === 'normal' ? t('Med') : t('Fine')}
</button>
))}
</div>
@@ -1882,14 +1894,14 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
{/* Expansion */}
<div
className="flex items-center space-x-0.5 bg-ui-input px-1 py-0.5 rounded-ui-sm border border-ui-subtle"
- title="Mesh Expansion padding around silhouette"
+ title={t('Mesh Expansion padding around silhouette')}
>
- <span className="text-ui-muted">Exp</span>
+ <span className="text-ui-muted">{t('Exp')}</span>
<button
type="button"
onClick={() => stepExpansion(-1)}
className="px-1 text-ui-muted hover:text-ui-primary cursor-pointer"
- title="Decrease mesh expansion"
+ title={t('Decrease mesh expansion')}
>
-
</button>
@@ -1900,7 +1912,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
type="button"
onClick={() => stepExpansion(1)}
className="px-1 text-ui-muted hover:text-ui-primary cursor-pointer"
- title="Increase mesh expansion"
+ title={t('Increase mesh expansion')}
>
+
</button>
@@ -1910,7 +1922,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={handleTogglePuppetShowMesh}
- title="Show / Hide Mesh Wireframe"
+ title={t('Show / Hide Mesh Wireframe')}
className={`px-1.5 py-0.5 rounded-ui-xs flex items-center gap-1 cursor-pointer transition-colors ${
session.puppet?.showMesh !== false
? 'bg-ui-accent-subtle text-ui-accent'
@@ -1918,7 +1930,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
}`}
>
<Grid className="w-3 h-3" />
- <span>Mesh</span>
+ <span>{t('Mesh')}</span>
</button>
{/* Selected Pin Depth & Delete Controls */}
@@ -1929,7 +1941,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={() => handleAdjustPinDepth(selectedPin.id, -1)}
- title="Send Pin Depth Backward (limb behind)"
+ title={t('Send Pin Depth Backward (limb behind)')}
className="p-0.5 rounded-ui-xs hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer"
>
<ArrowDown className="w-3 h-3" />
@@ -1937,7 +1949,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={() => handleAdjustPinDepth(selectedPin.id, 1)}
- title="Bring Pin Depth Forward (limb in front)"
+ title={t('Bring Pin Depth Forward (limb in front)')}
className="p-0.5 rounded-ui-xs hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer"
>
<ArrowUp className="w-3 h-3" />
@@ -1950,7 +1962,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={() => handleResetPinRotation(selectedPin.id)}
- title="Reset selected pin rotation to 0°"
+ title={t('Reset selected pin rotation to 0°')}
className="px-1 py-0.5 rounded-ui-xs font-ui-mono tabular-nums text-[10px] hover:bg-ui-control-hover text-ui-warning cursor-pointer"
>
{Math.round(selectedPin.rotation)}°
@@ -1958,7 +1970,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
type="button"
onClick={() => handleDeletePuppetPin(selectedPin.id)}
- title="Remove Selected Pin (Del)"
+ title={t('Remove Selected Pin (Del)')}
className="p-0.5 rounded-ui-xs text-ui-muted hover:text-ui-danger hover:bg-ui-control-hover cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -1970,19 +1982,21 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<div className="w-px h-3.5 bg-ui-subtle" />
{puppetPins.length === 0 ? (
- <span className="text-ui-secondary px-1">Click artwork to place joint pins</span>
+ <span className="text-ui-secondary px-1">{t('Click artwork to place joint pins')}</span>
) : (
<div className="flex items-center space-x-1">
<span className="font-ui-mono tabular-nums text-ui-secondary">
- {puppetPins.length} {puppetPins.length === 1 ? 'pin' : 'pins'}
+ {puppetPins.length === 1
+ ? t('{count} pin', { count: puppetPins.length })
+ : t('{count} pins', { count: puppetPins.length })}
</span>
<button
type="button"
onClick={handleClearPuppetPins}
- title="Clear All Pins"
+ title={t('Clear All Pins')}
className="px-1.5 py-0.5 rounded-ui-xs hover:bg-ui-control-hover hover:text-ui-danger cursor-pointer transition-colors"
>
- Clear
+ {tc('action', 'Clear')}
</button>
</div>
)}
@@ -1997,7 +2011,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
type="button"
disabled={!cageState.closed && cageState.points.length < 3}
onClick={() => handleSetCagePhase('deform')}
- title="Deform Mode: Drag cage vertices or edges to smoothly warp pixels"
+ title={t('Deform Mode: Drag cage vertices or edges to smoothly warp pixels')}
className={`px-1.5 py-0.5 rounded-ui-xs flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 ${
cageState.phase === 'deform'
? 'bg-ui-control-active text-ui-primary font-medium'
@@ -2005,12 +2019,12 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
}`}
>
<Move className="w-3 h-3" />
- <span>Deform</span>
+ <span>{t('Deform')}</span>
</button>
<button
type="button"
onClick={() => handleSetCagePhase('edit')}
- title="Edit Cage: Reshape rest cage, click edges to add points, right-click points to delete"
+ title={t('Edit Cage: Reshape rest cage, click edges to add points, right-click points to delete')}
className={`px-1.5 py-0.5 rounded-ui-xs flex items-center gap-1 cursor-pointer transition-colors ${
cageState.phase === 'edit'
? 'bg-ui-warning/15 text-ui-warning font-medium'
@@ -2018,7 +2032,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
}`}
>
<PenTool className="w-3 h-3" />
- <span>Edit Cage</span>
+ <span>{t('Edit Cage')}</span>
</button>
</div>
@@ -2027,37 +2041,37 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
type="button"
disabled={cageState.points.length < 3}
onClick={handleCloseCage}
- title="Close Cage Polygon"
+ title={t('Close Cage Polygon')}
className="px-1.5 py-0.5 rounded-ui-xs bg-ui-success/15 text-ui-success hover:bg-ui-success/25 disabled:opacity-40 flex items-center gap-1 cursor-pointer tabular-nums"
>
<Check className="w-3 h-3" />
- <span>Close ({cageState.points.length})</span>
+ <span>{t('Close ({count})', { count: cageState.points.length })}</span>
</button>
)}
<button
type="button"
onClick={handleStartRedrawCage}
- title="Draw a custom polygon cage around a specific region (head, arm, cloak)"
+ title={t('Draw a custom polygon cage around a specific region (head, arm, cloak)')}
className="px-1.5 py-0.5 rounded-ui-xs hover:bg-ui-control-hover hover:text-ui-primary cursor-pointer transition-colors"
>
- Redraw
+ {t('Redraw')}
</button>
<button
type="button"
onClick={handleAutoFitCage}
- title="Auto-fit tight silhouette cage around artwork"
+ title={t('Auto-fit tight silhouette cage around artwork')}
className="px-1.5 py-0.5 rounded-ui-xs hover:bg-ui-control-hover hover:text-ui-primary flex items-center gap-1 cursor-pointer transition-colors"
>
<Sparkles className="w-3 h-3" />
- <span>Auto Fit</span>
+ <span>{t('Auto Fit')}</span>
</button>
<button
type="button"
onClick={handleToggleCageMesh}
- title="Show / Hide Internal Cage Mesh"
+ title={t('Show / Hide Internal Cage Mesh')}
className={`px-1.5 py-0.5 rounded-ui-xs flex items-center gap-1 cursor-pointer transition-colors ${
cageState.showMesh
? 'bg-ui-accent-subtle text-ui-accent'
@@ -2065,14 +2079,14 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
}`}
>
<Grid className="w-3 h-3" />
- <span>Mesh</span>
+ <span>{t('Mesh')}</span>
</button>
{!cageState.closed && (
<span className="text-ui-warning px-1">
{cageState.points.length < 3
- ? 'Click to place cage vertices'
- : 'Click first vertex or Close to deform'}
+ ? t('Click to place cage vertices')
+ : t('Click first vertex or Close to deform')}
</span>
)}
</div>
diff --git a/src/components/UpdateModal.tsx b/src/components/UpdateModal.tsx
index 687250f..415c66a 100644
--- a/src/components/UpdateModal.tsx
+++ b/src/components/UpdateModal.tsx
@@ -18,6 +18,7 @@ import {
parseChangelogSections,
} from '../utils/changelog';
import { ChangelogBox } from './ChangelogBox';
+import { isImeComposing, useI18n } from '../i18n';
export interface UpdateModalProps {
hasActiveCollabSession: boolean;
@@ -28,21 +29,11 @@ function formatMegabytes(bytes: number): string {
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
}
-function formatReleaseDate(raw: string | null): string | null {
- if (!raw) return null;
- const parsed = new Date(raw);
- if (Number.isNaN(parsed.getTime())) return raw;
- return parsed.toLocaleDateString(undefined, {
- year: 'numeric',
- month: 'short',
- day: 'numeric',
- });
-}
-
export const UpdateModal: React.FC<UpdateModalProps> = ({
hasActiveCollabSession,
onSaveFirst,
}) => {
+ const { t, formatDate } = useI18n();
const isModalOpen = useUpdaterStore((s) => s.isModalOpen);
const status = useUpdaterStore((s) => s.status);
const currentVersion = useUpdaterStore((s) => s.currentVersion);
@@ -69,7 +60,9 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
const isBusy = status === 'downloading' || status === 'ready';
const hasSafetyRisk = hasUnsavedChanges || hasActiveCollabSession;
- const formattedDate = formatReleaseDate(releaseDate);
+ const formattedDate = releaseDate
+ ? formatDate(releaseDate, { year: 'numeric', month: 'short', day: 'numeric' })
+ : null;
const handleClose = () => {
if (isBusy) return;
@@ -106,10 +99,18 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
updaterService.skipAvailableVersion();
};
- const safetyWarningParts: string[] = [];
- if (hasUnsavedChanges) safetyWarningParts.push('unsaved changes');
- if (hasActiveCollabSession) safetyWarningParts.push('an active multiplayer session');
- const safetyWarningLabel = safetyWarningParts.join(' and ');
+ const safetyWarningMessage =
+ hasUnsavedChanges && hasActiveCollabSession
+ ? t(
+ 'You have unsaved changes and an active multiplayer session — save your work before installing, because Ink Studio will restart.'
+ )
+ : hasUnsavedChanges
+ ? t(
+ 'You have unsaved changes — save your work before installing, because Ink Studio will restart.'
+ )
+ : t(
+ 'You have an active multiplayer session — save your work before installing, because Ink Studio will restart.'
+ );
return (
<div
@@ -119,6 +120,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
className="fixed inset-0 z-50 flex items-center justify-center bg-ui-overlay p-4 select-none"
onClick={handleClose}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !isBusy) {
handleClose();
}
@@ -133,7 +135,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<div className="flex items-center gap-2">
<ArrowDownToLine className="w-3.5 h-3.5 text-ui-accent" />
<span id="update-modal-title" className="text-xs font-medium text-ui-primary">
- Software Update
+ {t('Software Update')}
</span>
</div>
{!isBusy && (
@@ -141,8 +143,8 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
type="button"
onClick={handleClose}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
- title="Close (Esc)"
- aria-label="Close update modal"
+ title={t('Close (Esc)')}
+ aria-label={t('Close update modal')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -156,10 +158,10 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<Loader2 className="w-6 h-6 text-ui-accent animate-spin" />
<div className="space-y-1">
<div className="text-xs font-medium text-ui-primary">
- Checking for updates...
+ {t('Checking for updates...')}
</div>
<div className="text-[11px] text-ui-muted font-ui-mono tabular-nums">
- Current version: v{currentVersion}
+ {t('Current version: v{version}', { version: currentVersion })}
</div>
</div>
</div>
@@ -172,10 +174,10 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
</div>
<div className="space-y-1">
<div className="text-xs font-medium text-ui-primary">
- Ink Studio is up to date
+ {t('Ink Studio is up to date')}
</div>
<div className="text-[11px] text-ui-muted font-ui-mono tabular-nums">
- v{currentVersion} is the latest available version.
+ {t('v{version} is the latest available version.', { version: currentVersion })}
</div>
</div>
</div>
@@ -187,10 +189,10 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<AlertTriangle className="w-4 h-4 text-ui-danger shrink-0 mt-0.5" />
<div className="space-y-1 min-w-0">
<div className="text-xs font-medium text-ui-primary">
- Update check failed
+ {t('Update check failed')}
</div>
<div className="text-[11px] text-ui-muted break-words">
- {errorMessage || 'Unable to reach the update server.'}
+ {errorMessage || t('Unable to reach the update server.')}
</div>
</div>
</div>
@@ -200,10 +202,10 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
{status === 'idle' && (
<div className="py-6 flex flex-col items-center justify-center gap-2 text-center">
<div className="text-xs font-medium text-ui-primary">
- Check for Ink Studio updates
+ {t('Check for Ink Studio updates')}
</div>
<div className="text-[11px] text-ui-muted font-ui-mono tabular-nums">
- Installed version: v{currentVersion}
+ {t('Installed version: v{version}', { version: currentVersion })}
</div>
</div>
)}
@@ -214,7 +216,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<div className="p-3.5 rounded-ui-md bg-ui-header border border-ui-subtle flex items-center justify-between gap-3">
<div className="space-y-0.5">
<div className="text-[10px] uppercase tracking-wider text-ui-muted">
- Version Update
+ {t('Version Update')}
</div>
<div className="flex items-center gap-2 font-ui-mono tabular-nums text-xs">
<span className="text-ui-muted">v{currentVersion}</span>
@@ -233,7 +235,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
{/* Scrollable release notes (structured Markdown or plain-text fallback) */}
<div className="space-y-1.5">
- <div className="text-[11px] font-medium text-ui-primary">Release Notes</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Release Notes')}</div>
{(() => {
const rawNotes = releaseNotes?.trim() || '';
if (rawNotes && hasStructuredChangelogMarkdown(rawNotes)) {
@@ -254,7 +256,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
return (
<div className="bg-ui-header rounded-ui-md p-3 max-h-44 overflow-y-auto border border-ui-subtle select-text">
<pre className="whitespace-pre-wrap break-words font-ui-sans text-[11px] leading-relaxed text-ui-secondary">
- {rawNotes || 'Bug fixes and performance improvements.'}
+ {rawNotes || t('Bug fixes and performance improvements.')}
</pre>
</div>
);
@@ -268,8 +270,8 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<span className="text-ui-primary font-medium flex items-center gap-1.5">
<Loader2 className="w-3.5 h-3.5 text-ui-accent animate-spin" />
{status === 'ready'
- ? 'Installing update & restarting...'
- : 'Downloading update...'}
+ ? t('Installing update & restarting...')
+ : t('Downloading update...')}
</span>
<span className="font-ui-mono tabular-nums text-ui-muted">
{totalBytes
@@ -301,12 +303,11 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
<div className="space-y-1 text-[11px]">
<div className="font-medium text-ui-warning">
{confirmingGuard
- ? 'Confirm Restart Before Installing'
- : 'Active Work Detected'}
+ ? t('Confirm Restart Before Installing')
+ : t('Active Work Detected')}
</div>
<p className="text-ui-secondary leading-relaxed">
- You have {safetyWarningLabel} — save your work before installing, because Ink
- Studio will restart.
+ {safetyWarningMessage}
</p>
</div>
</div>
@@ -325,7 +326,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
onClick={() => setConfirmingGuard(false)}
className="px-2.5 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer"
>
- Back
+ {t('Back')}
</button>
<div className="flex items-center gap-2">
{hasUnsavedChanges && onSaveFirst && (
@@ -335,7 +336,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
className="flex items-center gap-1.5 px-3 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary font-medium transition-colors cursor-pointer"
>
<Save className="w-3.5 h-3.5" />
- <span>Save First</span>
+ <span>{t('Save First')}</span>
</button>
)}
<button
@@ -344,7 +345,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
className="flex items-center gap-1.5 px-3 py-1.5 rounded-ui-sm bg-ui-warning/20 hover:bg-ui-warning/30 border border-ui-warning/50 text-ui-warning font-semibold transition-colors cursor-pointer"
>
<ArrowDownToLine className="w-3.5 h-3.5" />
- <span>Install &amp; Restart Anyway</span>
+ <span>{t('Install & Restart Anyway')}</span>
</button>
</div>
</>
@@ -355,7 +356,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
onClick={handleSkipVersion}
className="px-2.5 py-1.5 rounded-ui-sm text-[11px] text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
- Skip This Version
+ {t('Skip This Version')}
</button>
<div className="flex items-center gap-2">
<button
@@ -363,7 +364,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
onClick={handleLater}
className="px-3 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary transition-colors cursor-pointer"
>
- Later
+ {t('Later')}
</button>
<button
type="button"
@@ -371,14 +372,14 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
className="flex items-center gap-1.5 px-3.5 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium transition-opacity cursor-pointer"
>
<ArrowDownToLine className="w-3.5 h-3.5" />
- <span>Download &amp; Install</span>
+ <span>{t('Download & Install')}</span>
</button>
</div>
</>
)
) : status === 'downloading' || status === 'ready' ? (
<div className="w-full text-right text-[11px] text-ui-muted">
- Please keep Ink Studio open until the update completes.
+ {t('Please keep Ink Studio open until the update completes.')}
</div>
) : (
<>
@@ -391,7 +392,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
className="flex items-center gap-1.5 px-3 py-1.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary transition-colors cursor-pointer"
>
<RefreshCw className="w-3 h-3" />
- <span>{status === 'error' ? 'Retry' : 'Check Again'}</span>
+ <span>{status === 'error' ? t('Retry') : t('Check Again')}</span>
</button>
)}
<button
@@ -399,7 +400,7 @@ export const UpdateModal: React.FC<UpdateModalProps> = ({
onClick={handleClose}
className="px-3.5 py-1.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 font-medium transition-opacity cursor-pointer"
>
- Close
+ {t('Close')}
</button>
</div>
</>
diff --git a/src/components/UpdateToast.tsx b/src/components/UpdateToast.tsx
index c9c7c69..19f922c 100644
--- a/src/components/UpdateToast.tsx
+++ b/src/components/UpdateToast.tsx
@@ -3,8 +3,10 @@ import { ArrowDownToLine, ArrowRight, X } from 'lucide-react';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
import { updaterService } from '../services/updaterService';
import { useUpdaterStore } from '../stores/useUpdaterStore';
+import { useI18n } from '../i18n';
export const UpdateToast: React.FC = () => {
+ const { t } = useI18n();
const status = useUpdaterStore((s) => s.status);
const availableVersion = useUpdaterStore((s) => s.availableVersion);
const isBannerDismissed = useUpdaterStore((s) => s.isBannerDismissed);
@@ -29,14 +31,14 @@ export const UpdateToast: React.FC = () => {
<div className="min-w-0">
<div className="flex items-center gap-1.5">
<span className="text-[11px] font-semibold text-ui-primary">
- Update Available
+ {t('Update Available')}
</span>
<span className="px-1.5 py-0.5 rounded-ui-xs bg-ui-header border border-ui-subtle font-ui-mono tabular-nums text-[10px] text-ui-accent">
v{availableVersion}
</span>
</div>
<div className="text-[10px] text-ui-muted mt-0.5">
- A new version of Ink Studio is ready to install
+ {t('A new version of Ink Studio is ready to install')}
</div>
</div>
@@ -46,7 +48,7 @@ export const UpdateToast: React.FC = () => {
onClick={() => updaterService.openUpdateModal()}
className="flex items-center gap-1 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:bg-ui-accent-hover px-2.5 py-1.5 text-[11px] font-medium transition-colors cursor-pointer"
>
- <span>View &amp; Install</span>
+ <span>{t('View & Install')}</span>
<ArrowRight className="w-3 h-3" />
</button>
@@ -54,8 +56,8 @@ export const UpdateToast: React.FC = () => {
type="button"
onClick={() => updaterService.dismissBanner()}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:bg-ui-control-hover hover:text-ui-primary transition-colors cursor-pointer"
- title="Dismiss notification"
- aria-label="Dismiss update notification"
+ title={t('Dismiss notification')}
+ aria-label={t('Dismiss update notification')}
>
<X className="w-3.5 h-3.5" />
</button>
diff --git a/src/components/WebLandingModal.tsx b/src/components/WebLandingModal.tsx
index be8e39f..159a3c9 100644
--- a/src/components/WebLandingModal.tsx
+++ b/src/components/WebLandingModal.tsx
@@ -9,6 +9,7 @@ import {
} from '../services/multiplayerService';
import { NICKNAME_CUSTOMIZED_STORAGE_KEY, NICKNAME_STORAGE_KEY } from '../types/settings';
import { safeLocalStorageSetItem } from '../utils/safeStorage';
+import { isImeComposing, useI18n } from '../i18n';
function isP2pInvite(
invite: ParsedCollabTarget | ParsedInviteLink
@@ -41,6 +42,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
onJoinTargetInBrowser,
onDismiss,
}) => {
+ const { t } = useI18n();
const [userName, setUserName] = useState(() => {
if (typeof window === 'undefined') return '';
try {
@@ -57,6 +59,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
useEffect(() => {
if (!isVisible) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.preventDefault();
onDismiss();
@@ -146,15 +149,15 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
<div className="flex items-center gap-2 min-w-0">
<Users className="w-3.5 h-3.5 text-ui-accent shrink-0" />
<h2 id="web-landing-modal-title" className="text-xs font-medium text-ui-primary truncate">
- Ink Studio Collab
+ {t('Ink Studio Collab')}
</h2>
</div>
<button
type="button"
onClick={onDismiss}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer shrink-0"
- title="Close (Esc)"
- aria-label="Close connection dialog"
+ title={t('Close (Esc)')}
+ aria-label={t('Close connection dialog')}
>
<X className="w-3.5 h-3.5" />
</button>
@@ -166,7 +169,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
<div className="rounded-ui-md border border-ui-subtle bg-ui-header p-3.5 space-y-1">
<div className="flex items-center justify-between gap-2">
<span className="text-[10px] uppercase tracking-wider text-ui-muted">
- Connecting to Canvas
+ {t('Connecting to Canvas')}
</span>
{(p2pMode || isSecureWs) && (
<span className="font-ui-mono text-[10px] px-1.5 py-0.5 rounded-ui-xs bg-ui-control border border-ui-subtle text-ui-secondary">
@@ -181,7 +184,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
className="text-[11px] text-ui-muted font-ui-mono tabular-nums truncate select-text"
title={hostDisplay}
>
- Host: {hostDisplay}
+ {t('Host: {host}', { host: hostDisplay })}
</div>
</div>
@@ -192,8 +195,8 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
htmlFor="web-landing-nickname"
className="flex items-center justify-between text-[11px] font-medium text-ui-primary"
>
- <span>Choose a Nickname</span>
- <span className="font-normal text-ui-muted">Optional</span>
+ <span>{t('Choose a Nickname')}</span>
+ <span className="font-normal text-ui-muted">{t('Optional')}</span>
</label>
<input
id="web-landing-nickname"
@@ -202,7 +205,12 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
maxLength={40}
value={userName}
onChange={(e) => setUserName(e.target.value)}
- placeholder="Enter nickname..."
+ onKeyDown={(e) => {
+ if (isImeComposing(e) && e.key === 'Enter') {
+ e.preventDefault();
+ }
+ }}
+ placeholder={t('Enter nickname...')}
className="w-full rounded-ui-sm bg-ui-input border border-ui-default px-3 py-2 text-xs text-ui-primary placeholder:text-ui-muted/60 focus:border-ui-focus outline-none"
/>
</div>
@@ -216,7 +224,9 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
<span className="flex items-center gap-2 min-w-0">
<Globe className="w-3.5 h-3.5 shrink-0" />
<span className="truncate">
- {trimmedName ? `Join as "${trimmedName}"` : 'Join in Browser'}
+ {trimmedName
+ ? t('Join as "{name}"', { name: trimmedName })
+ : t('Join in Browser')}
</span>
</span>
<ArrowRight className="w-3.5 h-3.5 shrink-0" />
@@ -229,7 +239,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
>
<span className="flex items-center gap-2">
<User className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Play as Guest</span>
+ <span>{t('Play as Guest')}</span>
</span>
<ArrowRight className="w-3.5 h-3.5 text-ui-icon-muted" />
</button>
@@ -241,7 +251,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
>
<span className="flex items-center gap-2">
<Monitor className="w-3.5 h-3.5 text-ui-accent" />
- <span>Open in Ink Studio App</span>
+ <span>{t('Open in Ink Studio App')}</span>
</span>
<ArrowRight className="w-3.5 h-3.5 text-ui-icon-muted" />
</button>
@@ -252,7 +262,7 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
{/* Footer */}
<div className="px-4 py-2.5 bg-ui-header border-t border-ui-subtle text-center">
<span className="text-[10px] text-ui-muted">
- Supports graphic tablets, stylus pressure, and real-time synchronization.
+ {t('Supports graphic tablets, stylus pressure, and real-time synchronization.')}
</span>
</div>
</div>
diff --git a/src/components/WebtoonExportModal.tsx b/src/components/WebtoonExportModal.tsx
index 5106c5a..8712706 100644
--- a/src/components/WebtoonExportModal.tsx
+++ b/src/components/WebtoonExportModal.tsx
@@ -7,6 +7,7 @@ import {
saveWebtoonZipWithDialog,
WebtoonRegionRenderer,
} from '../utils/webtoonExporter';
+import { isImeComposing, useI18n } from '../i18n';
interface WebtoonExportModalProps {
isOpen: boolean;
@@ -27,6 +28,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
canvasHeight,
documentTitle = 'webtoon_chapter',
}) => {
+ const { t } = useI18n();
const [sliceHeight, setSliceHeight] = useState(1280);
const [format, setFormat] = useState<'jpg' | 'png'>('jpg');
const [quality, setQuality] = useState(92);
@@ -36,6 +38,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape' && !isExporting) {
e.preventDefault();
e.stopPropagation();
@@ -105,8 +108,8 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
setIsExporting(false);
setProgress(null);
void uiStoreActions.alertDialog({
- title: 'Webtoon Export Failed',
- message: 'Failed to export webtoon slices.',
+ title: t('Webtoon Export Failed'),
+ message: t('Failed to export webtoon slices.'),
detail: err instanceof Error ? err.message : undefined,
});
}
@@ -129,14 +132,14 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
{/* Header */}
<div className="h-10 px-4 bg-ui-header border-b border-ui-subtle flex items-center justify-between">
<h2 id="webtoon-export-modal-title" className="text-xs font-medium text-ui-primary">
- Webtoon Chapter Slicer
+ {t('Webtoon Chapter Slicer')}
</h2>
{!isExporting && (
<button
type="button"
onClick={onClose}
- aria-label="Close"
- title="Cancel (Esc)"
+ aria-label={t('Close')}
+ title={t('Cancel (Esc)')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
@@ -148,22 +151,24 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
<div className="p-4 space-y-4 text-xs">
<div className="bg-ui-header p-3 rounded-ui-md border border-ui-subtle space-y-1">
<div className="flex justify-between">
- <span className="text-ui-muted">Canvas Dimensions</span>
+ <span className="text-ui-muted">{t('Canvas Dimensions')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{canvasWidth} × {canvasHeight} px</span>
</div>
<div className="flex justify-between">
- <span className="text-ui-muted">Total Slices</span>
- <span className="font-ui-mono tabular-nums text-ui-accent font-medium">{totalSlices} tiles</span>
+ <span className="text-ui-muted">{t('Total Slices')}</span>
+ <span className="font-ui-mono tabular-nums text-ui-accent font-medium">
+ {t('{count} tiles', { count: totalSlices })}
+ </span>
</div>
<div className="flex justify-between">
- <span className="text-ui-muted">Tile Dimensions</span>
+ <span className="text-ui-muted">{t('Tile Dimensions')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{canvasWidth} × {sliceHeight} px</span>
</div>
</div>
<div className="space-y-1.5">
<div className="flex justify-between">
- <label className="text-[11px] text-ui-muted">Slice Tile Height</label>
+ <label className="text-[11px] text-ui-muted">{t('Slice Tile Height')}</label>
<span className="font-ui-mono tabular-nums text-ui-primary">{sliceHeight}px</span>
</div>
<div className="flex gap-1.5">
@@ -185,7 +190,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
</div>
<div className="space-y-1.5">
- <label className="text-[11px] text-ui-muted">Output Format</label>
+ <label className="text-[11px] text-ui-muted">{t('Output Format')}</label>
<div className="grid grid-cols-2 gap-1.5">
<button
type="button"
@@ -196,7 +201,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
: 'bg-ui-header border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- JPEG (Standard)
+ {t('JPEG (Standard)')}
</button>
<button
type="button"
@@ -207,7 +212,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
: 'bg-ui-header border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- PNG (Lossless)
+ {t('PNG (Lossless)')}
</button>
</div>
</div>
@@ -215,7 +220,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
{format === 'jpg' && (
<div className="space-y-1.5">
<div className="flex justify-between text-[11px]">
- <span className="text-ui-muted">JPEG Quality</span>
+ <span className="text-ui-muted">{t('JPEG Quality')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{quality}%</span>
</div>
<input
@@ -234,7 +239,12 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
<div className="flex justify-between text-[11px]">
<span className="text-ui-primary flex items-center gap-1.5 tabular-nums">
<Loader2 className="w-3.5 h-3.5 animate-spin text-ui-accent" />
- <span>Slicing tile {progress.current} of {progress.total}...</span>
+ <span>
+ {t('Slicing tile {current} of {total}...', {
+ current: progress.current,
+ total: progress.total,
+ })}
+ </span>
</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{progress.percent}%</span>
</div>
@@ -256,7 +266,7 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
onClick={onClose}
className="px-3.5 py-1.5 bg-ui-control hover:bg-ui-control-hover border border-ui-default text-ui-primary rounded-ui-sm text-xs font-medium transition-colors cursor-pointer"
>
- Cancel
+ {t('Cancel')}
</button>
)}
<button
@@ -265,7 +275,9 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
disabled={isExporting}
className="px-3.5 py-1.5 rounded-ui-sm text-xs font-medium bg-ui-accent text-ui-accent-contrast hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed tabular-nums"
>
- {isExporting ? 'Packaging ZIP...' : `Export ${totalSlices} Tiles (.ZIP)`}
+ {isExporting
+ ? t('Packaging ZIP...')
+ : t('Export {count} Tiles (.ZIP)', { count: totalSlices })}
</button>
</div>
</div>
diff --git a/src/components/WelcomeScreen.tsx b/src/components/WelcomeScreen.tsx
index d50539b..3ed437c 100644
--- a/src/components/WelcomeScreen.tsx
+++ b/src/components/WelcomeScreen.tsx
@@ -3,15 +3,17 @@ import {
Bug,
FilePlus,
FolderOpen,
+ Globe,
Plus,
Search,
Star,
X,
} from 'lucide-react';
+import { uiStoreActions, useUiStore } from '../stores';
+import { isImeComposing, useI18n } from '../i18n';
import type { CanvasColorMode, NewCanvasOptions } from '../types/editor';
import type { ChromeStyle, DensityPreset } from '../types/appearance';
import { ThemePreset } from '../types/settings';
-import { useUiStore } from '../stores';
import {
RecentDocument,
formatFileSize,
@@ -121,25 +123,6 @@ function formatExtensionTag(doc: RecentDocument): string {
return clean || 'INK';
}
-function formatShortDate(timestamp?: number): string {
- if (!timestamp || !Number.isFinite(timestamp)) return '';
- const diffMs = Date.now() - timestamp;
- if (diffMs < 60_000) return 'Just now';
- if (diffMs < 3_600_000) return `${Math.floor(diffMs / 60_000)}m ago`;
- if (diffMs < 86_400_000) return `${Math.floor(diffMs / 3_600_000)}h ago`;
- const days = Math.floor(diffMs / 86_400_000);
- if (days === 1) return 'Yesterday';
- if (days < 7) return `${days}d ago`;
- try {
- return new Date(timestamp).toLocaleDateString(undefined, {
- month: 'short',
- day: 'numeric',
- });
- } catch {
- return '';
- }
-}
-
const DENSITY_LAYOUT: Record<
DensityPreset,
{
@@ -177,6 +160,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
onSelectRecentDocument,
showToast,
}) => {
+ const { lang, t, td } = useI18n();
const appearance = useUiStore((s) => s.appSettings.appearance);
const density: DensityPreset = appearance.density ?? 'balanced';
const chromeStyle: ChromeStyle = appearance.chromeStyle ?? 'hairline';
@@ -203,7 +187,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
return;
}
onCreateQuickCanvas({
- name: `${preset.label}*`,
+ name: `${td(preset.label)}*`,
width: preset.width,
height: preset.height,
dpi: preset.dpi,
@@ -223,7 +207,11 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
setDocuments((prev) =>
prev.map((d) => (d.id === doc.id ? { ...d, isStarred: newStarred } : d))
);
- showToast(newStarred ? `Pinned "${doc.title}"` : `Unpinned "${doc.title}"`);
+ showToast(
+ newStarred
+ ? t('Pinned "{title}"', { title: doc.title })
+ : t('Unpinned "{title}"', { title: doc.title })
+ );
};
const handleOpenDelete = (doc: RecentDocument, e: React.MouseEvent) => {
@@ -237,7 +225,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
await removeRecentDocument(doc.id);
setDocuments((prev) => prev.filter((d) => d.id !== doc.id));
setDeleteTargetDoc(null);
- showToast(`Removed "${doc.title}"`);
+ showToast(t('Removed "{title}"', { title: doc.title }));
};
const handlePermanentDelete = async (doc: RecentDocument) => {
@@ -245,7 +233,9 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
const result = await permanentlyDeleteDocument(doc);
setDocuments((prev) => prev.filter((d) => d.id !== doc.id));
setDeleteTargetDoc(null);
- showToast(result.success ? `Deleted "${doc.title}"` : 'Removed from list');
+ showToast(
+ result.success ? t('Deleted "{title}"', { title: doc.title }) : t('Removed from list')
+ );
};
const cleanQuery = searchQuery.trim().toLowerCase();
@@ -338,7 +328,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
</span>
</div>
<h1 className="text-[14px] font-medium tracking-[-0.01em] text-ui-primary truncate mt-0.5 leading-tight">
- {trimmedName ? `Welcome back, ${trimmedName}` : 'Studio Workspace'}
+ {trimmedName ? t('Welcome back, {name}', { name: trimmedName }) : t('Studio Workspace')}
</h1>
</div>
</div>
@@ -351,15 +341,21 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
- placeholder="Search projects..."
- aria-label="Search recent documents"
+ onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
+ if (e.key === 'Escape' && searchQuery) {
+ setSearchQuery('');
+ }
+ }}
+ placeholder={t('Search projects...')}
+ aria-label={t('Search recent documents')}
className="w-full h-[var(--ui-control-height)] pl-8 pr-7 text-[11.5px] bg-ui-input border border-ui-subtle hover:border-ui-default focus:border-ui-focus rounded-ui-sm text-ui-primary placeholder:text-ui-muted transition-colors"
/>
{searchQuery && (
<button
type="button"
onClick={() => setSearchQuery('')}
- aria-label="Clear search"
+ aria-label={t('Clear search')}
className="absolute right-2 top-1/2 -translate-y-1/2 text-ui-muted hover:text-ui-primary cursor-pointer"
>
<X className="w-3 h-3" />
@@ -374,7 +370,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
className={`ui-icon-stroke h-[var(--ui-control-height)] flex items-center gap-1.5 px-3 bg-ui-accent text-ui-accent-contrast text-[11.5px] font-medium transition-opacity hover:opacity-90 cursor-pointer shrink-0 ${primaryBtnChrome}`}
>
<FilePlus className="w-3.5 h-3.5" />
- <span>New Canvas</span>
+ <span>{t('New Canvas')}</span>
</button>
<button
@@ -384,11 +380,29 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
className={`ui-icon-stroke h-[var(--ui-control-height)] flex items-center gap-1.5 px-3 text-[11.5px] font-medium text-ui-primary transition-colors cursor-pointer shrink-0 ${secondaryBtnChrome}`}
>
<FolderOpen className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Open File</span>
+ <span>{t('Open File')}</span>
+ </button>
+
+ <button
+ type="button"
+ data-testid="welcome-language-toggle"
+ onClick={() => {
+ const next = lang === 'ja' ? 'en' : 'ja';
+ uiStoreActions.setLanguage(next);
+ showToast(
+ next === 'ja' ? '表示言語を日本語に変更しました' : 'Language changed to English'
+ );
+ }}
+ title={lang === 'ja' ? 'Switch to English' : '日本語に切り替え'}
+ aria-label={lang === 'ja' ? 'Switch language to English' : '表示言語を日本語に切り替え'}
+ className={`ui-icon-stroke h-[var(--ui-control-height)] flex items-center gap-1 px-2 text-[11px] font-medium text-ui-secondary hover:text-ui-primary transition-colors cursor-pointer shrink-0 ${secondaryBtnChrome}`}
+ >
+ <Globe className="w-3.5 h-3.5 text-ui-icon-muted" />
+ <span>{lang === 'ja' ? 'EN' : '日本語'}</span>
</button>
<nav
- aria-label="Community and project links"
+ aria-label={t('Community and project links')}
data-testid="welcome-social-links"
data-chrome-style={chromeStyle}
className={socialGroupChrome}
@@ -404,8 +418,8 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
e.preventDefault();
void openExternalUrl(link.url);
}}
- title={link.title}
- aria-label={link.title}
+ title={td(link.title)}
+ aria-label={td(link.title)}
className={socialItemChrome}
>
{link.renderIcon(socialIconSize)}
@@ -419,13 +433,13 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
{/* Main Atelier Content */}
<main className={`max-w-5xl w-full mx-auto flex-1 flex flex-col ${layout.containerPad} ${layout.sectionGap}`}>
{/* 1. Quick-Start Canvas Strip */}
- <section aria-label="Quick-Start Canvases" className="space-y-2.5">
+ <section aria-label={t('Quick-Start Canvases')} className="space-y-2.5">
<div className="flex items-center justify-between border-b border-ui-subtle pb-1.5">
<h2 className="text-[10.5px] font-medium uppercase tracking-[0.08em] text-ui-muted">
- Quick-Start Sheets
+ {t('Quick-Start Sheets')}
</h2>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- 1-click canvas
+ {t('1-click canvas')}
</span>
</div>
@@ -468,7 +482,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
{/* Title & Exact Technical Spec */}
<div className="text-[11.5px] font-medium text-ui-primary truncate leading-tight">
- {preset.label}
+ {td(preset.label)}
</div>
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted mt-0.5 truncate">
{preset.width} × {preset.height} · {preset.dpi}dpi
@@ -490,10 +504,10 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
</div>
</div>
<div className="text-[11.5px] font-medium text-ui-primary truncate leading-tight">
- Custom...
+ {t('Custom...')}
</div>
<div className="text-[10px] font-ui-mono tabular-nums text-ui-muted mt-0.5 truncate">
- Size, DPI &amp; mode
+ {t('Size, DPI & mode')}
</div>
</button>
</div>
@@ -501,12 +515,12 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
{/* 2. Pinned / Starred Projects */}
{starredDocs.length > 0 && (
- <section aria-label="Pinned Projects" className="space-y-2.5">
+ <section aria-label={t('Pinned Projects')} className="space-y-2.5">
<div className="flex items-center justify-between border-b border-ui-subtle pb-1.5">
<div className="flex items-center gap-1.5">
<Star className="w-3 h-3 text-ui-warning fill-current" />
<h2 className="text-[10.5px] font-medium uppercase tracking-[0.08em] text-ui-muted">
- Pinned
+ {t('Pinned')}
</h2>
</div>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
@@ -532,13 +546,15 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
)}
{/* 3. Recent Projects Gallery */}
- <section aria-label="Recent Projects" className="space-y-2.5 flex-1 flex flex-col">
+ <section aria-label={t('Recent Projects')} className="space-y-2.5 flex-1 flex flex-col">
<div className="flex items-center justify-between border-b border-ui-subtle pb-1.5">
<h2 className="text-[10.5px] font-medium uppercase tracking-[0.08em] text-ui-muted">
- Recent Projects
+ {t('Recent Projects')}
</h2>
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- {filtered.length} {filtered.length === 1 ? 'file' : 'files'}
+ {filtered.length === 1
+ ? t('{n} file', { n: filtered.length })
+ : t('{n} files', { n: filtered.length })}
</span>
</div>
@@ -553,12 +569,14 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
<span className="w-4 h-px bg-ui-subtle" />
</div>
<p className="text-xs font-medium text-ui-primary">
- {cleanQuery ? `No projects matching "${searchQuery.trim()}"` : 'Your drafting table is clear'}
+ {cleanQuery
+ ? t('No projects matching "{query}"', { query: searchQuery.trim() })
+ : t('Your drafting table is clear')}
</p>
<p className="text-[11px] text-ui-muted mt-1 max-w-sm">
{cleanQuery
- ? 'Try a different filename or clear the search filter.'
- : 'Pick a quick-start sheet above or open an existing .ink, .psd, or image file.'}
+ ? t('Try a different filename or clear the search filter.')
+ : t('Pick a quick-start sheet above or open an existing .ink, .psd, or image file.')}
</p>
<div className="flex items-center gap-2 mt-4">
{cleanQuery ? (
@@ -567,7 +585,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
onClick={() => setSearchQuery('')}
className="h-[var(--ui-control-height)] px-3 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-primary transition-colors cursor-pointer"
>
- Clear Filter
+ {t('Clear Filter')}
</button>
) : (
<>
@@ -577,7 +595,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
className="h-[var(--ui-control-height)] flex items-center gap-1.5 px-3 rounded-ui-sm bg-ui-accent text-ui-accent-contrast text-[11px] font-medium hover:opacity-90 transition-opacity cursor-pointer"
>
<FilePlus className="w-3.5 h-3.5" />
- <span>New Canvas</span>
+ <span>{t('New Canvas')}</span>
</button>
<button
type="button"
@@ -585,7 +603,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
className="h-[var(--ui-control-height)] flex items-center gap-1.5 px-3 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[11px] text-ui-primary transition-colors cursor-pointer"
>
<FolderOpen className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Open File</span>
+ <span>{t('Open File')}</span>
</button>
</>
)}
@@ -617,10 +635,10 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
className={`mt-auto flex flex-wrap items-center justify-between gap-2 ${footerChrome}`}
>
<span className="text-[10px] font-ui-mono text-ui-muted">
- Ink Studio · Free &amp; Open Source
+ {t('Ink Studio · Free & Open Source')}
</span>
<nav
- aria-label="Community and support links"
+ aria-label={t('Community and support links')}
className="flex flex-wrap items-center gap-1"
>
{COMMUNITY_LINKS.map((link) => (
@@ -634,11 +652,11 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
e.preventDefault();
void openExternalUrl(link.url);
}}
- title={link.title}
+ title={td(link.title)}
className={footerLinkChrome}
>
{link.renderIcon('w-3 h-3 shrink-0')}
- <span>{link.label}</span>
+ <span>{td(link.label)}</span>
</a>
))}
<a
@@ -650,11 +668,11 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
e.preventDefault();
void openExternalUrl(GITHUB_ISSUES_URL);
}}
- title="Report a bug or request a feature on GitHub"
+ title={t('Report a bug or request a feature on GitHub')}
className={footerLinkChrome}
>
<Bug className="w-3 h-3 shrink-0" />
- <span>Issues</span>
+ <span>{t('Issues')}</span>
</a>
</nav>
</footer>
@@ -691,8 +709,9 @@ const DocCard: React.FC<DocCardProps> = ({
onToggleStar,
onDelete,
}) => {
+ const { t, formatRelativeTime } = useI18n();
const extTag = formatExtensionTag(doc);
- const dateLabel = formatShortDate(doc.lastOpened);
+ const dateLabel = formatRelativeTime(doc.lastOpened);
const hasDimensions =
typeof doc.width === 'number' &&
doc.width > 0 &&
@@ -705,6 +724,7 @@ const DocCard: React.FC<DocCardProps> = ({
tabIndex={0}
onClick={onSelect}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
onSelect();
@@ -747,8 +767,16 @@ const DocCard: React.FC<DocCardProps> = ({
<button
type="button"
onClick={onToggleStar}
- title={doc.isStarred ? `Unpin ${doc.title}` : `Pin ${doc.title}`}
- aria-label={doc.isStarred ? `Unpin ${doc.title}` : `Pin ${doc.title}`}
+ title={
+ doc.isStarred
+ ? t('Unpin {title}', { title: doc.title })
+ : t('Pin {title}', { title: doc.title })
+ }
+ aria-label={
+ doc.isStarred
+ ? t('Unpin {title}', { title: doc.title })
+ : t('Pin {title}', { title: doc.title })
+ }
aria-pressed={doc.isStarred}
className={`w-5 h-5 rounded-ui-xs bg-ui-floating border border-ui-subtle flex items-center justify-center cursor-pointer transition-opacity ${
doc.isStarred
@@ -761,8 +789,8 @@ const DocCard: React.FC<DocCardProps> = ({
<button
type="button"
onClick={onDelete}
- title={`Remove ${doc.title}`}
- aria-label={`Remove ${doc.title}`}
+ title={t('Remove {title}', { title: doc.title })}
+ aria-label={t('Remove {title}', { title: doc.title })}
className="w-5 h-5 rounded-ui-xs bg-ui-floating border border-ui-subtle text-ui-muted hover:text-ui-danger flex items-center justify-center opacity-0 group-hover:opacity-100 focus:opacity-100 cursor-pointer transition-opacity"
>
<X className="w-3 h-3" />
diff --git a/src/components/WindowControls.tsx b/src/components/WindowControls.tsx
index a656597..53eb4c5 100644
--- a/src/components/WindowControls.tsx
+++ b/src/components/WindowControls.tsx
@@ -2,12 +2,14 @@ import React, { useState, useEffect, useCallback } from 'react';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
import { ThemePreset } from '../types/settings';
import { requestAppClose } from '../utils/appCloseFlow';
+import { useI18n } from '../i18n';
interface WindowControlsProps {
themePreset?: ThemePreset;
}
export const WindowControls: React.FC<WindowControlsProps> = () => {
+ const { t, tc } = useI18n();
const [isTauri, setIsTauri] = useState(false);
const [isMaximized, setIsMaximized] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false);
@@ -141,7 +143,7 @@ export const WindowControls: React.FC<WindowControlsProps> = () => {
type="button"
onClick={handleMinimize}
tabIndex={-1}
- title="Minimize"
+ title={t('Minimize')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<span className="w-2.5 h-[1.5px] bg-current rounded-full" />
@@ -151,7 +153,7 @@ export const WindowControls: React.FC<WindowControlsProps> = () => {
type="button"
onClick={handleToggleMaximize}
tabIndex={-1}
- title={isFullscreen ? 'Exit Fullscreen' : isMaximized ? 'Restore' : 'Maximize'}
+ title={isFullscreen ? t('Exit Fullscreen') : isMaximized ? tc('window', 'Restore') : t('Maximize')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<span className="w-2.5 h-2.5 border-[1.25px] border-current rounded-[1px]" />
@@ -161,7 +163,7 @@ export const WindowControls: React.FC<WindowControlsProps> = () => {
type="button"
onClick={handleClose}
tabIndex={-1}
- title="Close"
+ title={tc('action', 'Close')}
className="w-6 h-6 rounded-ui-sm flex items-center justify-center text-ui-muted hover:text-white hover:bg-ui-danger transition-colors cursor-pointer"
>
<svg width="9" height="9" viewBox="0 0 9 9" fill="none" stroke="currentColor" strokeWidth="1.3">
diff --git a/src/components/WorkspaceAndBarsTab.tsx b/src/components/WorkspaceAndBarsTab.tsx
index 23883b5..400f69d 100644
--- a/src/components/WorkspaceAndBarsTab.tsx
+++ b/src/components/WorkspaceAndBarsTab.tsx
@@ -28,6 +28,7 @@ import {
} from '../stores';
import { IconButton, ToggleSwitch } from './ui';
import { saveFileWithDialog } from '../utils/fileSaveDialog';
+import { isImeComposing, t as translateStatic, useI18n } from '../i18n';
export interface WorkspaceAndBarsTabProps {
onNotify: (message: string) => void;
@@ -66,15 +67,16 @@ async function saveWorkspaceBundleFile(fileName: string, json: string) {
data: json,
suggestedName: fileName,
mimeType: 'application/json',
- description: 'Ink Studio Workspace',
+ description: translateStatic('Ink Studio Workspace'),
extensions: ['.inkworkspace', '.json'],
category: 'workspace',
- title: 'Save Workspace As',
+ title: translateStatic('Save Workspace As'),
});
}
export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.memo(
({ onNotify }) => {
+ const { t, td } = useI18n();
const activePreset = useWorkspaceStore((s) => s.activePreset);
const activeSavedWorkspaceId = useWorkspaceStore((s) => s.activeSavedWorkspaceId);
const savedWorkspaces = useWorkspaceStore((s) => s.savedWorkspaces);
@@ -105,22 +107,22 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
setNewNameDraft('');
onNotify(
bundleAppearance
- ? `Saved workspace "${saved.name}" (+ Appearance)`
- : `Saved workspace "${saved.name}"`
+ ? t('Saved workspace "{name}" (+ Appearance)', { name: saved.name })
+ : t('Saved workspace "{name}"', { name: saved.name })
);
- }, [bundleAppearance, newNameDraft, onNotify]);
+ }, [bundleAppearance, newNameDraft, onNotify, t]);
const handleCommitRename = useCallback(
(id: string) => {
const trimmed = renameDraft.trim();
if (trimmed) {
workspaceStoreActions.renameCustomWorkspace(id, trimmed);
- onNotify(`Renamed workspace to "${trimmed}"`);
+ onNotify(t('Renamed workspace to "{name}"', { name: trimmed }));
}
setRenamingId(null);
setRenameDraft('');
},
- [onNotify, renameDraft]
+ [onNotify, renameDraft, t]
);
const handleExportCurrentBundle = useCallback(
@@ -145,15 +147,15 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
const res = await saveWorkspaceBundleFile(fileName, json);
if (res.canceled) return;
if (res.saved) {
- onNotify(`Exported ${res.fileName}`);
+ onNotify(t('Exported {fileName}', { fileName: res.fileName }));
} else {
- onNotify('Unable to export .inkworkspace file');
+ onNotify(t('Unable to export .inkworkspace file'));
}
} catch {
- onNotify('Unable to export .inkworkspace file');
+ onNotify(t('Unable to export .inkworkspace file'));
}
},
- [activePreset, activeSavedWorkspaceId, bundleAppearance, onNotify, savedWorkspaces, userName]
+ [activePreset, activeSavedWorkspaceId, bundleAppearance, onNotify, savedWorkspaces, t, userName]
);
const handleImportBundleFile = useCallback(
@@ -168,16 +170,19 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
applyAppearance: true,
});
if (!result.ok) {
- onNotify(`Import failed: ${result.error}`);
+ onNotify(t('Import failed: {error}', { error: result.error }));
return;
}
- const appNote = result.profile.appearance ? ' (+ Appearance)' : '';
- onNotify(`Imported workspace "${result.profile.name}"${appNote}`);
+ onNotify(
+ result.profile.appearance
+ ? t('Imported workspace "{name}" (+ Appearance)', { name: result.profile.name })
+ : t('Imported workspace "{name}"', { name: result.profile.name })
+ );
} catch {
- onNotify('Failed to read .inkworkspace file');
+ onNotify(t('Failed to read .inkworkspace file'));
}
},
- [onNotify]
+ [onNotify, t]
);
return (
@@ -195,20 +200,20 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary">
- Workspace Archetypes
+ {t('Workspace Archetypes')}
</span>
<button
type="button"
data-testid="workspace-tab-reset-btn"
onClick={() => {
workspaceStoreActions.resetWorkspace();
- onNotify('Workspace reset to preset defaults');
+ onNotify(t('Workspace reset to preset defaults'));
}}
className="text-[9.5px] text-ui-muted hover:text-ui-primary flex items-center gap-0.5 cursor-pointer"
- title="Reset current workspace to factory preset defaults"
+ title={t('Reset current workspace to factory preset defaults')}
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
</div>
@@ -221,10 +226,12 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
type="button"
data-testid={`workspace-tab-preset-${presetId}`}
aria-pressed={isSelected}
- title={WORKSPACE_PRESET_DESCRIPTIONS[presetId]}
+ title={td(WORKSPACE_PRESET_DESCRIPTIONS[presetId])}
onClick={() => {
workspaceStoreActions.applyPreset(presetId);
- onNotify(`Workspace: ${WORKSPACE_PRESET_LABELS[presetId]}`);
+ onNotify(
+ t('Workspace: {name}', { name: td(WORKSPACE_PRESET_LABELS[presetId]) })
+ );
}}
className={`px-2 py-1.5 rounded-ui-sm border text-left transition-colors cursor-pointer flex items-center justify-between gap-1 ${
isSelected
@@ -232,7 +239,9 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:border-ui-default hover:bg-ui-control-hover'
}`}
>
- <span className="text-[10.5px] truncate">{ARCHETYPE_SHORT_LABELS[presetId]}</span>
+ <span className="text-[10.5px] truncate">
+ {td(ARCHETYPE_SHORT_LABELS[presetId])}
+ </span>
{isSelected && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
);
@@ -247,15 +256,15 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<ToggleSwitch
data-testid="workspace-tab-left-handed-toggle"
size="xs"
- label="Left-Handed Mirror"
- description="Swaps left & right docks + floating brush HUD edge"
+ label={t('Left-Handed Mirror')}
+ description={t('Swaps left & right docks + floating brush HUD edge')}
checked={leftHandedMode}
onChange={(checked) => {
workspaceStoreActions.setLeftHandedMode(checked);
onNotify(
checked
- ? 'Left-Handed Workspace Mirror: ON'
- : 'Left-Handed Workspace Mirror: OFF'
+ ? t('Left-Handed Workspace Mirror: ON')
+ : t('Left-Handed Workspace Mirror: OFF')
);
}}
/>
@@ -265,7 +274,9 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
{/* 2b. Granular Palette Locks */}
<div data-testid="workspace-tab-locks-section" className="space-y-1.5">
<div className="flex items-center justify-between gap-1">
- <span className="text-[10.5px] font-medium text-ui-secondary">Palette Locks</span>
+ <span className="text-[10.5px] font-medium text-ui-secondary">
+ {t('Palette Locks')}
+ </span>
<button
type="button"
data-testid="workspace-tab-lock-all-btn"
@@ -274,7 +285,9 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
}
onClick={() => {
const locked = workspaceStoreActions.toggleLockAllWorkspace();
- onNotify(locked ? 'All palette locks enabled' : 'All palette locks disabled');
+ onNotify(
+ locked ? t('All palette locks enabled') : t('All palette locks disabled')
+ );
}}
className={`h-5 px-1.5 rounded-ui-xs border text-[9.5px] font-medium flex items-center gap-1 transition-colors cursor-pointer ${
workspaceLocks.lockWidth && workspaceLocks.lockHeight && workspaceLocks.lockMove
@@ -285,12 +298,12 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
{workspaceLocks.lockWidth && workspaceLocks.lockHeight && workspaceLocks.lockMove ? (
<>
<Lock className="w-2.5 h-2.5" />
- <span>Unlock All</span>
+ <span>{t('Unlock All')}</span>
</>
) : (
<>
<Unlock className="w-2.5 h-2.5" />
- <span>Lock All</span>
+ <span>{t('Lock All')}</span>
</>
)}
</button>
@@ -299,24 +312,24 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<ToggleSwitch
data-testid="workspace-tab-lock-width"
size="xs"
- label="Lock Width"
- description="Freeze dock column & side-by-side split widths"
+ label={t('Lock Width')}
+ description={t('Freeze dock column & side-by-side split widths')}
checked={workspaceLocks.lockWidth}
onChange={(v) => workspaceStoreActions.setWorkspaceLock('lockWidth', v)}
/>
<ToggleSwitch
data-testid="workspace-tab-lock-height"
size="xs"
- label="Lock Height"
- description="Freeze stacked row & bottom dock heights"
+ label={t('Lock Height')}
+ description={t('Freeze stacked row & bottom dock heights')}
checked={workspaceLocks.lockHeight}
onChange={(v) => workspaceStoreActions.setWorkspaceLock('lockHeight', v)}
/>
<ToggleSwitch
data-testid="workspace-tab-lock-move"
size="xs"
- label="Lock Position / Move"
- description="Prevent accidental tab dragging or panel undocking"
+ label={t('Lock Position / Move')}
+ description={t('Prevent accidental tab dragging or panel undocking')}
checked={workspaceLocks.lockMove}
onChange={(v) => workspaceStoreActions.setWorkspaceLock('lockMove', v)}
/>
@@ -327,10 +340,10 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary">
- Saved Workspaces
+ {t('Saved Workspaces')}
</span>
<span className="text-[9.5px] font-ui-mono tabular-nums text-ui-muted">
- {savedWorkspaces.length} saved
+ {t('{count} saved', { count: savedWorkspaces.length })}
</span>
</div>
@@ -340,12 +353,13 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<input
type="text"
data-testid="workspace-tab-save-name-input"
- aria-label="New Workspace Name"
- placeholder="e.g. Lineart, Coloring, 3D..."
+ aria-label={t('New Workspace Name')}
+ placeholder={t('e.g. Lineart, Coloring, 3D...')}
maxLength={48}
value={newNameDraft}
onChange={(e) => setNewNameDraft(e.target.value)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
handleSaveNewProfile();
@@ -361,13 +375,13 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
className="h-6 px-2 rounded-ui-xs bg-ui-control-active hover:bg-ui-control-hover border border-ui-accent-border text-[10px] font-medium text-ui-primary disabled:opacity-40 flex items-center gap-1 cursor-pointer shrink-0"
>
<BookmarkPlus className="w-3 h-3 text-ui-accent" />
- <span>Save</span>
+ <span>{t('Save')}</span>
</button>
</div>
<ToggleSwitch
data-testid="workspace-tab-include-appearance"
size="xs"
- label="Include active Appearance preset"
+ label={t('Include active Appearance preset')}
checked={bundleAppearance}
onChange={setBundleAppearance}
/>
@@ -400,6 +414,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
onChange={(e) => setRenameDraft(e.target.value)}
onBlur={() => handleCommitRename(ws.id)}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
handleCommitRename(ws.id);
@@ -416,7 +431,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
data-testid={`workspace-load-btn-${ws.id}`}
onClick={() => {
workspaceStoreActions.loadCustomWorkspace(ws.id);
- onNotify(`Loaded workspace "${ws.name}"`);
+ onNotify(t('Loaded workspace "{name}"', { name: ws.name }));
}}
className="flex-1 min-w-0 flex items-center gap-1.5 text-left cursor-pointer"
>
@@ -425,7 +440,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
</span>
{ws.appearance && (
<span
- title="Includes bundled Appearance theme"
+ title={t('Includes bundled Appearance theme')}
className="text-ui-muted flex items-center shrink-0"
>
<Palette className="w-2.5 h-2.5" />
@@ -433,7 +448,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
)}
{ws.leftHandedMode && (
<span className="text-[9px] font-ui-mono text-ui-accent shrink-0">
- LH
+ {t('LH')}
</span>
)}
{isActive && <Check className="w-3 h-3 text-ui-accent shrink-0 ml-auto" />}
@@ -445,7 +460,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<IconButton
size="xs"
icon={<Pencil className="w-2.5 h-2.5" />}
- title={`Rename "${ws.name}"`}
+ title={t('Rename "{name}"', { name: ws.name })}
onClick={() => {
setRenamingId(ws.id);
setRenameDraft(ws.name);
@@ -454,17 +469,17 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<IconButton
size="xs"
icon={<Download className="w-2.5 h-2.5" />}
- title={`Export "${ws.name}" as .inkworkspace`}
+ title={t('Export "{name}" as .inkworkspace', { name: ws.name })}
onClick={() => handleExportCurrentBundle(ws.id, ws.name)}
/>
<IconButton
size="xs"
data-testid={`workspace-delete-btn-${ws.id}`}
icon={<Trash2 className="w-2.5 h-2.5 text-ui-danger" />}
- title={`Delete "${ws.name}"`}
+ title={t('Delete "{name}"', { name: ws.name })}
onClick={() => {
workspaceStoreActions.deleteCustomWorkspace(ws.id);
- onNotify(`Deleted workspace "${ws.name}"`);
+ onNotify(t('Deleted workspace "{name}"', { name: ws.name }));
}}
/>
</div>
@@ -482,7 +497,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
size="xs"
variant="subtle"
icon={<Download className="w-3 h-3" />}
- label="Export .inkworkspace"
+ label={t('Export .inkworkspace')}
onClick={() => handleExportCurrentBundle()}
className="w-full"
/>
@@ -491,7 +506,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
size="xs"
variant="subtle"
icon={<Upload className="w-3 h-3" />}
- label="Import .inkworkspace"
+ label={t('Import .inkworkspace')}
onClick={() => importInputRef.current?.click()}
className="w-full"
/>
@@ -502,10 +517,10 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<div data-testid="focus-mode-builder-section" className="space-y-1.5">
<div className="flex items-center justify-between gap-1">
<span className="text-[10.5px] font-medium text-ui-secondary flex items-center gap-1.5">
- <span>Focus Mode (Tab)</span>
+ <span>{t('Focus Mode (Tab)')}</span>
{focusHud.preset === 'custom' && (
<span className="px-1 py-[0.5px] rounded-ui-xs bg-ui-input border border-ui-subtle text-[9px] font-ui-mono text-ui-muted">
- Custom
+ {t('Custom')}
</span>
)}
</span>
@@ -516,24 +531,28 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
aria-pressed={palettesHidden}
onClick={() => {
const next = workspaceStoreActions.togglePalettesHidden();
- onNotify(next ? 'Focus Mode Preview: ON (Tab to exit)' : 'Focus Mode Preview: OFF');
+ onNotify(
+ next
+ ? t('Focus Mode Preview: ON (Tab to exit)')
+ : t('Focus Mode Preview: OFF')
+ );
}}
className={`h-5 px-1.5 rounded-ui-xs border text-[9.5px] font-medium flex items-center gap-1 transition-colors cursor-pointer ${
palettesHidden
? 'bg-ui-control-active border-ui-accent-border text-ui-accent'
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover'
}`}
- title="Toggle live Focus Mode preview"
+ title={t('Toggle live Focus Mode preview')}
>
{palettesHidden ? (
<>
<Eye className="w-2.5 h-2.5" />
- <span>Exit Focus</span>
+ <span>{t('Exit Focus')}</span>
</>
) : (
<>
<EyeOff className="w-2.5 h-2.5" />
- <span>Preview Focus</span>
+ <span>{t('Preview Focus')}</span>
</>
)}
</button>
@@ -547,7 +566,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
aria-pressed={focusHud.preset === 'atelier-hud'}
onClick={() => {
workspaceStoreActions.applyFocusHudPreset('atelier-hud');
- onNotify('Focus Mode Preset: Atelier HUD');
+ onNotify(t('Focus Mode Preset: Atelier HUD'));
}}
className={`px-2 py-1 rounded-ui-sm border text-left transition-colors cursor-pointer flex items-center justify-between gap-1 ${
focusHud.preset === 'atelier-hud'
@@ -555,7 +574,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:border-ui-default hover:bg-ui-control-hover'
}`}
>
- <span className="text-[10.5px] truncate">Atelier HUD</span>
+ <span className="text-[10.5px] truncate">{t('Atelier HUD')}</span>
{focusHud.preset === 'atelier-hud' && (
<Check className="w-3 h-3 text-ui-accent shrink-0" />
)}
@@ -566,7 +585,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
aria-pressed={focusHud.preset === 'pure-canvas'}
onClick={() => {
workspaceStoreActions.applyFocusHudPreset('pure-canvas');
- onNotify('Focus Mode Preset: Pure Canvas');
+ onNotify(t('Focus Mode Preset: Pure Canvas'));
}}
className={`px-2 py-1 rounded-ui-sm border text-left transition-colors cursor-pointer flex items-center justify-between gap-1 ${
focusHud.preset === 'pure-canvas'
@@ -574,7 +593,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
: 'bg-ui-input border-ui-subtle text-ui-secondary hover:text-ui-primary hover:border-ui-default hover:bg-ui-control-hover'
}`}
>
- <span className="text-[10.5px] truncate">Pure Canvas</span>
+ <span className="text-[10.5px] truncate">{t('Pure Canvas')}</span>
{focusHud.preset === 'pure-canvas' && (
<Check className="w-3 h-3 text-ui-accent shrink-0" />
)}
@@ -586,35 +605,35 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<ToggleSwitch
data-testid="focus-builder-toggle-tool-rail"
size="xs"
- label="Floating Tool Rail"
+ label={t('Floating Tool Rail')}
checked={focusHud.showToolRail}
onChange={(v) => workspaceStoreActions.updateFocusHud({ showToolRail: v })}
/>
<ToggleSwitch
data-testid="focus-builder-toggle-brush-sliders"
size="xs"
- label="Brush Sliders HUD"
+ label={t('Brush Sliders HUD')}
checked={focusHud.showBrushSlidersHud}
onChange={(v) => workspaceStoreActions.updateFocusHud({ showBrushSlidersHud: v })}
/>
<ToggleSwitch
data-testid="focus-builder-toggle-quick-dock"
size="xs"
- label="Quick Action Dock"
+ label={t('Quick Action Dock')}
checked={focusHud.showQuickActionDock}
onChange={(v) => workspaceStoreActions.updateFocusHud({ showQuickActionDock: v })}
/>
<ToggleSwitch
data-testid="focus-builder-toggle-color-wheel"
size="xs"
- label="Floating Color Wheel"
+ label={t('Floating Color Wheel')}
checked={focusHud.showFloatingColorWheel}
onChange={(v) => workspaceStoreActions.updateFocusHud({ showFloatingColorWheel: v })}
/>
<ToggleSwitch
data-testid="focus-builder-toggle-quick-brushes"
size="xs"
- label="Keep Quick Brush Panel"
+ label={t('Keep Quick Brush Panel')}
checked={focusHud.keepQuickBrushPanel}
onChange={(v) => workspaceStoreActions.updateFocusHud({ keepQuickBrushPanel: v })}
/>
@@ -622,15 +641,15 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<ToggleSwitch
data-testid="focus-builder-toggle-hide-header"
size="xs"
- label="Hide Top Header Bar"
+ label={t('Hide Top Header Bar')}
checked={focusHud.hideHeaderInFocus}
onChange={(v) => workspaceStoreActions.updateFocusHud({ hideHeaderInFocus: v })}
/>
<ToggleSwitch
data-testid="focus-builder-toggle-auto-fade"
size="xs"
- label="Auto-Fade While Drawing"
- description="Dims floating HUDs during active strokes"
+ label={t('Auto-Fade While Drawing')}
+ description={t('Dims floating HUDs during active strokes')}
checked={focusHud.autoFadeWhileDrawing}
onChange={(v) => workspaceStoreActions.updateFocusHud({ autoFadeWhileDrawing: v })}
/>
@@ -640,12 +659,12 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
data-testid="focus-builder-reset-positions-btn"
onClick={() => {
workspaceStoreActions.resetFocusHudPositions();
- onNotify('Focus HUD positions reset');
+ onNotify(t('Focus HUD positions reset'));
}}
className="w-full h-6 px-2 rounded-ui-xs bg-ui-input hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary flex items-center justify-center gap-1 transition-colors cursor-pointer"
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Reset HUD Positions</span>
+ <span>{t('Reset HUD Positions')}</span>
</button>
</div>
</div>
@@ -654,41 +673,41 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
{/* 5. Workspace Bars Visibility */}
<div className="space-y-1">
<span className="text-[10.5px] font-medium text-ui-secondary block">
- Bars & Chrome
+ {t('Bars & Chrome')}
</span>
<div className="p-2 rounded-ui-sm bg-ui-header border border-ui-subtle space-y-1">
<ToggleSwitch
data-testid="workspace-bar-tool-options"
size="xs"
- label="Contextual Tool Options Bar"
+ label={t('Contextual Tool Options Bar')}
checked={showToolOptionsBar}
onChange={(v) => workspaceStoreActions.setShowToolOptionsBar(v)}
/>
<ToggleSwitch
data-testid="workspace-bar-command"
size="xs"
- label="Command Bar"
+ label={t('Command Bar')}
checked={showCommandBar}
onChange={(v) => workspaceStoreActions.setShowCommandBar(v)}
/>
<ToggleSwitch
data-testid="workspace-bar-doc-tabs"
size="xs"
- label="Document Tab Bar"
+ label={t('Document Tab Bar')}
checked={showDocumentTabs}
onChange={(v) => workspaceStoreActions.setShowDocumentTabs(v)}
/>
<ToggleSwitch
data-testid="workspace-bar-status"
size="xs"
- label="Status Bar"
+ label={t('Status Bar')}
checked={showStatusBar}
onChange={(v) => workspaceStoreActions.setShowStatusBar(v)}
/>
<ToggleSwitch
data-testid="workspace-bar-quick-brushes"
size="xs"
- label="Quick-Access Brush Panel"
+ label={t('Quick-Access Brush Panel')}
checked={quickBrushVisible}
onChange={(v) => workspaceStoreActions.setQuickBrushPanelVisible(v)}
/>
@@ -699,7 +718,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
<div className="space-y-1">
<div className="flex items-center justify-between">
<span className="text-[10.5px] font-medium text-ui-secondary">
- Status Bar Modules
+ {t('Status Bar Modules')}
</span>
<button
type="button"
@@ -707,7 +726,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
onClick={() => workspaceStoreActions.resetStatusBarModules()}
className="text-[9.5px] text-ui-muted hover:text-ui-primary cursor-pointer"
>
- Show all
+ {t('Show all')}
</button>
</div>
<div
@@ -720,7 +739,7 @@ export const WorkspaceAndBarsTab: React.FC<WorkspaceAndBarsTabProps> = React.mem
key={item.id}
data-testid={`statusbar-mod-${item.id}`}
size="xs"
- label={item.label}
+ label={t(item.label)}
disabled={!showStatusBar}
checked={statusBarModules[item.id]}
onChange={(checked) => workspaceStoreActions.setStatusBarModule(item.id, checked)}
diff --git a/src/components/brushStudio/BrushStudioControls.tsx b/src/components/brushStudio/BrushStudioControls.tsx
index 6156bed..7a23550 100644
--- a/src/components/brushStudio/BrushStudioControls.tsx
+++ b/src/components/brushStudio/BrushStudioControls.tsx
@@ -7,6 +7,7 @@ import {
formatNumericValue,
type ScrubSliderVariant,
} from '../ui';
+import { t } from '../../i18n';
export interface StudioSectionProps {
title: string;
@@ -64,8 +65,15 @@ function inferUnitFromLabel(valueLabel?: string): string {
function inferVariantFromLabel(label: string): ScrubSliderVariant {
const lower = label.toLowerCase();
- if (lower.includes('opacity')) return 'opacity';
- if (lower.includes('size') && !lower.includes('jitter') && !lower.includes('min')) {
+ if (lower.includes('opacity') || label.includes('不透明度')) return 'opacity';
+ if (
+ (lower.includes('size') || label.includes('サイズ')) &&
+ !lower.includes('jitter') &&
+ !lower.includes('min') &&
+ !label.includes('ジッター') &&
+ !label.includes('最小') &&
+ !label.includes('ランダム')
+ ) {
return 'size';
}
return 'default';
@@ -181,7 +189,7 @@ export function readImageFileAsDataUrl(file: File): Promise<{
}> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
- reader.onerror = () => reject(new Error('Failed to read image file.'));
+ reader.onerror = () => reject(new Error(t('Failed to read image file.')));
reader.onload = () => {
const dataUrl = String(reader.result || '');
const img = new Image();
@@ -192,7 +200,7 @@ export function readImageFileAsDataUrl(file: File): Promise<{
width: img.naturalWidth || img.width || 128,
height: img.naturalHeight || img.height || 128,
});
- img.onerror = () => reject(new Error('Unsupported or corrupted image file.'));
+ img.onerror = () => reject(new Error(t('Unsupported or corrupted image file.')));
img.src = dataUrl;
};
reader.readAsDataURL(file);
diff --git a/src/components/brushStudio/BrushStudioScratchpad.tsx b/src/components/brushStudio/BrushStudioScratchpad.tsx
index 49ca4a9..f9cb604 100644
--- a/src/components/brushStudio/BrushStudioScratchpad.tsx
+++ b/src/components/brushStudio/BrushStudioScratchpad.tsx
@@ -28,6 +28,7 @@ import {
compositePigmentOverPixelInto,
isPigmentCompatibleCombineMode,
} from '../../utils/spectralPigmentEngine';
+import { useI18n } from '../../i18n';
type ScratchpadBg = 'dark' | 'gray' | 'white';
@@ -58,6 +59,7 @@ export interface BrushStudioScratchpadProps {
export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
brushSettings,
}) => {
+ const { t, tc } = useI18n();
const baseCanvasRef = useRef<HTMLCanvasElement | null>(null);
const draftCanvasRef = useRef<HTMLCanvasElement | null>(null);
const [bgMode, setBgMode] = useState<ScratchpadBg>('white');
@@ -443,8 +445,10 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
<button
type="button"
onClick={() => setUseActiveColor(true)}
- title={`Active foreground ink (${brushSettings.color || '#1d4ed8'})`}
- aria-label="Use active foreground color"
+ title={t('Active foreground ink ({color})', {
+ color: brushSettings.color || '#1d4ed8',
+ })}
+ aria-label={t('Use active foreground color')}
aria-pressed={useActiveColor}
className={`w-4 h-4 rounded-full border cursor-pointer transition-transform shrink-0 ${
useActiveColor
@@ -456,6 +460,7 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
<div className="w-px h-3.5 bg-ui-default mx-0.5 shrink-0" />
{QUICK_SWATCHES.map((sw) => {
const selected = !useActiveColor && testColor === sw.hex;
+ const swLabel = t(sw.label);
return (
<button
key={sw.hex}
@@ -464,8 +469,8 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
setUseActiveColor(false);
setTestColor(sw.hex);
}}
- title={`Test ink: ${sw.label}`}
- aria-label={`Test ink: ${sw.label}`}
+ title={t('Test ink: {label}', { label: swLabel })}
+ aria-label={t('Test ink: {label}', { label: swLabel })}
aria-pressed={selected}
className={`w-3.5 h-3.5 rounded-full border cursor-pointer transition-transform shrink-0 ${
selected
@@ -481,28 +486,28 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
<div className="flex items-center gap-1.5 shrink-0">
<SegmentedControl<ScratchpadBg>
size="xs"
- aria-label="Scratchpad Surface"
+ aria-label={t('Scratchpad Surface')}
data-testid="scratchpad-bg-switcher"
value={bgMode}
onChange={setBgMode}
options={[
{
value: 'dark',
- label: 'Dark',
+ label: tc('theme', 'Dark'),
icon: <Moon className="w-2.5 h-2.5" />,
- title: 'Dark Studio Surface',
+ title: t('Dark Studio Surface'),
},
{
value: 'gray',
- label: 'Grey',
+ label: t('Grey'),
icon: <Square className="w-2.5 h-2.5" />,
- title: 'Mid-Grey Surface',
+ title: t('Mid-Grey Surface'),
},
{
value: 'white',
- label: 'Paper',
+ label: t('Paper'),
icon: <Sun className="w-2.5 h-2.5" />,
- title: 'Paper White Surface',
+ title: t('Paper White Surface'),
},
]}
/>
@@ -512,9 +517,9 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
size="xs"
variant="subtle"
onClick={() => cleanDirtyBrush(brushSettings.preset)}
- title="Wash dirty pigment off bristles"
+ title={t('Wash dirty pigment off bristles')}
icon={<Droplets className="w-3 h-3 text-ui-accent" />}
- label="Clean"
+ label={t('Clean')}
/>
)}
@@ -522,9 +527,9 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
size="xs"
variant="subtle"
onClick={clearScratchpad}
- title="Clear Scratchpad"
+ title={t('Clear Scratchpad')}
icon={<Eraser className="w-3 h-3" />}
- label="Clear"
+ label={t('Clear')}
/>
</div>
</div>
@@ -567,15 +572,19 @@ export const BrushStudioScratchpad: React.FC<BrushStudioScratchpadProps> = ({
{activeColor}
</span>
<span className="text-ui-disabled">·</span>
- <span className="truncate">{BG_LABELS[bgMode]} — Draw &amp; overlap strokes</span>
+ <span className="truncate">
+ {t('{surface} — Draw & overlap strokes', { surface: t(BG_LABELS[bgMode]) })}
+ </span>
</div>
<div className="flex items-center gap-2 font-ui-mono tabular-nums text-ui-secondary shrink-0">
- <span title="Brush Size">{Math.round(brushSettings.size ?? 14)}px</span>
+ <span title={t('Brush Size')}>{Math.round(brushSettings.size ?? 14)}px</span>
<span className="text-ui-disabled">·</span>
- <span title="Opacity">{Math.round((brushSettings.opacity ?? 1) * 100)}%</span>
+ <span title={t('Opacity')}>{Math.round((brushSettings.opacity ?? 1) * 100)}%</span>
<span className="text-ui-disabled">·</span>
- <span title="Spacing">{Math.round((brushSettings.spacing ?? 0.06) * 100)}% spc</span>
+ <span title={t('Spacing')}>
+ {t('{pct}% spc', { pct: Math.round((brushSettings.spacing ?? 0.06) * 100) })}
+ </span>
</div>
</div>
</div>
diff --git a/src/components/brushStudio/BrushStudioTabsPrimary.tsx b/src/components/brushStudio/BrushStudioTabsPrimary.tsx
index 1d85429..bc9f04e 100644
--- a/src/components/brushStudio/BrushStudioTabsPrimary.tsx
+++ b/src/components/brushStudio/BrushStudioTabsPrimary.tsx
@@ -32,6 +32,7 @@ import {
StudioSlider,
StudioToggle,
} from './BrushStudioControls';
+import { useI18n } from '../../i18n';
export interface BrushStudioTabProps {
bs: BrushSettings;
@@ -54,6 +55,7 @@ const DEFAULT_TAPER: CspTaperSettings = {
};
export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t, tc } = useI18n();
const tipInputRef = useRef<HTMLInputElement>(null);
const subTipInputRef = useRef<HTMLInputElement>(null);
const bristle: BristleSettings = { ...DEFAULT_BRISTLE_SETTINGS, ...(bs.bristle || {}) };
@@ -123,18 +125,18 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
return (
<div className="divide-y divide-ui-subtle">
<StudioSection
- title="Engine & Tip Profile"
- summary={bristle.profile}
+ title={t('Engine & Tip Profile')}
+ summary={tc('bristleProfile', bristle.profile)}
divider={false}
defaultOpen
>
<StudioSegmented<BrushRenderMode>
- label="Render Mode"
+ label={t('Render Mode')}
value={renderMode}
options={[
- { id: 'stamp', label: 'Stamp' },
- { id: 'bristle-ribbon', label: 'Bristle Ribbon' },
- { id: 'bristle-hybrid', label: 'Bristle Hybrid' },
+ { id: 'stamp', label: t('Stamp') },
+ { id: 'bristle-ribbon', label: t('Bristle Ribbon') },
+ { id: 'bristle-hybrid', label: t('Bristle Hybrid') },
]}
onChange={(mode) =>
onPatch({
@@ -149,16 +151,16 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
/>
<StudioSegmented<BristleProfilePreset>
- label="Brush Tip Profile"
+ label={t('Brush Tip Profile')}
value={bristle.profile}
options={[
- { id: 'round', label: 'Round' },
- { id: 'flat', label: 'Flat' },
- { id: 'filbert', label: 'Filbert' },
- { id: 'fan', label: 'Fan' },
- { id: 'rake', label: 'Rake' },
- { id: 'knife', label: 'Knife' },
- { id: 'custom', label: 'Custom' },
+ { id: 'round', label: t('Round') },
+ { id: 'flat', label: tc('bristleTip', 'Flat') },
+ { id: 'filbert', label: t('Filbert') },
+ { id: 'fan', label: t('Fan') },
+ { id: 'rake', label: t('Rake') },
+ { id: 'knife', label: t('Knife') },
+ { id: 'custom', label: t('Custom') },
]}
onChange={applyProfilePreset}
/>
@@ -167,13 +169,15 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
<div className="p-2 rounded-ui-sm bg-ui-input border border-ui-subtle flex items-center gap-2.5">
<div className="w-11 h-11 rounded-ui-xs bg-neutral-950 border border-ui-default flex items-center justify-center overflow-hidden shrink-0">
{bs.customTipDataUrl ? (
- <img src={bs.customTipDataUrl} alt="Tip" className="w-9 h-9 object-contain" />
+ <img src={bs.customTipDataUrl} alt={t('Tip')} className="w-9 h-9 object-contain" />
) : (
<div className="w-6 h-6 rounded-full bg-white/85" />
)}
</div>
<div className="flex-1 min-w-0 space-y-1.5">
- <div className="text-[11px] text-ui-primary font-medium truncate">Primary Tip Shape</div>
+ <div className="text-[11px] text-ui-primary font-medium truncate">
+ {t('Primary Tip Shape')}
+ </div>
<div className="flex items-center gap-1.5">
<button
type="button"
@@ -181,7 +185,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer transition-colors"
>
<Upload className="w-3 h-3" />
- <span>Upload PNG</span>
+ <span>{t('Upload PNG')}</span>
</button>
{bs.customTipDataUrl && (
<button
@@ -189,7 +193,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onClick={() => onPatch({ customTipDataUrl: undefined, customTipImage: undefined })}
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-danger/15 border border-ui-subtle hover:border-ui-danger/40 text-[10px] text-ui-secondary hover:text-ui-danger cursor-pointer transition-colors"
>
- Clear
+ {t('Clear')}
</button>
)}
</div>
@@ -209,15 +213,15 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
</StudioSection>
<StudioSection
- title="Multi-Tip Atlas"
- summary={subTipCount > 0 ? `${subTipCount} tips` : 'Single'}
+ title={t('Multi-Tip Atlas')}
+ summary={subTipCount > 0 ? t('{count} tips', { count: subTipCount }) : t('Single')}
summaryTone={subTipCount > 0 ? 'accent' : 'muted'}
defaultOpen={subTipCount > 0}
divider={false}
>
<div className="flex items-center justify-between gap-2">
<span className="text-[10.5px] text-ui-muted">
- Combine up to 16 sequential or random tip shapes
+ {t('Combine up to 16 sequential or random tip shapes')}
</span>
<button
type="button"
@@ -225,7 +229,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer transition-colors shrink-0"
>
<Plus className="w-3 h-3" />
- <span>Add Tip</span>
+ <span>{t('Add Tip')}</span>
</button>
<input
ref={subTipInputRef}
@@ -251,7 +255,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
<button
type="button"
onClick={() => removeSubTip(idx)}
- aria-label={`Remove sub-tip ${idx + 1}`}
+ aria-label={t('Remove sub-tip {n}', { n: idx + 1 })}
className="absolute inset-0 bg-ui-overlay opacity-0 group-hover:opacity-100 flex items-center justify-center text-ui-danger cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -260,13 +264,13 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
))}
</div>
<StudioSegmented<CspSubTipOrder>
- label="Sub-Tip Order"
+ label={t('Sub-Tip Order')}
value={bs.subTipOrder ?? 'sequential'}
options={[
- { id: 'sequential', label: 'Sequential' },
- { id: 'random', label: 'Random' },
- { id: 'direction', label: 'Direction' },
- { id: 'reverse', label: 'Reverse' },
+ { id: 'sequential', label: t('Sequential') },
+ { id: 'random', label: t('Random') },
+ { id: 'direction', label: t('Direction') },
+ { id: 'reverse', label: t('Reverse') },
]}
onChange={(order) => onPatch({ subTipOrder: order })}
/>
@@ -275,22 +279,22 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
</StudioSection>
<StudioSection
- title="Bristle Architecture"
- summary={`${bristle.count} strands`}
+ title={t('Bristle Architecture')}
+ summary={t('{count} strands', { count: bristle.count })}
defaultOpen
divider={false}
>
<StudioSlider
- label="Bristle Count"
+ label={t('Bristle Count')}
value={bristle.count}
min={4}
max={64}
defaultValue={DEFAULT_BRISTLE_SETTINGS.count}
- valueLabel={`${bristle.count} strands`}
+ valueLabel={t('{count} strands', { count: bristle.count })}
onChange={(v) => patchBristle({ count: v })}
/>
<StudioSlider
- label="Bristle Clumping"
+ label={t('Bristle Clumping')}
value={Math.round(bristle.clumping * 100)}
min={0}
max={100}
@@ -299,7 +303,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => patchBristle({ clumping: v / 100 })}
/>
<StudioSlider
- label="Stiffness"
+ label={t('Stiffness')}
value={Math.round(bristle.stiffness * 100)}
min={0}
max={100}
@@ -308,7 +312,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => patchBristle({ stiffness: v / 100 })}
/>
<StudioSlider
- label="Pressure / Tilt Splay"
+ label={t('Pressure / Tilt Splay')}
value={Math.round(bristle.splay * 100)}
min={0}
max={100}
@@ -317,7 +321,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => patchBristle({ splay: v / 100 })}
/>
<StudioSlider
- label="Strand Irregularity"
+ label={t('Strand Irregularity')}
value={Math.round(bristle.irregularity * 100)}
min={0}
max={100}
@@ -326,7 +330,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => patchBristle({ irregularity: v / 100 })}
/>
<StudioSlider
- label="Edge Ridge Buildup"
+ label={t('Edge Ridge Buildup')}
value={Math.round((bristle.edgeRidge ?? 0.2) * 100)}
min={0}
max={100}
@@ -337,13 +341,13 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
</StudioSection>
<StudioSection
- title="Tip Geometry & Orientation"
+ title={t('Tip Geometry & Orientation')}
summary={`${Math.round((bs.hardness ?? 0.9) * 100)}%`}
defaultOpen
divider={false}
>
<StudioSlider
- label="Hardness"
+ label={t('Hardness')}
value={Math.round((bs.hardness ?? 0.9) * 100)}
min={0}
max={100}
@@ -352,7 +356,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ hardness: v / 100 })}
/>
<StudioSlider
- label="Thickness (Aspect)"
+ label={t('Thickness (Aspect)')}
value={Math.round((bs.thickness ?? 1.0) * 100)}
min={5}
max={100}
@@ -361,7 +365,7 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ thickness: v / 100 })}
/>
<StudioSlider
- label="Tip Angle"
+ label={t('Tip Angle')}
value={Math.round(bs.customTipAngle ?? 0)}
min={-180}
max={180}
@@ -370,41 +374,41 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ customTipAngle: v })}
/>
<StudioSegmented<CspAngleDynamicsMode>
- label="Angle Dynamics"
+ label={t('Angle Dynamics')}
value={bs.customTipAngleDynamics ?? 'none'}
options={[
- { id: 'none', label: 'Fixed' },
- { id: 'direction', label: 'Stroke' },
- { id: 'tilt', label: 'Tilt' },
- { id: 'twist', label: 'Twist' },
- { id: 'random', label: 'Random' },
+ { id: 'none', label: t('Fixed') },
+ { id: 'direction', label: tc('angleDynamics', 'Stroke') },
+ { id: 'tilt', label: t('Tilt') },
+ { id: 'twist', label: t('Twist') },
+ { id: 'random', label: t('Random') },
]}
onChange={(v) => onPatch({ customTipAngleDynamics: v, rotateCursor: undefined })}
/>
<StudioToggle
- label="This brush rotates"
- description="Rotate the brush cursor preview to track brush direction"
+ label={t('This brush rotates')}
+ description={t('Rotate the brush cursor preview to track brush direction')}
checked={resolveBrushCursorRotationSpec(bs, 'brush').enabled}
onChange={(v) => onPatch({ rotateCursor: v })}
/>
<div className="grid grid-cols-2 gap-2">
<StudioSegmented<CspTipFlipMode>
- label="Flip Horizontal"
+ label={t('Flip Horizontal')}
value={bs.flipH ?? 'none'}
options={[
- { id: 'none', label: 'Off' },
- { id: 'alternate', label: 'Alt' },
- { id: 'random', label: 'Rand' },
+ { id: 'none', label: t('Off') },
+ { id: 'alternate', label: tc('flip', 'Alt') },
+ { id: 'random', label: tc('flip', 'Rand') },
]}
onChange={(v) => onPatch({ flipH: v })}
/>
<StudioSegmented<CspTipFlipMode>
- label="Flip Vertical"
+ label={t('Flip Vertical')}
value={bs.flipV ?? 'none'}
options={[
- { id: 'none', label: 'Off' },
- { id: 'alternate', label: 'Alt' },
- { id: 'random', label: 'Rand' },
+ { id: 'none', label: t('Off') },
+ { id: 'alternate', label: tc('flip', 'Alt') },
+ { id: 'random', label: tc('flip', 'Rand') },
]}
onChange={(v) => onPatch({ flipV: v })}
/>
@@ -415,28 +419,29 @@ export const ShapeBristlesTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
};
export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t } = useI18n();
const taper: CspTaperSettings = { ...DEFAULT_TAPER, ...(bs.taper || {}) };
const patchTaper = (p: Partial<CspTaperSettings>) => onPatch({ taper: { ...taper, ...p } });
const taperSummary =
taper.useIn && taper.useOut
- ? 'In & Out'
+ ? t('In & Out')
: taper.useIn
- ? 'In'
+ ? t('In')
: taper.useOut
- ? 'Out'
- : 'Off';
+ ? t('Out')
+ : t('Off');
return (
<div className="divide-y divide-ui-subtle">
<StudioSection
- title="Stroke Path & Smoothing"
+ title={t('Stroke Path & Smoothing')}
summary={`${Math.round((bs.spacing ?? 0.06) * 100)}%`}
divider={false}
defaultOpen
>
<StudioSlider
- label="Spacing"
+ label={t('Spacing')}
value={Math.round((bs.spacing ?? 0.06) * 100)}
min={2}
max={100}
@@ -445,7 +450,7 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
onChange={(v) => onPatch({ spacing: v / 100 })}
/>
<StudioSlider
- label="Streamline / Stabilization"
+ label={t('Streamline / Stabilization')}
value={Math.round(bs.stabilization ?? 10)}
min={0}
max={50}
@@ -454,7 +459,7 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
onChange={(v) => onPatch({ stabilization: v })}
/>
<StudioSlider
- label="Post-Correction"
+ label={t('Post-Correction')}
value={Math.round(bs.postCorrection ?? 0)}
min={0}
max={5}
@@ -463,29 +468,29 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
onChange={(v) => onPatch({ postCorrection: v })}
/>
<StudioToggle
- label="Sharp Angles"
- description="Preserve crisp corners instead of rounding"
+ label={t('Sharp Angles')}
+ description={t('Preserve crisp corners instead of rounding')}
checked={bs.sharpCorners !== false}
onChange={(v) => onPatch({ sharpCorners: v })}
/>
</StudioSection>
<StudioSection
- title="Taper In & Taper Out"
+ title={t('Taper In & Taper Out')}
summary={taperSummary}
summaryTone={taper.useIn || taper.useOut ? 'accent' : 'muted'}
defaultOpen
divider={false}
>
<StudioToggle
- label="Enable Taper In"
+ label={t('Enable Taper In')}
checked={Boolean(taper.useIn)}
onChange={(v) => patchTaper({ useIn: v })}
/>
{taper.useIn && (
<>
<StudioSlider
- label="Taper In Length"
+ label={t('Taper In Length')}
value={Math.round(taper.inLength)}
min={4}
max={200}
@@ -494,7 +499,7 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
onChange={(v) => patchTaper({ inLength: v })}
/>
<StudioSlider
- label="Start Sharpness"
+ label={t('Start Sharpness')}
value={Math.round((taper.startingSharpness ?? 0.8) * 100)}
min={0}
max={100}
@@ -506,14 +511,14 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
)}
<StudioToggle
- label="Enable Taper Out"
+ label={t('Enable Taper Out')}
checked={Boolean(taper.useOut)}
onChange={(v) => patchTaper({ useOut: v })}
/>
{taper.useOut && (
<>
<StudioSlider
- label="Taper Out Length"
+ label={t('Taper Out Length')}
value={Math.round(taper.outLength)}
min={4}
max={250}
@@ -522,7 +527,7 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
onChange={(v) => patchTaper({ outLength: v })}
/>
<StudioSlider
- label="End Sharpness"
+ label={t('End Sharpness')}
value={Math.round((taper.endingSharpness ?? 0.8) * 100)}
min={0}
max={100}
@@ -535,17 +540,17 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
<div className="pt-2 border-t border-ui-subtle space-y-1">
<StudioToggle
- label="Affect Size"
+ label={t('Affect Size')}
checked={taper.affectSize !== false}
onChange={(v) => patchTaper({ affectSize: v })}
/>
<StudioToggle
- label="Affect Density / Opacity"
+ label={t('Affect Density / Opacity')}
checked={Boolean(taper.affectDensity || taper.affectOpacity)}
onChange={(v) => patchTaper({ affectDensity: v, affectOpacity: v })}
/>
<StudioToggle
- label="Affect Paint Load (Dry Tail)"
+ label={t('Affect Paint Load (Dry Tail)')}
checked={taper.affectLoad !== false}
onChange={(v) => patchTaper({ affectLoad: v })}
/>
@@ -556,6 +561,7 @@ export const StrokeTaperTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =
};
export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t, tc, td } = useI18n();
const texInputRef = useRef<HTMLInputElement>(null);
const natural = { ...DEFAULT_NATURAL_PAINT_SETTINGS, ...(bs.naturalPaint || {}) };
@@ -568,11 +574,15 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
[]
);
- const activeTexLabel =
- SURFACE_TEXTURE_CATALOG.find((t) => t.id === bs.surfaceTextureId)?.label ??
- (bs.paperTexture ? 'Custom' : 'None');
- const dualTexLabel =
- SURFACE_TEXTURE_CATALOG.find((t) => t.id === bs.dualSurfaceTextureId)?.label ?? 'Off';
+ const activeTexEntry = SURFACE_TEXTURE_CATALOG.find((tex) => tex.id === bs.surfaceTextureId);
+ const hasActiveTexture = Boolean(activeTexEntry || bs.paperTexture);
+ const activeTexLabel = activeTexEntry
+ ? td(activeTexEntry.label)
+ : bs.paperTexture
+ ? t('Custom')
+ : t('None');
+ const dualTexEntry = SURFACE_TEXTURE_CATALOG.find((tex) => tex.id === bs.dualSurfaceTextureId);
+ const dualTexLabel = dualTexEntry ? td(dualTexEntry.label) : t('Off');
const grainPct = Math.round((bs.grain ?? bs.textureDensity ?? 0) * 100);
const selectBuiltinTexture = (id: SurfaceTextureId) => {
@@ -605,15 +615,15 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
<div className="divide-y divide-ui-subtle">
{/* Built-in 512x512 Seamless Surface Texture Gallery */}
<StudioSection
- title="Surface Texture Library"
+ title={t('Surface Texture Library')}
summary={activeTexLabel}
- summaryTone={activeTexLabel !== 'None' ? 'accent' : 'muted'}
+ summaryTone={hasActiveTexture ? 'accent' : 'muted'}
divider={false}
defaultOpen
>
<div className="flex items-center justify-between gap-2">
<span className="text-[10px] font-ui-mono tabular-nums text-ui-muted">
- 512 × 512 seamless grain
+ {t('512 × 512 seamless grain')}
</span>
<button
type="button"
@@ -621,7 +631,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer transition-colors"
>
<Upload className="w-3 h-3" />
- <span>Import PNG/WebP</span>
+ <span>{t('Import PNG/WebP')}</span>
</button>
<input
ref={texInputRef}
@@ -639,12 +649,13 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
<div className="grid grid-cols-4 gap-1.5">
{thumbnails.map((tex) => {
const active = bs.surfaceTextureId === tex.id;
+ const texLabel = td(tex.label);
return (
<button
key={tex.id}
type="button"
onClick={() => selectBuiltinTexture(tex.id)}
- title={tex.desc}
+ title={td(tex.desc)}
className={`p-1 rounded-ui-xs border text-left transition-colors cursor-pointer ${
active
? 'border-ui-accent bg-ui-accent-subtle'
@@ -653,37 +664,37 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
>
<div className="w-full aspect-square rounded-ui-xs overflow-hidden bg-ui-void mb-1">
{tex.url && (
- <img src={tex.url} alt={tex.label} className="w-full h-full object-cover" />
+ <img src={tex.url} alt={texLabel} className="w-full h-full object-cover" />
)}
</div>
- <div className="text-[9px] text-ui-primary truncate leading-tight">{tex.label}</div>
+ <div className="text-[9px] text-ui-primary truncate leading-tight">{texLabel}</div>
</button>
);
})}
</div>
<StudioSegmented<GrainMappingMode>
- label="Spatial Grain Mapping"
+ label={t('Spatial Grain Mapping')}
value={bs.grainMappingMode ?? 'canvas-locked'}
options={[
- { id: 'canvas-locked', label: 'Canvas' },
- { id: 'brush-aligned', label: 'Brush' },
- { id: 'stroke-flow', label: 'Flow' },
- { id: 'random-per-stroke', label: 'Random' },
+ { id: 'canvas-locked', label: t('Canvas') },
+ { id: 'brush-aligned', label: t('Brush') },
+ { id: 'stroke-flow', label: tc('grainMap', 'Flow') },
+ { id: 'random-per-stroke', label: t('Random') },
]}
onChange={(m) => onPatch({ grainMappingMode: m })}
/>
</StudioSection>
<StudioSection
- title="Grain & Paper Physics"
+ title={t('Grain & Paper Physics')}
summary={`${grainPct}%`}
summaryTone={grainPct > 0 ? 'accent' : 'muted'}
defaultOpen
divider={false}
>
<StudioSlider
- label="Grain Depth / Intensity"
+ label={t('Grain Depth / Intensity')}
value={grainPct}
min={0}
max={100}
@@ -692,7 +703,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ grain: v / 100, textureDensity: v / 100 })}
/>
<StudioSlider
- label="Dry-Brush Valley Cutoff"
+ label={t('Dry-Brush Valley Cutoff')}
value={Math.round(natural.dryBrush * 100)}
min={0}
max={100}
@@ -701,7 +712,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ naturalPaint: { ...natural, dryBrush: v / 100 } })}
/>
<StudioSlider
- label="Scale"
+ label={t('Scale')}
value={Math.round((bs.paperTextureScale ?? 1.0) * 100)}
min={20}
max={300}
@@ -710,7 +721,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ paperTextureScale: v / 100 })}
/>
<StudioSlider
- label="Rotation"
+ label={t('Rotation')}
value={Math.round(bs.paperTextureRotate ?? 0)}
min={-180}
max={180}
@@ -719,7 +730,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ paperTextureRotate: v })}
/>
<StudioSlider
- label="Contrast"
+ label={t('Contrast')}
value={Math.round(bs.paperTextureContrast ?? 0)}
min={-80}
max={80}
@@ -728,7 +739,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ paperTextureContrast: v })}
/>
<StudioSlider
- label="Brightness"
+ label={t('Brightness')}
value={Math.round(bs.paperTextureBrightness ?? 0)}
min={-50}
max={50}
@@ -737,19 +748,19 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
onChange={(v) => onPatch({ paperTextureBrightness: v })}
/>
<StudioSegmented<CspPaperTextureMode>
- label="Texture Blend Mode"
+ label={t('Texture Blend Mode')}
value={bs.paperTextureMode ?? 'compare'}
options={[
- { id: 'compare', label: 'Compare' },
- { id: 'multiply', label: 'Multiply' },
- { id: 'subtract', label: 'Subtract' },
- { id: 'overlay', label: 'Overlay' },
- { id: 'outline', label: 'Outline' },
+ { id: 'compare', label: tc('textureMode', 'Compare') },
+ { id: 'multiply', label: tc('blendMode', 'Multiply') },
+ { id: 'subtract', label: tc('blendMode', 'Subtract') },
+ { id: 'overlay', label: tc('blendMode', 'Overlay') },
+ { id: 'outline', label: tc('textureMode', 'Outline') },
]}
onChange={(v) => onPatch({ paperTextureMode: v })}
/>
<StudioToggle
- label="Invert Texture"
+ label={t('Invert Texture')}
checked={Boolean(bs.paperTextureInverted)}
onChange={(v) => onPatch({ paperTextureInverted: v })}
/>
@@ -757,7 +768,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
{/* Dual Grain Secondary Surface */}
<StudioSection
- title="Secondary Dual Grain"
+ title={t('Secondary Dual Grain')}
summary={dualTexLabel}
summaryTone={bs.dualSurfaceTextureId ? 'accent' : 'muted'}
defaultOpen={Boolean(bs.dualSurfaceTextureId)}
@@ -772,16 +783,16 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
}
className="w-full h-[var(--ui-control-height)] px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:border-ui-default text-[11px] text-ui-primary"
>
- <option value="">None</option>
- {SURFACE_TEXTURE_CATALOG.map((t) => (
- <option key={t.id} value={t.id}>
- {t.label}
+ <option value="">{t('None')}</option>
+ {SURFACE_TEXTURE_CATALOG.map((tex) => (
+ <option key={tex.id} value={tex.id}>
+ {td(tex.label)}
</option>
))}
</select>
{bs.dualSurfaceTextureId && (
<StudioSlider
- label="Dual Grain Depth"
+ label={t('Dual Grain Depth')}
value={Math.round((bs.dualGrainDepth ?? 0.35) * 100)}
min={0}
max={100}
@@ -794,8 +805,8 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
{/* Pressure-to-Penetration Curve */}
<StudioSection
- title="Valley Penetration Curve"
- summary="Curve"
+ title={t('Valley Penetration Curve')}
+ summary={t('Curve')}
defaultOpen={false}
divider={false}
>
@@ -823,6 +834,7 @@ export const TextureGrainTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch })
};
export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t, tc } = useI18n();
const dualInputRef = useRef<HTMLInputElement>(null);
const patchDual = (patch: Partial<typeof bs>) => {
@@ -867,15 +879,15 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
return (
<div className="divide-y divide-ui-subtle">
<StudioSection
- title="Dual Brush Compositing"
- summary={bs.dualBrush ? 'Active' : 'Off'}
+ title={t('Dual Brush Compositing')}
+ summary={bs.dualBrush ? t('Active') : t('Off')}
summaryTone={bs.dualBrush ? 'accent' : 'muted'}
divider={false}
defaultOpen
>
<StudioToggle
- label="Enable Dual Brush"
- description="Modulate primary tip with a secondary tip shape"
+ label={t('Enable Dual Brush')}
+ description={t('Modulate primary tip with a secondary tip shape')}
checked={Boolean(bs.dualBrush)}
onChange={(v) => patchDual({ dualBrush: v })}
/>
@@ -885,9 +897,9 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
<div className="p-2 rounded-ui-sm bg-ui-input border border-ui-subtle flex items-center gap-2.5">
<div className="w-11 h-11 rounded-ui-xs bg-neutral-950 border border-ui-default flex items-center justify-center overflow-hidden shrink-0">
{bs.dualTipDataUrl ? (
- <img src={bs.dualTipDataUrl} alt="Dual Tip" className="w-9 h-9 object-contain" />
+ <img src={bs.dualTipDataUrl} alt={t('Dual Tip')} className="w-9 h-9 object-contain" />
) : (
- <span className="text-[9px] text-ui-muted">None</span>
+ <span className="text-[9px] text-ui-muted">{t('None')}</span>
)}
</div>
<div className="flex flex-wrap items-center gap-1.5 min-w-0">
@@ -897,7 +909,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer transition-colors"
>
<Upload className="w-3 h-3" />
- <span>Upload Tip</span>
+ <span>{t('Upload Tip')}</span>
</button>
<button
type="button"
@@ -908,7 +920,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
}}
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-[10px] text-ui-secondary hover:text-ui-primary cursor-pointer transition-colors"
>
- Use Rake Tip
+ {t('Use Rake Tip')}
</button>
</div>
<input
@@ -935,7 +947,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
| 'overlay'
| 'screen'
>
- label="Composite Blend Mode"
+ label={t('Composite Blend Mode')}
value={
(bs.dualBrushCompositeMode as
| 'multiply'
@@ -949,21 +961,21 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
| 'screen') || 'multiply'
}
options={[
- { id: 'multiply', label: 'Multiply' },
- { id: 'subtract', label: 'Subtract' },
- { id: 'darken', label: 'Darken' },
- { id: 'height', label: 'Height' },
- { id: 'linear-burn', label: 'Lin Burn' },
- { id: 'color-burn', label: 'Col Burn' },
- { id: 'compare-density', label: 'Compare' },
- { id: 'overlay', label: 'Overlay' },
- { id: 'screen', label: 'Screen' },
+ { id: 'multiply', label: tc('blendMode', 'Multiply') },
+ { id: 'subtract', label: tc('blendMode', 'Subtract') },
+ { id: 'darken', label: tc('blendMode', 'Darken') },
+ { id: 'height', label: tc('textureMode', 'Height') },
+ { id: 'linear-burn', label: tc('dualBlend', 'Lin Burn') },
+ { id: 'color-burn', label: tc('dualBlend', 'Col Burn') },
+ { id: 'compare-density', label: tc('textureMode', 'Compare') },
+ { id: 'overlay', label: tc('blendMode', 'Overlay') },
+ { id: 'screen', label: tc('blendMode', 'Screen') },
]}
onChange={(v) => patchDual({ dualBrushCompositeMode: v })}
/>
<StudioSlider
- label="Dual Scale"
+ label={t('Dual Scale')}
value={Math.round((bs.dualScale ?? 1.0) * 100)}
min={20}
max={300}
@@ -972,7 +984,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
onChange={(v) => patchDual({ dualScale: v / 100 })}
/>
<StudioSlider
- label="Dual Angle"
+ label={t('Dual Angle')}
value={Math.round(bs.dualAngle ?? 0)}
min={-180}
max={180}
@@ -981,7 +993,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
onChange={(v) => patchDual({ dualAngle: v })}
/>
<StudioSlider
- label="Dual Scatter"
+ label={t('Dual Scatter')}
value={Math.round((bs.dualScatter ?? 0) * 100)}
min={0}
max={200}
@@ -990,7 +1002,7 @@ export const DualBrushTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) =>
onChange={(v) => patchDual({ dualScatter: v / 100 })}
/>
<StudioSlider
- label="Dual Spacing"
+ label={t('Dual Spacing')}
value={Math.round((bs.dualSpacing ?? 0.1) * 100)}
min={2}
max={100}
diff --git a/src/components/brushStudio/BrushStudioTabsSecondary.tsx b/src/components/brushStudio/BrushStudioTabsSecondary.tsx
index 04d2beb..6197c8f 100644
--- a/src/components/brushStudio/BrushStudioTabsSecondary.tsx
+++ b/src/components/brushStudio/BrushStudioTabsSecondary.tsx
@@ -26,8 +26,10 @@ import {
StudioToggle,
} from './BrushStudioControls';
import type { BrushStudioTabProps } from './BrushStudioTabsPrimary';
+import { useI18n } from '../../i18n';
export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t, tc } = useI18n();
const primaryColor = useToolStore((s) => s.primaryColor);
const secondaryColor = useToolStore((s) => s.secondaryColor);
const np: NaturalPaintSettings = {
@@ -47,15 +49,15 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
return (
<div className="divide-y divide-ui-subtle">
<StudioSection
- title="Natural Paint Engine"
- summary={isMixingEnabled ? 'Active' : 'Off'}
+ title={t('Natural Paint Engine')}
+ summary={isMixingEnabled ? t('Active') : t('Off')}
summaryTone={isMixingEnabled ? 'accent' : 'muted'}
divider={false}
defaultOpen
>
<StudioToggle
- label="Enable Natural Paint & Wet Mixing"
- description="Per-bristle pigment mixing, load capacity & dry-brush"
+ label={t('Enable Natural Paint & Wet Mixing')}
+ description={t('Per-bristle pigment mixing, load capacity & dry-brush')}
checked={isMixingEnabled}
onChange={(v) =>
onPatch({
@@ -67,28 +69,28 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
/>
<StudioSegmented<NaturalMixingMode>
- label="Mixing Mode"
+ label={t('Mixing Mode')}
value={bs.mixingMode ?? 'impasto_mix'}
options={[
- { id: 'blend', label: 'Blend' },
- { id: 'running_color', label: 'Running' },
- { id: 'smear', label: 'Smear' },
- { id: 'impasto_mix', label: 'Impasto' },
+ { id: 'blend', label: tc('mixingMode', 'Blend') },
+ { id: 'running_color', label: tc('mixingMode', 'Running') },
+ { id: 'smear', label: tc('mixingMode', 'Smear') },
+ { id: 'impasto_mix', label: tc('mixingMode', 'Impasto') },
]}
onChange={(m) => onPatch({ mixingMode: m })}
/>
<StudioToggle
- label="Per-Bristle Spatial Mixing"
- description="Each bristle picks up & drags local canvas color streaks"
+ label={t('Per-Bristle Spatial Mixing')}
+ description={t('Each bristle picks up & drags local canvas color streaks')}
checked={np.spatialMixing}
onChange={(v) => patchNp({ spatialMixing: v })}
/>
</StudioSection>
<StudioSection
- title="Pigment & Reservoir Physics"
- summary={`${Math.round(np.paintLoad * 100)}% load`}
+ title={t('Pigment & Reservoir Physics')}
+ summary={t('{pct}% load', { pct: Math.round(np.paintLoad * 100) })}
defaultOpen
divider={false}
>
@@ -109,7 +111,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
secondaryColor={secondaryColor}
/>
<StudioSlider
- label="Paint Load"
+ label={t('Paint Load')}
value={Math.round(np.paintLoad * 100)}
min={0}
max={100}
@@ -123,7 +125,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
}
/>
<StudioSlider
- label="Depletion Rate"
+ label={t('Depletion Rate')}
value={Math.round(np.depletionRate * 100)}
min={0}
max={100}
@@ -132,7 +134,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
onChange={(v) => patchNp({ depletionRate: v / 100 })}
/>
<StudioSlider
- label="Wetness / Pickup"
+ label={t('Wetness / Pickup')}
value={Math.round(np.wetness * 100)}
min={0}
max={100}
@@ -141,7 +143,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
onChange={(v) => patchNp({ wetness: v / 100 })}
/>
<StudioSlider
- label="Viscosity"
+ label={t('Viscosity')}
value={Math.round(np.viscosity * 100)}
min={0}
max={100}
@@ -150,7 +152,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
onChange={(v) => patchNp({ viscosity: v / 100 })}
/>
<StudioSlider
- label="Color Stretch"
+ label={t('Color Stretch')}
value={Math.round((bs.colorStretch ?? 0.65) * 100)}
min={0}
max={100}
@@ -159,8 +161,8 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
onChange={(v) => onPatch({ colorStretch: v / 100 })}
/>
<StudioToggle
- label="Optical Blend Blur"
- description="Isotropic smoothing on picked-up canvas color"
+ label={t('Optical Blend Blur')}
+ description={t('Isotropic smoothing on picked-up canvas color')}
checked={Boolean(bs.useBlur)}
onChange={(v) =>
onPatch({
@@ -171,7 +173,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
/>
{bs.useBlur && (
<StudioSlider
- label="Blur Strength"
+ label={t('Blur Strength')}
value={Math.round((bs.blurStrength ?? 0.35) * 100)}
min={5}
max={100}
@@ -181,7 +183,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
/>
)}
<StudioSlider
- label="Charge per Pressure"
+ label={t('Charge per Pressure')}
value={Math.round(np.chargePerPressure * 100)}
min={0}
max={100}
@@ -193,8 +195,8 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
<div className="pt-2 border-t border-ui-subtle flex items-center justify-between gap-2">
<div className="flex-1 min-w-0">
<StudioToggle
- label="Auto-Clean After Stroke"
- description="Off keeps picked-up pigment on bristles across strokes"
+ label={t('Auto-Clean After Stroke')}
+ description={t('Off keeps picked-up pigment on bristles across strokes')}
checked={np.autoClean}
onChange={(v) => patchNp({ autoClean: v })}
/>
@@ -206,7 +208,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
className="h-6 px-2 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-accent flex items-center gap-1 cursor-pointer shrink-0 transition-colors"
>
<Droplets className="w-3 h-3" />
- <span>Clean</span>
+ <span>{t('Clean')}</span>
</button>
)}
</div>
@@ -216,6 +218,7 @@ export const NaturalPaintMixingTab: React.FC<BrushStudioTabProps> = ({ bs, onPat
};
export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t } = useI18n();
const imp: ImpastoSettings = { ...DEFAULT_IMPASTO_SETTINGS, ...(bs.impasto || {}) };
const np: NaturalPaintSettings = {
...DEFAULT_NATURAL_PAINT_SETTINGS,
@@ -231,21 +234,21 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
return (
<div className="divide-y divide-ui-subtle">
<StudioSection
- title="3D Impasto Relief"
- summary={imp.enabled ? `${Math.round(imp.depth * 100)}%` : 'Off'}
+ title={t('3D Impasto Relief')}
+ summary={imp.enabled ? `${Math.round(imp.depth * 100)}%` : t('Off')}
summaryTone={imp.enabled ? 'accent' : 'muted'}
divider={false}
defaultOpen
>
<StudioToggle
- label="Enable 3D Impasto Relief"
- description="Real-time paint heightmap with directional lighting & sheen"
+ label={t('Enable 3D Impasto Relief')}
+ description={t('Real-time paint heightmap with directional lighting & sheen')}
checked={imp.enabled}
onChange={(v) => patchImp({ enabled: v })}
/>
<StudioSlider
- label="Impasto Depth"
+ label={t('Impasto Depth')}
value={Math.round(imp.depth * 100)}
min={0}
max={100}
@@ -254,7 +257,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
onChange={(v) => patchImp({ depth: v / 100 })}
/>
<StudioSlider
- label="Bristle Groove Relief"
+ label={t('Bristle Groove Relief')}
value={Math.round(imp.bristleRelief * 100)}
min={0}
max={100}
@@ -263,7 +266,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
onChange={(v) => patchImp({ bristleRelief: v / 100 })}
/>
<StudioSlider
- label="Gloss / Oil Sheen"
+ label={t('Gloss / Oil Sheen')}
value={Math.round(imp.gloss * 100)}
min={0}
max={100}
@@ -272,7 +275,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
onChange={(v) => patchImp({ gloss: v / 100 })}
/>
<StudioSlider
- label="Relief Lighting Contrast"
+ label={t('Relief Lighting Contrast')}
value={Math.round(imp.reliefContrast * 100)}
min={0}
max={100}
@@ -284,7 +287,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
{/* Directional Light Gizmo (Reuses InkStudio LightSourceWidget) */}
<StudioSection
- title="Directional Light"
+ title={t('Directional Light')}
summary={`${Math.round(imp.lightAzimuth)}° / ${Math.round(imp.lightElevation)}°`}
defaultOpen={imp.enabled}
divider={false}
@@ -311,14 +314,14 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
{/* Watercolor Wet Edge & Paper-Valley Granulation */}
<StudioSection
- title="Watercolor Wet Edge & Granulation"
- summary={wetPct > 0 ? `${wetPct}%` : 'Off'}
+ title={t('Watercolor Wet Edge & Granulation')}
+ summary={wetPct > 0 ? `${wetPct}%` : t('Off')}
summaryTone={wetPct > 0 ? 'accent' : 'muted'}
defaultOpen
divider={false}
>
<StudioSlider
- label="Wet Edge Strength"
+ label={t('Wet Edge Strength')}
value={wetPct}
min={0}
max={100}
@@ -327,7 +330,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
onChange={(v) => onPatch({ wetEdge: v / 100 })}
/>
<StudioSlider
- label="Wet Edge Radius"
+ label={t('Wet Edge Radius')}
value={Number((bs.wetEdgeRadius ?? 3.0).toFixed(1))}
min={1}
max={8}
@@ -337,7 +340,7 @@ export const ImpastoWetEdgeTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }
onChange={(v) => onPatch({ wetEdgeRadius: v })}
/>
<StudioSlider
- label="Paper-Valley Granulation"
+ label={t('Paper-Valley Granulation')}
value={Math.round((np.granulation ?? 0) * 100)}
min={0}
max={100}
@@ -372,6 +375,7 @@ const SENSOR_TARGETS: Array<{ key: SensorTargetKey; label: string }> = [
];
export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onPatch }) => {
+ const { t } = useI18n();
const [selectedTarget, setSelectedTarget] = useState<SensorTargetKey>('sizeSensor');
const dyn: BrushDynamics = { ...DEFAULT_BRUSH_DYNAMICS, ...(bs.dynamics || {}) };
const sensor: CspSensorConfig = bs[selectedTarget] || {};
@@ -384,22 +388,23 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onPatch({ dynamics: { ...dyn, ...p } });
};
- const selectedTargetLabel =
- SENSOR_TARGETS.find((t) => t.key === selectedTarget)?.label ?? 'Size';
+ const selectedTargetLabel = t(
+ SENSOR_TARGETS.find((target) => target.key === selectedTarget)?.label ?? 'Size'
+ );
return (
<div className="divide-y divide-ui-subtle">
{/* Unified Sensor Matrix Target Selector */}
<StudioSection
- title="Sensor-to-Property Matrix"
+ title={t('Sensor-to-Property Matrix')}
summary={selectedTargetLabel}
summaryTone="accent"
divider={false}
defaultOpen
>
<div className="grid grid-cols-2 gap-1">
- {SENSOR_TARGETS.map((t) => {
- const cfg = bs[t.key];
+ {SENSOR_TARGETS.map((target) => {
+ const cfg = bs[target.key];
const activeCount = cfg
? [
cfg.usePressure,
@@ -410,19 +415,19 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
cfg.useRandom,
].filter(Boolean).length
: 0;
- const isSelected = selectedTarget === t.key;
+ const isSelected = selectedTarget === target.key;
return (
<button
- key={t.key}
+ key={target.key}
type="button"
- onClick={() => setSelectedTarget(t.key)}
+ onClick={() => setSelectedTarget(target.key)}
className={`px-2 py-1 rounded-ui-xs text-[10.5px] flex items-center justify-between gap-1 cursor-pointer border transition-colors ${
isSelected
? 'bg-ui-accent-subtle text-ui-primary font-medium border-ui-accent-border'
: 'bg-ui-input text-ui-secondary border-ui-subtle hover:text-ui-primary hover:bg-ui-control-hover'
}`}
>
- <span className="truncate">{t.label}</span>
+ <span className="truncate">{t(target.label)}</span>
{activeCount > 0 && (
<span className="px-1 rounded-ui-xs bg-ui-panel text-[9px] font-ui-mono tabular-nums text-ui-accent border border-ui-subtle shrink-0">
{activeCount}
@@ -435,13 +440,13 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
<div className="pt-2 border-t border-ui-subtle space-y-1.5">
<StudioToggle
- label="Stylus Pressure"
+ label={t('Stylus Pressure')}
checked={Boolean(sensor.usePressure)}
onChange={(v) => patchSensor({ usePressure: v })}
/>
{sensor.usePressure && (
<StudioSlider
- label="Minimum at Zero Pressure"
+ label={t('Minimum at Zero Pressure')}
value={Math.round((sensor.pressureMin ?? 0) * 100)}
min={0}
max={100}
@@ -452,7 +457,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
)}
<StudioToggle
- label="Tilt Altitude"
+ label={t('Tilt Altitude')}
checked={Boolean(sensor.useTilt)}
onChange={(v) => {
patchSensor({ useTilt: v });
@@ -460,34 +465,34 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
}}
/>
<StudioToggle
- label="Tilt Azimuth"
+ label={t('Tilt Azimuth')}
checked={Boolean(sensor.useTiltAzimuth)}
onChange={(v) => patchSensor({ useTiltAzimuth: v })}
/>
<StudioToggle
- label="Barrel Twist"
+ label={t('Barrel Twist')}
checked={Boolean(sensor.useBarrelTwist)}
onChange={(v) => patchSensor({ useBarrelTwist: v })}
/>
<StudioToggle
- label="Stroke Velocity"
+ label={t('Stroke Velocity')}
checked={Boolean(sensor.useVelocity)}
onChange={(v) => patchSensor({ useVelocity: v })}
/>
<StudioToggle
- label="Stroke Distance"
+ label={t('Stroke Distance')}
checked={Boolean(sensor.useDistance)}
onChange={(v) => patchSensor({ useDistance: v })}
/>
<StudioToggle
- label="Random Variance"
+ label={t('Random Variance')}
checked={Boolean(sensor.useRandom)}
onChange={(v) => patchSensor({ useRandom: v })}
/>
</div>
<div className="pt-2 border-t border-ui-subtle">
- <div className="text-[10px] text-ui-muted mb-1.5">Response Curve</div>
+ <div className="text-[10px] text-ui-muted mb-1.5">{t('Response Curve')}</div>
<PressureCurveEditor
value={{
enabled: true,
@@ -509,14 +514,14 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
{/* Jitter & Color Dynamics */}
<StudioSection
- title="Stamp & Color Jitter"
- summary={dyn.colorJitterEnabled ? 'Color On' : 'Stamp'}
+ title={t('Stamp & Color Jitter')}
+ summary={dyn.colorJitterEnabled ? t('Color On') : t('Stamp')}
summaryTone={dyn.colorJitterEnabled ? 'accent' : 'muted'}
defaultOpen
divider={false}
>
<StudioSlider
- label="Size Jitter"
+ label={t('Size Jitter')}
value={Math.round(dyn.sizeJitter * 100)}
min={0}
max={100}
@@ -525,7 +530,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ sizeJitter: v / 100 })}
/>
<StudioSlider
- label="Angle Jitter"
+ label={t('Angle Jitter')}
value={Math.round(dyn.angleJitter * 100)}
min={0}
max={100}
@@ -534,7 +539,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ angleJitter: v / 100 })}
/>
<StudioSlider
- label="Scatter"
+ label={t('Scatter')}
value={Math.round(dyn.scatter * 100)}
min={0}
max={250}
@@ -543,14 +548,14 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ scatter: v / 100 })}
/>
<StudioToggle
- label="Enable Color Dynamics"
+ label={t('Enable Color Dynamics')}
checked={dyn.colorJitterEnabled}
onChange={(v) => patchDyn({ colorJitterEnabled: v })}
/>
{dyn.colorJitterEnabled && (
<>
<StudioSlider
- label="Hue Jitter"
+ label={t('Hue Jitter')}
value={Math.round(dyn.hueJitter * 100)}
min={0}
max={100}
@@ -559,7 +564,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ hueJitter: v / 100 })}
/>
<StudioSlider
- label="Saturation Jitter"
+ label={t('Saturation Jitter')}
value={Math.round(dyn.saturationJitter * 100)}
min={0}
max={100}
@@ -568,7 +573,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ saturationJitter: v / 100 })}
/>
<StudioSlider
- label="Lightness Jitter"
+ label={t('Lightness Jitter')}
value={Math.round(dyn.brightnessJitter * 100)}
min={0}
max={100}
@@ -577,7 +582,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ brightnessJitter: v / 100 })}
/>
<StudioSlider
- label="Temperature Jitter"
+ label={t('Temperature Jitter')}
value={Math.round((dyn.temperatureJitter ?? 0) * 100)}
min={0}
max={100}
@@ -586,7 +591,7 @@ export const DynamicsSensorMatrixTab: React.FC<BrushStudioTabProps> = ({ bs, onP
onChange={(v) => patchDyn({ temperatureJitter: v / 100 })}
/>
<StudioSlider
- label="FG / BG Mix"
+ label={t('FG / BG Mix')}
value={Math.round(dyn.foregroundBackgroundJitter * 100)}
min={0}
max={100}
@@ -629,6 +634,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
onExportInkb,
onImportInkb,
}) => {
+ const { t, td } = useI18n();
const importRef = useRef<HTMLInputElement>(null);
return (
@@ -636,7 +642,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
{bs.importWarnings && bs.importWarnings.length > 0 && (
<div className="p-2.5 bg-ui-warning/10 border-b border-ui-warning/30 space-y-1.5">
<div className="text-[11px] font-medium text-ui-warning tabular-nums">
- CSP Import Notices ({bs.importWarnings.length})
+ {t('CSP Import Notices ({count})', { count: bs.importWarnings.length })}
</div>
<ul className="pl-4 list-disc space-y-1 text-[10.5px] leading-snug text-ui-primary">
{bs.importWarnings.map((w, idx) => (
@@ -646,9 +652,14 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
</div>
)}
- <StudioSection title="Brush Identity" summary={category} divider={false} defaultOpen>
+ <StudioSection
+ title={t('Brush Identity')}
+ summary={td(category, 'brushCategory')}
+ divider={false}
+ defaultOpen
+ >
<div className="space-y-1">
- <label className="text-[10.5px] text-ui-secondary">Brush Name</label>
+ <label className="text-[10.5px] text-ui-secondary">{t('Brush Name')}</label>
<input
type="text"
value={brushName}
@@ -658,35 +669,37 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
</div>
<div className="space-y-1">
- <label className="text-[10.5px] text-ui-secondary">Category</label>
+ <label className="text-[10.5px] text-ui-secondary">{t('Category')}</label>
<select
value={category}
onChange={(e) => onCategoryChange(e.target.value as BrushCategory | 'custom')}
className="w-full h-[var(--ui-control-height)] px-2 rounded-ui-sm bg-ui-input border border-ui-subtle hover:border-ui-default text-[11.5px] text-ui-primary transition-colors"
>
- <option value="pen">Pen</option>
- <option value="sketch">Sketch</option>
- <option value="brush">Brush</option>
- <option value="blend">Blend</option>
- <option value="natural-paint">Natural Paint</option>
- <option value="texture-fx">Texture &amp; FX</option>
- <option value="custom">Custom</option>
+ <option value="pen">{t('Pen')}</option>
+ <option value="sketch">{t('Sketch')}</option>
+ <option value="brush">{t('Brush')}</option>
+ <option value="blend">{t('Blend')}</option>
+ <option value="natural-paint">{t('Natural Paint')}</option>
+ <option value="texture-fx">{t('Texture & FX')}</option>
+ <option value="custom">{t('Custom')}</option>
</select>
</div>
<div className="space-y-1">
- <label className="text-[10.5px] text-ui-secondary">Description</label>
+ <label className="text-[10.5px] text-ui-secondary">{t('Description')}</label>
<textarea
rows={3}
value={description}
onChange={(e) => onDescriptionChange(e.target.value)}
- placeholder="Describe this brush's physical feel, bristle setup, or surface interaction..."
+ placeholder={t(
+ "Describe this brush's physical feel, bristle setup, or surface interaction..."
+ )}
className="w-full px-2.5 py-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle hover:border-ui-default focus:border-ui-focus text-[11px] text-ui-primary placeholder:text-ui-muted/60 resize-none transition-colors"
/>
</div>
</StudioSection>
- <StudioSection title="Preset & File Actions" defaultOpen divider={false}>
+ <StudioSection title={t('Preset & File Actions')} defaultOpen divider={false}>
<div className="grid grid-cols-2 gap-1.5">
<button
type="button"
@@ -694,7 +707,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
className="h-[var(--ui-control-height)] px-2.5 rounded-ui-sm bg-ui-accent text-ui-accent-contrast hover:opacity-90 text-[11px] font-medium flex items-center justify-center gap-1.5 cursor-pointer transition-opacity"
>
<Save className="w-3.5 h-3.5 shrink-0" />
- <span className="truncate">Save New</span>
+ <span className="truncate">{t('Save New')}</span>
</button>
<button
type="button"
@@ -702,7 +715,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
className="h-[var(--ui-control-height)] px-2.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] text-ui-primary flex items-center justify-center gap-1.5 cursor-pointer transition-colors"
>
<Copy className="w-3.5 h-3.5 shrink-0" />
- <span className="truncate">Duplicate</span>
+ <span className="truncate">{t('Duplicate')}</span>
</button>
<button
type="button"
@@ -710,7 +723,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
className="h-[var(--ui-control-height)] px-2.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] text-ui-primary flex items-center justify-center gap-1.5 cursor-pointer transition-colors"
>
<Download className="w-3.5 h-3.5 shrink-0" />
- <span className="truncate">Export .inkb</span>
+ <span className="truncate">{t('Export .inkb')}</span>
</button>
<button
type="button"
@@ -718,7 +731,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
className="h-[var(--ui-control-height)] px-2.5 rounded-ui-sm bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[11px] text-ui-primary flex items-center justify-center gap-1.5 cursor-pointer transition-colors"
>
<Upload className="w-3.5 h-3.5 shrink-0" />
- <span className="truncate">Import Brush</span>
+ <span className="truncate">{t('Import Brush')}</span>
</button>
<input
ref={importRef}
@@ -738,7 +751,7 @@ export const AboutPresetsTab: React.FC<AboutPresetsTabProps> = ({
className="w-full h-[var(--ui-control-height)] px-2.5 rounded-ui-sm bg-ui-control hover:bg-ui-danger/15 border border-ui-subtle hover:border-ui-danger/40 text-[11px] text-ui-secondary hover:text-ui-danger flex items-center justify-center gap-1.5 cursor-pointer transition-colors"
>
<RotateCcw className="w-3.5 h-3.5 shrink-0" />
- <span>Reset Active Brush to Default</span>
+ <span>{t('Reset Active Brush to Default')}</span>
</button>
</StudioSection>
</div>
diff --git a/src/components/canvasArea/CanvasViewportHud.tsx b/src/components/canvasArea/CanvasViewportHud.tsx
index 44b7513..d394c06 100644
--- a/src/components/canvasArea/CanvasViewportHud.tsx
+++ b/src/components/canvasArea/CanvasViewportHud.tsx
@@ -7,6 +7,7 @@ import { PerspectiveRulerOverlay } from '../PerspectiveRulerOverlay';
import { SmartphoneViewportSimulator } from '../SmartphoneViewportSimulator';
import { AnimationTimeline } from '../AnimationTimeline';
import { CanvasAreaProps } from './types';
+import { useI18n } from '../../i18n';
export interface CanvasViewportHudProps {
canvasProps: CanvasAreaProps;
@@ -57,6 +58,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
quickPalettePos,
setQuickPalettePos,
}) => {
+ const { t } = useI18n();
const {
viewportRef,
dimensions,
@@ -323,26 +325,28 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
>
<div className="flex items-center gap-2 text-[11px] font-ui-mono tabular-nums font-medium text-ui-primary">
<span>
- Size{' '}
- {tool === 'liquify' && liquifySettings
- ? liquifySettings.size
- : tool === 'retouch' && retouchSettings
- ? retouchSettings.size
- : tool === 'fill' && fillSettings?.method === 'paint-unfilled'
- ? Math.round(fillSettings.brushSize ?? 24)
- : brushSettings.size}
- px
+ {t('Size {size}px', {
+ size:
+ tool === 'liquify' && liquifySettings
+ ? liquifySettings.size
+ : tool === 'retouch' && retouchSettings
+ ? retouchSettings.size
+ : tool === 'fill' && fillSettings?.method === 'paint-unfilled'
+ ? Math.round(fillSettings.brushSize ?? 24)
+ : brushSettings.size,
+ })}
</span>
{!(tool === 'fill' && fillSettings?.method === 'paint-unfilled') &&
tool !== 'liquify' && (
<>
<span className="text-ui-muted">·</span>
<span>
- Hard{' '}
- {tool === 'retouch' && retouchSettings
- ? retouchSettings.hardness
- : Math.round((brushSettings.hardness ?? 1.0) * 100)}
- %
+ {t('Hard {value}%', {
+ value:
+ tool === 'retouch' && retouchSettings
+ ? retouchSettings.hardness
+ : Math.round((brushSettings.hardness ?? 1.0) * 100),
+ })}
</span>
</>
)}
@@ -360,7 +364,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
style={{ left: `${quickPalettePos.x}px`, top: `${quickPalettePos.y}px` }}
>
<div className="flex items-center justify-between text-[10px] text-ui-muted uppercase tracking-wider">
- <span>Quick Palette</span>
+ <span>{t('Quick Palette')}</span>
<button
type="button"
onClick={() => setQuickPalettePos(null)}
@@ -386,7 +390,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
</div>
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Size</span>
+ <span>{t('Size')}</span>
<span className="font-ui-mono tabular-nums text-ui-primary">{brushSettings.size}px</span>
</div>
<input
@@ -407,7 +411,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
}}
className="px-1.5 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary transition-colors cursor-pointer"
>
- Undo
+ {t('Undo')}
</button>
<button
type="button"
@@ -417,7 +421,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
}}
className="px-1.5 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary transition-colors cursor-pointer"
>
- Redo
+ {t('Redo')}
</button>
<button
type="button"
@@ -427,7 +431,7 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
}}
className="px-1.5 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle text-ui-primary transition-colors cursor-pointer"
>
- Flip H
+ {t('Flip H')}
</button>
</div>
</div>
@@ -439,20 +443,20 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
<button
onClick={onToggleWebtoonMode}
className="px-2.5 py-1 rounded-full text-[11px] font-medium flex items-center gap-1.5 bg-ui-floating hover:bg-ui-control-hover border border-ui-default text-ui-primary shadow-ui-floating transition-colors cursor-pointer"
- title="Exit Webtoon Studio Mode"
+ title={t('Exit Webtoon Studio Mode')}
>
<Smartphone className="w-3.5 h-3.5 text-ui-accent" />
- <span>Exit Webtoon</span>
+ <span>{t('Exit Webtoon')}</span>
</button>
{onOpenWebtoonExport && (
<button
onClick={onOpenWebtoonExport}
className="px-2.5 py-1 rounded-full text-[11px] font-medium bg-ui-floating hover:bg-ui-control-hover border border-ui-default text-ui-primary flex items-center gap-1.5 shadow-ui-floating transition-colors cursor-pointer"
- title="Export Chapter Slices (.zip)"
+ title={t('Export Chapter Slices (.zip)')}
>
<Archive className="w-3.5 h-3.5 text-ui-icon-muted" />
- <span>Export Slices</span>
+ <span>{t('Export Slices')}</span>
</button>
)}
</div>
@@ -495,10 +499,10 @@ export const CanvasViewportHud: React.FC<CanvasViewportHudProps> = ({
>
<div className="px-3.5 py-2 rounded-ui-md bg-ui-floating border border-ui-accent-border text-xs font-medium text-ui-primary shadow-ui-popover">
{externalFileDropKind === '3d-model'
- ? 'Drop 3D model (.glb, .gltf, .obj) to load'
+ ? t('Drop 3D model (.glb, .gltf, .obj) to load')
: externalFileDropKind === 'any-3d'
- ? 'Drop 3D model (.glb, .gltf, .obj) or image'
- : 'Drop image to import as layer'}
+ ? t('Drop 3D model (.glb, .gltf, .obj) or image')
+ : t('Drop image to import as layer')}
</div>
</div>
)}
diff --git a/src/components/canvasArea/useCanvasPointerHandlers.ts b/src/components/canvasArea/useCanvasPointerHandlers.ts
index 6cef439..fe7ffd1 100644
--- a/src/components/canvasArea/useCanvasPointerHandlers.ts
+++ b/src/components/canvasArea/useCanvasPointerHandlers.ts
@@ -79,6 +79,7 @@ export function useCanvasPointerHandlers({
onPointerUp,
}: UseCanvasPointerHandlersParams) {
const tempEraserPrevToolRef = useRef<ToolType | null>(null);
+ const activeDomPointerIdRef = useRef<number | null>(null);
const releaseExternalFocus = () => {
const active = document.activeElement as HTMLElement | null;
@@ -360,13 +361,16 @@ export function useCanvasPointerHandlers({
(e.nativeEvent as any).coalescedEvents = coalesced;
}
artworkTimeTracker.recordArtworkAction();
+ activeDomPointerIdRef.current = e.pointerId;
uiStoreActions.setIsDrawing(true);
onPointerDown(e, coalesced);
};
const handleCanvasPointerMove = (e: React.PointerEvent<HTMLElement>) => {
if (isWorkspaceInteractionActive() || useUiStore.getState().isResizeCanvasModalOpen) return;
+ const isTrackedDomStroke = activeDomPointerIdRef.current === e.pointerId;
if (
+ !isTrackedDomStroke &&
(tool === 'brush' || tool === 'decoration' || tool === 'eraser') &&
shouldSuppressDomPointerEvent(e.pointerType, e.clientX, e.clientY)
) {
@@ -384,7 +388,12 @@ export function useCanvasPointerHandlers({
};
const handleCanvasPointerUp = (e: React.PointerEvent<HTMLElement>) => {
+ const isTrackedDomStroke = activeDomPointerIdRef.current === e.pointerId;
+ if (isTrackedDomStroke) {
+ activeDomPointerIdRef.current = null;
+ }
if (
+ isTrackedDomStroke ||
!(
(tool === 'brush' || tool === 'decoration' || tool === 'eraser') &&
shouldSuppressDomPointerEvent(e.pointerType, e.clientX, e.clientY)
diff --git a/src/components/focus/FocusBrushSlidersHud.tsx b/src/components/focus/FocusBrushSlidersHud.tsx
index c399e54..0effacc 100644
--- a/src/components/focus/FocusBrushSlidersHud.tsx
+++ b/src/components/focus/FocusBrushSlidersHud.tsx
@@ -8,6 +8,7 @@ import { toolStoreActions, useToolStore } from '../../stores';
import { ScrubSlider } from '../ui';
import { WorkspaceCommandHandlers } from '../CommandBar';
import { FocusGripDots, getFocusHudSurfaceStyle, useFocusHudDrag } from './focusHudUtils';
+import { useI18n } from '../../i18n';
export interface FocusBrushSlidersHudProps {
commandHandlers: WorkspaceCommandHandlers;
@@ -19,6 +20,7 @@ export interface FocusBrushSlidersHudProps {
export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.memo(
({ commandHandlers, leftHandedMode, floatingOpacity, isAutoFaded, customPosition }) => {
+ const { t, td } = useI18n();
const tool = useToolStore((s) => s.tool);
const lastPaintTool = useToolStore((s) => s.lastPaintTool);
const brushSettings = useToolStore((s) => s.brushSettings);
@@ -67,16 +69,25 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
);
const activeLabel = useMemo(() => {
- if (isEraser) return 'Eraser';
- if (isLiquify) return 'Liquify';
- if (isRetouch) return 'Retouch';
- if (brushSettings.brushName?.trim()) return brushSettings.brushName.trim();
+ if (isEraser) return t('Eraser');
+ if (isLiquify) return t('Liquify');
+ if (isRetouch) return t('Retouch');
+ if (brushSettings.brushName?.trim()) return td(brushSettings.brushName.trim());
const normalized = migrateLegacyPresetId(
brushSettings.preset || activePresetId || DEFAULT_BRUSH_PRESET_ID
);
const builtin = ALL_BUILTIN_BRUSHES.find((b) => b.id === normalized);
- return builtin?.name ?? 'Brush';
- }, [activePresetId, brushSettings.brushName, brushSettings.preset, isEraser, isLiquify, isRetouch]);
+ return builtin?.name ? td(builtin.name) : t('Brush');
+ }, [
+ activePresetId,
+ brushSettings.brushName,
+ brushSettings.preset,
+ isEraser,
+ isLiquify,
+ isRetouch,
+ t,
+ td,
+ ]);
const handleSizeChange = (nextSize: number) => {
if (isLiquify) {
@@ -134,7 +145,7 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
<section
ref={cardRef}
role="region"
- aria-label="Focus Brush Controls"
+ aria-label={t('Focus Brush Controls')}
data-testid="focus-brush-sliders-hud"
data-anchor-side={anchorSide}
data-collapsed={String(collapsed)}
@@ -152,7 +163,7 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
data-testid="focus-brush-hud-drag-handle"
onPointerDown={handleStartDrag}
onDoubleClick={handleResetWidgetPosition}
- title="Drag to move Brush Controls · Double-click to snap back"
+ title={t('Drag to move Brush Controls · Double-click to snap back')}
className="group h-6 px-2 flex items-center justify-between gap-1.5 cursor-grab active:cursor-grabbing border-b border-ui-subtle"
>
<div className="flex items-center gap-1.5 min-w-0">
@@ -166,9 +177,9 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
type="button"
data-testid="focus-brush-hud-collapse-btn"
onClick={() => setCollapsed((v) => !v)}
- aria-label={collapsed ? 'Expand Brush Controls' : 'Collapse Brush Controls'}
+ aria-label={collapsed ? t('Expand Brush Controls') : t('Collapse Brush Controls')}
aria-expanded={!collapsed}
- title={collapsed ? 'Expand Brush Controls' : 'Collapse Brush Controls'}
+ title={collapsed ? t('Expand Brush Controls') : t('Collapse Brush Controls')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer shrink-0"
>
{collapsed ? (
@@ -184,8 +195,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
<div className="p-2 space-y-1.5">
<ScrubSlider
data-testid="focus-brush-size-slider"
- label="Size"
- aria-label="Brush Size"
+ label={t('Size')}
+ aria-label={t('Brush Size')}
size="xs"
variant="size"
logarithmic
@@ -201,8 +212,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
<ScrubSlider
data-testid="focus-brush-opacity-slider"
- label={usesStrength ? 'Strength' : 'Opacity'}
- aria-label={usesStrength ? 'Tool Strength' : 'Brush Opacity'}
+ label={usesStrength ? t('Strength') : t('Opacity')}
+ aria-label={usesStrength ? t('Tool Strength') : t('Brush Opacity')}
size="xs"
variant="opacity"
min={1}
@@ -216,8 +227,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
<ScrubSlider
data-testid="focus-brush-flow-slider"
- label="Flow / Ink"
- aria-label="Brush Flow"
+ label={t('Flow / Ink')}
+ aria-label={t('Brush Flow')}
size="xs"
variant="opacity"
min={1}
@@ -237,8 +248,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
data-testid="focus-hud-undo-btn"
disabled={!commandHandlers.canUndo}
onClick={() => commandHandlers.onUndo()}
- title="Undo (Ctrl+Z)"
- aria-label="Undo"
+ title={t('Undo (Ctrl+Z)')}
+ aria-label={t('Undo')}
className={`h-6 rounded-ui-xs border flex items-center justify-center transition-colors ${
commandHandlers.canUndo
? 'bg-ui-control border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer'
@@ -253,8 +264,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
data-testid="focus-hud-redo-btn"
disabled={!commandHandlers.canRedo}
onClick={() => commandHandlers.onRedo()}
- title="Redo (Ctrl+Y)"
- aria-label="Redo"
+ title={t('Redo (Ctrl+Y)')}
+ aria-label={t('Redo')}
className={`h-6 rounded-ui-xs border flex items-center justify-center transition-colors ${
commandHandlers.canRedo
? 'bg-ui-control border-ui-subtle text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer'
@@ -269,8 +280,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
data-testid="focus-hud-brush-btn"
aria-pressed={paintActive}
onClick={() => toolStoreActions.selectTool(lastPaintTool || 'brush')}
- title="Brush (B)"
- aria-label="Brush Tool"
+ title={t('Brush (B)')}
+ aria-label={t('Brush Tool')}
className={`h-6 rounded-ui-xs border flex items-center justify-center transition-colors cursor-pointer ${
paintActive
? 'bg-ui-control-active border-ui-accent-border text-ui-accent'
@@ -285,8 +296,8 @@ export const FocusBrushSlidersHud: React.FC<FocusBrushSlidersHudProps> = React.m
data-testid="focus-hud-eraser-btn"
aria-pressed={isEraser}
onClick={() => toolStoreActions.selectTool('eraser')}
- title="Eraser (E)"
- aria-label="Eraser Tool"
+ title={t('Eraser (E)')}
+ aria-label={t('Eraser Tool')}
className={`h-6 rounded-ui-xs border flex items-center justify-center transition-colors cursor-pointer ${
isEraser
? 'bg-ui-control-active border-ui-accent-border text-ui-accent'
diff --git a/src/components/focus/FocusFloatingColorCard.tsx b/src/components/focus/FocusFloatingColorCard.tsx
index 52920b0..7a1f1c6 100644
--- a/src/components/focus/FocusFloatingColorCard.tsx
+++ b/src/components/focus/FocusFloatingColorCard.tsx
@@ -5,6 +5,7 @@ import { FocusHudPoint } from '../../types/workspace';
import { toolStoreActions, useToolStore, workspaceStoreActions } from '../../stores';
import { ColorWheel } from '../ColorWheel';
import { FocusGripDots, getFocusHudSurfaceStyle, useFocusHudDrag } from './focusHudUtils';
+import { useI18n } from '../../i18n';
export interface FocusFloatingColorCardProps {
colorMode: CanvasColorMode;
@@ -16,6 +17,7 @@ export interface FocusFloatingColorCardProps {
export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = React.memo(
({ colorMode, leftHandedMode, floatingOpacity, isAutoFaded, customPosition }) => {
+ const { t } = useI18n();
const primaryColor = useToolStore((s) => s.primaryColor);
const secondaryColor = useToolStore((s) => s.secondaryColor);
const recentColors = useToolStore((s) => s.recentColors);
@@ -58,7 +60,7 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
<section
ref={cardRef}
role="region"
- aria-label="Focus Color Wheel"
+ aria-label={t('Focus Color Wheel')}
data-testid="focus-color-card"
data-anchor-side={anchorSide}
data-collapsed={String(collapsed)}
@@ -76,7 +78,7 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
data-testid="focus-color-card-drag-handle"
onPointerDown={handleStartDrag}
onDoubleClick={handleResetWidgetPosition}
- title="Drag to move Color Wheel · Double-click to snap back"
+ title={t('Drag to move Color Wheel · Double-click to snap back')}
className={`group h-7 px-2 flex items-center justify-between gap-1.5 cursor-grab active:cursor-grabbing ${
collapsed ? '' : 'border-b border-ui-subtle'
}`}
@@ -101,9 +103,9 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
data-testid="focus-color-collapse-btn"
onClick={() => setCollapsed((v) => !v)}
- aria-label={collapsed ? 'Expand Color Wheel' : 'Collapse Color Wheel'}
+ aria-label={collapsed ? t('Expand Color Wheel') : t('Collapse Color Wheel')}
aria-expanded={!collapsed}
- title={collapsed ? 'Expand Color Wheel' : 'Collapse Color Wheel'}
+ title={collapsed ? t('Expand Color Wheel') : t('Collapse Color Wheel')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
{collapsed ? <ChevronDown className="w-3 h-3" /> : <Minus className="w-3 h-3" />}
@@ -112,8 +114,8 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
data-testid="focus-color-close-btn"
onClick={() => workspaceStoreActions.updateFocusHud({ showFloatingColorWheel: false })}
- aria-label="Hide Floating Color Wheel"
- title="Hide Color Wheel in Focus Mode"
+ aria-label={t('Hide Floating Color Wheel')}
+ title={t('Hide Color Wheel in Focus Mode')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover transition-colors cursor-pointer"
>
<X className="w-3 h-3" />
@@ -155,8 +157,8 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
data-testid="focus-color-secondary-swatch"
onClick={() => setActiveTarget('secondary')}
- title={`Secondary Color: ${secondaryColor}`}
- aria-label="Select Secondary Color"
+ title={t('Secondary Color: {color}', { color: secondaryColor })}
+ aria-label={t('Select Secondary Color')}
className={`absolute bottom-0 right-0 w-4 h-4 rounded-ui-xs cursor-pointer transition-shadow ${
activeTarget === 'secondary'
? 'ring-[1.5px] ring-ui-accent z-20'
@@ -168,8 +170,8 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
data-testid="focus-color-primary-swatch"
onClick={() => setActiveTarget('primary')}
- title={`Primary Color: ${primaryColor}`}
- aria-label="Select Primary Color"
+ title={t('Primary Color: {color}', { color: primaryColor })}
+ aria-label={t('Select Primary Color')}
className={`absolute top-0 left-0 w-4 h-4 rounded-ui-xs cursor-pointer transition-shadow ${
activeTarget === 'primary' && !isTransparentColor
? 'ring-[1.5px] ring-ui-accent z-20'
@@ -183,8 +185,8 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
data-testid="focus-color-swap-btn"
onClick={() => toolStoreActions.swapColors(colorMode)}
- title="Swap Primary & Secondary Colors (X)"
- aria-label="Swap Colors"
+ title={t('Swap Primary & Secondary Colors (X)')}
+ aria-label={t('Swap Colors')}
className="w-5 h-5 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-subtle flex items-center justify-center text-ui-muted hover:text-ui-primary transition-colors cursor-pointer"
>
<ArrowLeftRight className="w-3 h-3" />
@@ -199,7 +201,7 @@ export const FocusFloatingColorCard: React.FC<FocusFloatingColorCardProps> = Rea
type="button"
onClick={() => toolStoreActions.setPrimaryColor(hex, true, colorMode)}
title={hex.toUpperCase()}
- aria-label={`Pick recent color ${hex}`}
+ aria-label={t('Pick recent color {color}', { color: hex })}
className="w-3.5 h-3.5 rounded-ui-xs border border-ui-default hover:border-ui-strong cursor-pointer shrink-0"
style={{ backgroundColor: hex }}
/>
diff --git a/src/components/focus/FocusModeOverlay.tsx b/src/components/focus/FocusModeOverlay.tsx
index 4fc2c31..152e0e3 100644
--- a/src/components/focus/FocusModeOverlay.tsx
+++ b/src/components/focus/FocusModeOverlay.tsx
@@ -15,6 +15,7 @@ import { FocusQuickActionDock } from './FocusQuickActionDock';
import { FocusFloatingColorCard } from './FocusFloatingColorCard';
import { FocusToolRail } from './FocusToolRail';
import { getFocusHudSurfaceStyle } from './focusHudUtils';
+import { isImeComposing, useI18n } from '../../i18n';
export interface FocusModeOverlayProps {
colorMode: CanvasColorMode;
@@ -28,6 +29,7 @@ const GEAR_POPOVER_EST_HEIGHT = 340;
const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
({ colorMode, commandHandlers, onTransformSelection, onToggleTransparentColor }) => {
+ const { t } = useI18n();
const focusHud = useWorkspaceStore((s) => s.focusHud);
const leftHandedMode = useWorkspaceStore((s) => s.leftHandedMode);
const floatingOpacity = useUiStore((s) => s.appSettings.appearance.floatingOpacity);
@@ -74,6 +76,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
setGearOpen(false);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.stopPropagation();
setGearOpen(false);
@@ -117,12 +120,12 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
type="button"
data-testid="focus-exit-pill"
onClick={() => workspaceStoreActions.setPalettesHidden(false)}
- title="Exit Focus Mode (Tab)"
- aria-label="Exit Focus Mode (Tab)"
+ title={t('Exit Focus Mode (Tab)')}
+ aria-label={t('Exit Focus Mode (Tab)')}
className="h-5 px-2 rounded-full text-[10.5px] font-medium text-ui-secondary hover:text-ui-primary hover:bg-ui-control-hover flex items-center gap-1.5 transition-colors cursor-pointer whitespace-nowrap"
>
<Eye className="w-3 h-3 text-ui-accent shrink-0" />
- <span>Exit Focus</span>
+ <span>{t('Exit Focus')}</span>
<span className="text-[9.5px] font-ui-mono text-ui-muted">(Tab)</span>
</button>
@@ -132,9 +135,9 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
ref={gearBtnRef}
type="button"
data-testid="focus-hud-gear-btn"
- aria-label="Focus Mode HUD Settings"
+ aria-label={t('Focus Mode HUD Settings')}
aria-expanded={gearOpen}
- title="Customize Focus Mode HUDs"
+ title={t('Customize Focus Mode HUDs')}
onClick={() => {
setGearOpen((prev) => {
if (!prev) {
@@ -161,7 +164,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<div
ref={popoverRef}
role="dialog"
- aria-label="Focus Mode HUD Options"
+ aria-label={t('Focus Mode HUD Options')}
data-testid="focus-hud-settings-popover"
onPointerDown={(e) => e.stopPropagation()}
onWheel={(e) => e.stopPropagation()}
@@ -175,11 +178,11 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
className="rounded-ui-md bg-ui-elevated border border-ui-default shadow-ui-popover p-2.5 text-[11px] text-ui-primary space-y-2.5 select-none ui-icon-stroke"
>
<div className="flex items-center justify-between pb-1.5 border-b border-ui-subtle">
- <span className="font-medium text-xs text-ui-primary">Focus Mode HUDs</span>
+ <span className="font-medium text-xs text-ui-primary">{t('Focus Mode HUDs')}</span>
<button
type="button"
onClick={() => setGearOpen(false)}
- aria-label="Close Focus HUD Options"
+ aria-label={t('Close Focus HUD Options')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<X className="w-3 h-3" />
@@ -199,7 +202,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
: 'text-ui-muted hover:text-ui-primary border border-transparent'
}`}
>
- Atelier HUD
+ {t('Atelier HUD')}
</button>
<button
type="button"
@@ -212,7 +215,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
: 'text-ui-muted hover:text-ui-primary border border-transparent'
}`}
>
- Pure Canvas
+ {t('Pure Canvas')}
</button>
</div>
@@ -221,7 +224,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-tool-rail"
size="xs"
- label="Tool Rail"
+ label={t('Tool Rail')}
checked={focusHud.showToolRail}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ showToolRail: checked })
@@ -230,7 +233,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-brush-sliders"
size="xs"
- label="Brush Sliders HUD"
+ label={t('Brush Sliders HUD')}
checked={focusHud.showBrushSlidersHud}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ showBrushSlidersHud: checked })
@@ -239,7 +242,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-quick-dock"
size="xs"
- label="Quick Action Dock"
+ label={t('Quick Action Dock')}
checked={focusHud.showQuickActionDock}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ showQuickActionDock: checked })
@@ -248,7 +251,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-color-wheel"
size="xs"
- label="Floating Color Wheel"
+ label={t('Floating Color Wheel')}
checked={focusHud.showFloatingColorWheel}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ showFloatingColorWheel: checked })
@@ -257,7 +260,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-quick-brushes"
size="xs"
- label="Quick Brush Panel"
+ label={t('Quick Brush Panel')}
checked={focusHud.keepQuickBrushPanel}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ keepQuickBrushPanel: checked })
@@ -269,7 +272,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-hide-header"
size="xs"
- label="Hide Top Header Bar"
+ label={t('Hide Top Header Bar')}
checked={focusHud.hideHeaderInFocus}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ hideHeaderInFocus: checked })
@@ -278,7 +281,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
<ToggleSwitch
data-testid="focus-popover-toggle-auto-fade"
size="xs"
- label="Auto-Fade While Drawing"
+ label={t('Auto-Fade While Drawing')}
checked={focusHud.autoFadeWhileDrawing}
onChange={(checked) =>
workspaceStoreActions.updateFocusHud({ autoFadeWhileDrawing: checked })
@@ -292,7 +295,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
data-testid="focus-reset-positions-btn"
onClick={() => {
workspaceStoreActions.resetFocusHudPositions();
- uiStoreActions.showToast('Focus HUD positions reset');
+ uiStoreActions.showToast(t('Focus HUD positions reset'));
}}
className={`w-full h-6 px-2 rounded-ui-sm border text-[10px] flex items-center justify-center gap-1 transition-colors cursor-pointer ${
hasCustomPositions
@@ -301,7 +304,7 @@ const FocusModeOverlayActive: React.FC<FocusModeOverlayProps> = React.memo(
}`}
>
<RotateCcw className="w-3 h-3" />
- <span>Reset HUD Positions</span>
+ <span>{t('Reset HUD Positions')}</span>
</button>
</div>
</div>,
diff --git a/src/components/focus/FocusQuickActionDock.tsx b/src/components/focus/FocusQuickActionDock.tsx
index e12a615..61b9d06 100644
--- a/src/components/focus/FocusQuickActionDock.tsx
+++ b/src/components/focus/FocusQuickActionDock.tsx
@@ -11,6 +11,7 @@ import {
renderCommandIcon,
} from '../CommandBar';
import { FocusGripDots, getFocusHudSurfaceStyle, useFocusHudDrag } from './focusHudUtils';
+import { isImeComposing, useI18n } from '../../i18n';
export interface FocusQuickActionDockProps {
commandHandlers: WorkspaceCommandHandlers;
@@ -24,6 +25,7 @@ const POPOVER_EST_HEIGHT = 336;
export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.memo(
({ commandHandlers, floatingOpacity, isAutoFaded, customPosition }) => {
+ const { t, td } = useI18n();
const quickActionIds = useWorkspaceStore((s) => s.focusHud.quickActionIds);
const palettesHidden = useWorkspaceStore((s) => s.palettesHidden);
const quickBrushVisible = useWorkspaceStore((s) => s.quickBrushPanel.visible);
@@ -93,6 +95,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
setCustomizeOpen(false);
};
const handleKey = (e: KeyboardEvent) => {
+ if (isImeComposing(e)) return;
if (e.key === 'Escape') {
e.stopPropagation();
setCustomizeOpen(false);
@@ -135,7 +138,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
<div
ref={dockRef}
role="toolbar"
- aria-label="Focus Quick Actions"
+ aria-label={t('Focus Quick Actions')}
data-testid="focus-quick-action-dock"
data-anchor-side={isFixed ? 'custom' : 'bottom-center'}
data-hud-blur={floatingOpacity < 0.98 ? 'true' : 'false'}
@@ -152,7 +155,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
data-testid="focus-quick-action-drag-handle"
onPointerDown={handleStartDrag}
onDoubleClick={handleResetWidgetPosition}
- title="Drag to move Quick Action Dock · Double-click to recenter"
+ title={t('Drag to move Quick Action Dock · Double-click to recenter')}
className="group h-full px-1 flex items-center justify-center cursor-grab active:cursor-grabbing shrink-0"
>
<FocusGripDots orientation="vertical" />
@@ -173,6 +176,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
quickBrushVisible,
activeTool
);
+ const label = td(entry.label);
return (
<button
key={cmdId}
@@ -180,8 +184,8 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
data-testid={`focus-quick-action-${cmdId}`}
disabled={disabled}
onClick={() => executeWorkspaceCommand(cmdId, commandHandlers)}
- title={`${entry.label}${entry.shortcut ? ` (${entry.shortcut})` : ''}`}
- aria-label={entry.label}
+ title={`${label}${entry.shortcut ? ` (${entry.shortcut})` : ''}`}
+ aria-label={label}
aria-pressed={active || undefined}
className={`w-7 h-7 rounded-full flex items-center justify-center transition-colors shrink-0 ${
disabled
@@ -204,9 +208,9 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
ref={customizeBtnRef}
type="button"
data-testid="focus-quick-action-customize-btn"
- aria-label="Customize Quick Action Dock"
+ aria-label={t('Customize Quick Action Dock')}
aria-expanded={customizeOpen}
- title="Customize Quick Actions"
+ title={t('Customize Quick Actions')}
onClick={() => {
setCustomizeOpen((prev) => {
if (!prev) {
@@ -233,7 +237,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
<div
ref={popoverRef}
role="dialog"
- aria-label="Customize Focus Quick Actions"
+ aria-label={t('Customize Focus Quick Actions')}
data-testid="focus-quick-action-customize-popover"
onPointerDown={(e) => e.stopPropagation()}
onWheel={(e) => e.stopPropagation()}
@@ -247,22 +251,22 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
className="rounded-ui-md bg-ui-elevated border border-ui-default shadow-ui-popover p-2 text-[11px] text-ui-primary select-none"
>
<div className="flex items-center justify-between pb-1.5 mb-1.5 border-b border-ui-subtle">
- <span className="font-medium text-xs">Quick Action Dock</span>
+ <span className="font-medium text-xs">{t('Quick Action Dock')}</span>
<div className="flex items-center gap-1.5">
<button
type="button"
data-testid="focus-quick-action-reset-btn"
onClick={() => workspaceStoreActions.resetFocusQuickActions()}
- title="Reset to default focus actions"
+ title={t('Reset to default focus actions')}
className="text-[10px] text-ui-muted hover:text-ui-primary flex items-center gap-0.5 cursor-pointer"
>
<RotateCcw className="w-2.5 h-2.5" />
- <span>Reset</span>
+ <span>{t('Reset')}</span>
</button>
<button
type="button"
onClick={() => setCustomizeOpen(false)}
- aria-label="Close customize popover"
+ aria-label={t('Close customize popover')}
className="w-4 h-4 rounded-ui-xs flex items-center justify-center text-ui-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
>
<X className="w-3 h-3" />
@@ -274,7 +278,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
{quickActionIds.length > 0 && (
<div className="mb-2 space-y-0.5 max-h-28 overflow-y-auto">
<div className="text-[9.5px] uppercase tracking-wider text-ui-muted px-1 mb-0.5 tabular-nums">
- Active ({quickActionIds.length})
+ {t('Active ({count})', { count: quickActionIds.length })}
</div>
{quickActionIds.map((cid, idx) => {
const entry = catalogById.get(cid);
@@ -286,14 +290,14 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
>
<div className="flex items-center gap-1.5 min-w-0">
{renderCommandIcon(cid, palettesHidden)}
- <span className="truncate text-[10.5px]">{entry.label}</span>
+ <span className="truncate text-[10.5px]">{td(entry.label)}</span>
</div>
<div className="flex items-center gap-0.5 shrink-0">
<button
type="button"
disabled={idx === 0}
onClick={() => workspaceStoreActions.moveFocusQuickAction(cid, -1)}
- title="Move left"
+ title={t('Move left')}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronLeft className="w-3 h-3" />
@@ -302,7 +306,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
type="button"
disabled={idx === quickActionIds.length - 1}
onClick={() => workspaceStoreActions.moveFocusQuickAction(cid, 1)}
- title="Move right"
+ title={t('Move right')}
className="p-0.5 text-ui-muted hover:text-ui-primary disabled:opacity-25 cursor-pointer"
>
<ChevronRight className="w-3 h-3" />
@@ -310,7 +314,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
<button
type="button"
onClick={() => toggleAction(cid)}
- title="Remove"
+ title={t('Remove')}
className="p-0.5 text-ui-muted hover:text-ui-danger cursor-pointer"
>
<X className="w-3 h-3" />
@@ -324,7 +328,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
{/* All COMMAND_CATALOG Entries */}
<div className="text-[9.5px] uppercase tracking-wider text-ui-muted px-1 mb-0.5">
- Available Commands
+ {t('Available Commands')}
</div>
<div className="max-h-40 overflow-y-auto space-y-0.5">
{COMMAND_CATALOG.map((entry) => {
@@ -343,7 +347,7 @@ export const FocusQuickActionDock: React.FC<FocusQuickActionDockProps> = React.m
>
<span className="flex items-center gap-1.5 min-w-0">
{renderCommandIcon(entry.id, palettesHidden)}
- <span className="truncate text-[10.5px]">{entry.label}</span>
+ <span className="truncate text-[10.5px]">{td(entry.label)}</span>
</span>
{pinned && <Check className="w-3 h-3 text-ui-accent shrink-0" />}
</button>
diff --git a/src/components/focus/FocusToolRail.tsx b/src/components/focus/FocusToolRail.tsx
index 6fe9ce2..d81dd28 100644
--- a/src/components/focus/FocusToolRail.tsx
+++ b/src/components/focus/FocusToolRail.tsx
@@ -17,6 +17,7 @@ import { FocusHudPoint } from '../../types/workspace';
import { toolStoreActions, useToolStore } from '../../stores';
import { LiquifyIcon } from '../LiquifyIcon';
import { FocusGripDots, getFocusHudSurfaceStyle, useFocusHudDrag } from './focusHudUtils';
+import { useI18n } from '../../i18n';
export interface FocusToolRailProps {
leftHandedMode: boolean;
@@ -36,6 +37,7 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
onTransformSelection,
onToggleTransparentColor,
}) => {
+ const { t } = useI18n();
const currentTool = useToolStore((s) => s.tool);
const primaryColor = useToolStore((s) => s.primaryColor);
const secondaryColor = useToolStore((s) => s.secondaryColor);
@@ -54,20 +56,20 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
icon: React.ReactNode;
onClick?: () => void;
}> = [
- { id: 'brush', label: 'Brush (B)', icon: <Paintbrush className="w-3.5 h-3.5" /> },
- { id: 'eraser', label: 'Eraser (E)', icon: <Eraser className="w-3.5 h-3.5" /> },
- { id: 'pipette', label: 'Eyedropper (I)', icon: <Pipette className="w-3.5 h-3.5" /> },
- { id: 'select-lasso', label: 'Lasso (L)', icon: <Lasso className="w-3.5 h-3.5" /> },
- { id: 'select-rect', label: 'Marquee (M)', icon: <BoxSelect className="w-3.5 h-3.5" /> },
- { id: 'fill', label: 'Fill (G)', icon: <PaintBucket className="w-3.5 h-3.5" /> },
- { id: 'gradient', label: 'Gradient (Shift+G)', icon: <Blend className="w-3.5 h-3.5" /> },
- { id: 'liquify', label: 'Liquify (J)', icon: <LiquifyIcon className="w-3.5 h-3.5" /> },
- { id: 'retouch', label: 'Retouch (S)', icon: <Droplets className="w-3.5 h-3.5" /> },
- { id: 'shape', label: 'Shapes (U)', icon: <Shapes className="w-3.5 h-3.5" /> },
- { id: 'pen', label: 'Bézier Pen (P)', icon: <Feather className="w-3.5 h-3.5" /> },
+ { id: 'brush', label: t('Brush (B)'), icon: <Paintbrush className="w-3.5 h-3.5" /> },
+ { id: 'eraser', label: t('Eraser (E)'), icon: <Eraser className="w-3.5 h-3.5" /> },
+ { id: 'pipette', label: t('Eyedropper (I)'), icon: <Pipette className="w-3.5 h-3.5" /> },
+ { id: 'select-lasso', label: t('Lasso (L)'), icon: <Lasso className="w-3.5 h-3.5" /> },
+ { id: 'select-rect', label: t('Marquee (M)'), icon: <BoxSelect className="w-3.5 h-3.5" /> },
+ { id: 'fill', label: t('Fill (G)'), icon: <PaintBucket className="w-3.5 h-3.5" /> },
+ { id: 'gradient', label: t('Gradient (Shift+G)'), icon: <Blend className="w-3.5 h-3.5" /> },
+ { id: 'liquify', label: t('Liquify (J)'), icon: <LiquifyIcon className="w-3.5 h-3.5" /> },
+ { id: 'retouch', label: t('Retouch (S)'), icon: <Droplets className="w-3.5 h-3.5" /> },
+ { id: 'shape', label: t('Shapes (U)'), icon: <Shapes className="w-3.5 h-3.5" /> },
+ { id: 'pen', label: t('Bézier Pen (P)'), icon: <Feather className="w-3.5 h-3.5" /> },
{
id: 'transform',
- label: 'Transform (Ctrl+T)',
+ label: t('Transform (Ctrl+T)'),
icon: <Scaling className="w-3.5 h-3.5" />,
onClick: () => {
toolStoreActions.selectTool('transform');
@@ -101,7 +103,7 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
<aside
ref={railRef}
role="toolbar"
- aria-label="Focus Tool Rail"
+ aria-label={t('Focus Tool Rail')}
aria-orientation="vertical"
data-testid="focus-tool-rail"
data-anchor-side={anchorSide}
@@ -119,7 +121,7 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
data-testid="focus-tool-rail-drag-handle"
onPointerDown={handleStartDrag}
onDoubleClick={handleResetWidgetPosition}
- title="Drag to move Tool Rail · Double-click to snap back"
+ title={t('Drag to move Tool Rail · Double-click to snap back')}
className="group w-full pb-1 mb-0.5 flex items-center justify-center border-b border-ui-subtle cursor-grab active:cursor-grabbing shrink-0"
>
<FocusGripDots orientation="horizontal" />
@@ -163,8 +165,8 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
<button
type="button"
onClick={() => toolStoreActions.swapColors()}
- title={`Secondary: ${secondaryColor} (X to swap)`}
- aria-label="Swap colors"
+ title={t('Secondary: {color} (X to swap)', { color: secondaryColor })}
+ aria-label={t('Swap colors')}
className="absolute bottom-0 right-0 w-3.5 h-3.5 rounded-ui-xs ring-1 ring-ui-strong cursor-pointer"
style={{ backgroundColor: secondaryColor }}
/>
@@ -178,8 +180,8 @@ export const FocusToolRail: React.FC<FocusToolRailProps> = React.memo(
toolStoreActions.swapColors();
}
}}
- title={`Primary: ${primaryColor}`}
- aria-label="Primary color swatch"
+ title={t('Primary: {color}', { color: primaryColor })}
+ aria-label={t('Primary color swatch')}
className={`absolute top-0 left-0 w-3.5 h-3.5 rounded-ui-xs z-10 cursor-pointer ${
!isTransparentColor ? 'ring-[1.5px] ring-ui-accent' : 'ring-1 ring-ui-strong opacity-70'
}`}
diff --git a/src/components/timelapse/TimelapseFullscreenViewer.tsx b/src/components/timelapse/TimelapseFullscreenViewer.tsx
index 12ee28a..4df8be2 100644
--- a/src/components/timelapse/TimelapseFullscreenViewer.tsx
+++ b/src/components/timelapse/TimelapseFullscreenViewer.tsx
@@ -11,6 +11,7 @@ import {
} from 'lucide-react';
import { TimelapseDurationPreset } from '../../utils/timelapseEngine';
import { formatTimecode, TimelapsePlaybackSpeed } from './useTimelapsePreviewPlayer';
+import { useI18n } from '../../i18n';
const QUICK_INTERVALS: Array<{ value: TimelapseDurationPreset; label: string }> = [
{ value: '15s', label: '15s' },
@@ -71,6 +72,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
loop,
onToggleLoop,
}) => {
+ const { t, td } = useI18n();
const containerRef = useRef<HTMLDivElement | null>(null);
const [hudVisible, setHudVisible] = useState(true);
const hideTimerRef = useRef<number | null>(null);
@@ -153,7 +155,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
ref={containerRef}
role="dialog"
aria-modal="true"
- aria-label="Time-lapse Full-screen Preview"
+ aria-label={t('Time-lapse Full-screen Preview')}
onMouseMove={bumpHud}
onClick={(e) => e.stopPropagation()}
className="fixed inset-0 z-[100] bg-black flex flex-col items-center justify-center select-none overflow-hidden"
@@ -166,22 +168,27 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
>
<div className="flex items-center gap-3 min-w-0">
<span className="text-sm font-medium text-white truncate">
- {documentName.replace(/\*+$/, '') || 'Untitled'}
+ {td(documentName.replace(/\*+$/, '') || 'Untitled')}
</span>
<span className="text-[11px] font-ui-mono tabular-nums text-white/70 bg-white/10 px-2 py-0.5 rounded-ui-sm">
- {outputDims.width}×{outputDims.height} · {fps} FPS · {totalCapturedFrames} frames
+ {t('{width}×{height} · {fps} FPS · {count} frames', {
+ width: outputDims.width,
+ height: outputDims.height,
+ fps,
+ count: totalCapturedFrames,
+ })}
</span>
</div>
<button
type="button"
onClick={onExit}
- aria-label="Exit full-screen"
- title="Exit Full-screen (Esc / F)"
+ aria-label={t('Exit full-screen')}
+ title={t('Exit Full-screen (Esc / F)')}
className="px-2.5 py-1.5 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white text-xs flex items-center gap-1.5 transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
- <span>Exit</span>
+ <span>{t('Exit')}</span>
</button>
</div>
@@ -213,7 +220,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<div className="relative flex-1 flex items-center">
<input
type="range"
- aria-label="Full-screen timeline scrubber"
+ aria-label={t('Full-screen timeline scrubber')}
min={0}
max={Math.max(0, totalTimelineFrames - 1)}
value={Math.min(timelineIndex, Math.max(0, totalTimelineFrames - 1))}
@@ -235,7 +242,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<button
type="button"
onClick={onRestart}
- title="Jump to start"
+ title={t('Jump to start')}
className="p-1.5 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer"
>
<SkipBack className="w-3.5 h-3.5" />
@@ -243,7 +250,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<button
type="button"
onClick={() => onStepBy(-1)}
- title="Previous frame (Left arrow)"
+ title={t('Previous frame (Left arrow)')}
className="p-1.5 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer"
>
<ChevronLeft className="w-3.5 h-3.5" />
@@ -251,16 +258,16 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<button
type="button"
onClick={onTogglePlay}
- title="Play / Pause (Space)"
+ title={t('Play / Pause (Space)')}
className="px-3 py-1.5 rounded-ui-sm bg-white text-black hover:bg-white/90 font-medium text-xs flex items-center gap-1.5 transition-colors cursor-pointer"
>
{isPlaying ? <Pause className="w-3.5 h-3.5" /> : <Play className="w-3.5 h-3.5" />}
- <span>{isPlaying ? 'Pause' : 'Play'}</span>
+ <span>{isPlaying ? t('Pause') : t('Play')}</span>
</button>
<button
type="button"
onClick={() => onStepBy(1)}
- title="Next frame (Right arrow)"
+ title={t('Next frame (Right arrow)')}
className="p-1.5 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer"
>
<ChevronRight className="w-3.5 h-3.5" />
@@ -268,7 +275,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<button
type="button"
onClick={onToggleLoop}
- title={loop ? 'Loop enabled' : 'Loop disabled'}
+ title={loop ? t('Loop enabled') : t('Loop disabled')}
className={`p-1.5 rounded-ui-sm transition-colors cursor-pointer ${
loop
? 'bg-white/25 text-white'
@@ -280,7 +287,7 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
<button
type="button"
onClick={onCycleSpeed}
- title="Playback speed"
+ title={t('Playback speed')}
className="px-2 py-1 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white text-[11px] font-ui-mono tabular-nums cursor-pointer"
>
{playbackSpeed}×
@@ -300,20 +307,22 @@ export const TimelapseFullscreenViewer: React.FC<TimelapseFullscreenViewerProps>
: 'text-white/75 hover:text-white'
}`}
>
- {opt.label}
+ {t(opt.label)}
</button>
))}
</div>
<div className="flex items-center gap-2.5">
<span className="text-[10px] font-ui-mono tabular-nums text-white/65">
- Keyframe {Math.min(currentSourceFrameIndex + 1, totalCapturedFrames)} /{' '}
- {totalCapturedFrames}
+ {t('Keyframe {current} / {total}', {
+ current: Math.min(currentSourceFrameIndex + 1, totalCapturedFrames),
+ total: totalCapturedFrames,
+ })}
</span>
<button
type="button"
onClick={onExit}
- title="Exit Full-screen (F)"
+ title={t('Exit Full-screen (F)')}
className="p-1.5 rounded-ui-sm bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer"
>
<Minimize2 className="w-3.5 h-3.5" />
diff --git a/src/components/timelapse/TimelapseWatermarkControls.tsx b/src/components/timelapse/TimelapseWatermarkControls.tsx
index 5d429cc..ff82426 100644
--- a/src/components/timelapse/TimelapseWatermarkControls.tsx
+++ b/src/components/timelapse/TimelapseWatermarkControls.tsx
@@ -7,6 +7,7 @@ import {
TimelapseWatermarkPosition,
} from '../../utils/timelapseWatermark';
import { ToggleSwitch } from '../ui';
+import { isImeComposing, useI18n } from '../../i18n';
const POSITION_GRID: Array<{ value: TimelapseWatermarkPosition; label: string }> = [
{ value: 'top-left', label: 'TL' },
@@ -40,6 +41,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
disabled = false,
onError,
}) => {
+ const { t, tc } = useI18n();
const fileInputRef = useRef<HTMLInputElement | null>(null);
const patch = (partial: Partial<TimelapseWatermarkConfig>) => {
@@ -53,7 +55,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
const dataUrl = await prepareWatermarkImageDataUrl(file);
patch({ mode: 'image', imageDataUrl: dataUrl, enabled: true });
} catch (err) {
- onError?.(err instanceof Error ? err.message : 'Failed to load watermark image');
+ onError?.(err instanceof Error ? err.message : t('Failed to load watermark image'));
} finally {
if (fileInputRef.current) fileInputRef.current.value = '';
}
@@ -64,23 +66,23 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
{/* Master Enable Toggle */}
<div className="flex items-center justify-between bg-ui-header border border-ui-subtle rounded-ui-md px-3 py-2">
<div>
- <div className="text-[11px] font-medium text-ui-primary">Enable Watermark</div>
+ <div className="text-[11px] font-medium text-ui-primary">{t('Enable Watermark')}</div>
<div className="text-[10px] text-ui-muted">
- Rendered live in preview and burned into exported videos
+ {t('Rendered live in preview and burned into exported videos')}
</div>
</div>
<ToggleSwitch
checked={config.enabled}
onChange={(enabled) => patch({ enabled })}
disabled={disabled}
- aria-label="Enable watermark"
+ aria-label={t('Enable watermark')}
/>
</div>
<div className={config.enabled ? 'space-y-3' : 'space-y-3 opacity-50 pointer-events-none'}>
{/* Watermark Mode */}
<div className="space-y-1">
- <label className="text-[10px] uppercase tracking-wider text-ui-muted block">Type</label>
+ <label className="text-[10px] uppercase tracking-wider text-ui-muted block">{t('Type')}</label>
<div className="grid grid-cols-2 gap-1 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
<button
type="button"
@@ -93,7 +95,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
}`}
>
<Type className="w-3 h-3" />
- <span>Text</span>
+ <span>{t('Text')}</span>
</button>
<button
type="button"
@@ -106,7 +108,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
}`}
>
<ImageIcon className="w-3 h-3" />
- <span>Logo / Signature</span>
+ <span>{t('Logo / Signature')}</span>
</button>
</div>
</div>
@@ -116,7 +118,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="space-y-2.5">
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Watermark Text
+ {t('Watermark Text')}
</label>
<input
type="text"
@@ -124,7 +126,11 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
value={config.text}
disabled={disabled}
onChange={(e) => patch({ text: e.target.value })}
- placeholder="@yourhandle or Ink Studio"
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (isImeComposing(e)) return;
+ }}
+ placeholder={t('@yourhandle or Ink Studio')}
className="w-full h-7 px-2.5 rounded-ui-sm bg-ui-input border border-ui-default text-xs text-ui-primary focus:outline-none focus:border-ui-focus"
/>
</div>
@@ -132,7 +138,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="grid grid-cols-2 gap-2">
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Style
+ {t('Style')}
</label>
<div className="grid grid-cols-4 gap-0.5 bg-ui-input border border-ui-subtle p-0.5 rounded-ui-sm">
{FONT_STYLES.map((st) => (
@@ -147,7 +153,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {st.label}
+ {tc('fontStyle', st.label)}
</button>
))}
</div>
@@ -155,7 +161,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Color
+ {t('Color')}
</label>
<div className="flex items-center gap-1 h-7 px-1.5 rounded-ui-sm bg-ui-input border border-ui-subtle">
{QUICK_COLORS.map((hex) => (
@@ -175,7 +181,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
))}
<input
type="color"
- aria-label="Custom watermark color"
+ aria-label={t('Custom watermark color')}
value={config.textColor}
disabled={disabled}
onChange={(e) => patch({ textColor: e.target.value })}
@@ -186,12 +192,12 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
</div>
<div className="flex items-center justify-between bg-ui-header/70 border border-ui-subtle rounded-ui-sm px-2.5 py-1.5">
- <span className="text-[11px] text-ui-secondary">Subtle backdrop pill</span>
+ <span className="text-[11px] text-ui-secondary">{t('Subtle backdrop pill')}</span>
<ToggleSwitch
checked={config.showBackdrop}
onChange={(showBackdrop) => patch({ showBackdrop })}
disabled={disabled}
- aria-label="Watermark backdrop pill"
+ aria-label={t('Watermark backdrop pill')}
/>
</div>
</div>
@@ -209,7 +215,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
{config.imageDataUrl ? (
<img
src={config.imageDataUrl}
- alt="Watermark logo preview"
+ alt={t('Watermark logo preview')}
className="max-w-full max-h-full object-contain"
/>
) : (
@@ -218,7 +224,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
</div>
<div className="flex-1 min-w-0 space-y-1">
<div className="text-[11px] text-ui-primary font-medium truncate">
- {config.imageDataUrl ? 'Custom logo / signature' : 'No image selected'}
+ {config.imageDataUrl ? t('Custom logo / signature') : t('No image selected')}
</div>
<div className="flex items-center gap-1.5">
<button
@@ -228,14 +234,14 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
className="px-2 py-1 rounded-ui-xs bg-ui-control hover:bg-ui-control-hover border border-ui-default text-[10px] text-ui-primary flex items-center gap-1 cursor-pointer"
>
<Upload className="w-3 h-3" />
- <span>{config.imageDataUrl ? 'Replace' : 'Upload PNG/SVG'}</span>
+ <span>{config.imageDataUrl ? t('Replace') : t('Upload PNG/SVG')}</span>
</button>
{config.imageDataUrl && (
<button
type="button"
disabled={disabled}
onClick={() => patch({ imageDataUrl: null })}
- title="Remove logo"
+ title={t('Remove logo')}
className="p-1 rounded-ui-xs bg-ui-control hover:bg-ui-danger/15 border border-ui-subtle text-ui-muted hover:text-ui-danger cursor-pointer"
>
<Trash2 className="w-3 h-3" />
@@ -250,7 +256,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
{/* Position Anchor Grid */}
<div className="space-y-1">
<label className="text-[10px] uppercase tracking-wider text-ui-muted block">
- Position
+ {t('Position')}
</label>
<div className="grid grid-cols-4 gap-1 bg-ui-input border border-ui-subtle p-1 rounded-ui-sm">
{POSITION_GRID.map((pos) => (
@@ -267,7 +273,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
: 'text-ui-muted hover:text-ui-primary'
}`}
>
- {pos.label}
+ {tc('wmPos', pos.label)}
</button>
))}
</div>
@@ -277,7 +283,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="grid grid-cols-3 gap-2">
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Size</span>
+ <span>{t('Size')}</span>
<span className="font-ui-mono tabular-nums text-ui-secondary">{config.scale}%</span>
</div>
<input
@@ -294,7 +300,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Opacity</span>
+ <span>{t('Opacity')}</span>
<span className="font-ui-mono tabular-nums text-ui-secondary">
{Math.round(config.opacity * 100)}%
</span>
@@ -313,7 +319,7 @@ export const TimelapseWatermarkControls: React.FC<TimelapseWatermarkControlsProp
<div className="space-y-1">
<div className="flex items-center justify-between text-[10px] text-ui-muted">
- <span>Margin</span>
+ <span>{t('Margin')}</span>
<span className="font-ui-mono tabular-nums text-ui-secondary">{config.margin}%</span>
</div>
<input
diff --git a/src/components/ui/PrecisionNumberInput.tsx b/src/components/ui/PrecisionNumberInput.tsx
index bc6ecad..51e0b27 100644
--- a/src/components/ui/PrecisionNumberInput.tsx
+++ b/src/components/ui/PrecisionNumberInput.tsx
@@ -8,6 +8,7 @@ import {
quantizeValue,
roundToDecimals,
} from './sliderMath';
+import { isImeComposing, useI18n } from '../../i18n';
export interface PrecisionNumberInputProps {
value: number;
@@ -57,6 +58,7 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
'data-testid': dataTestId,
title,
}) => {
+ const { t } = useI18n();
const clamped = clampNumber(value, min, max);
const [isFocused, setIsFocused] = useState(false);
const [isScrubbing, setIsScrubbing] = useState(false);
@@ -245,8 +247,10 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
onDoubleClick={handleLabelDoubleClick}
title={
defaultValue !== undefined
- ? `Drag horizontally to scrub ${label} · Shift for fine · Double-click to reset`
- : `Drag horizontally to scrub ${label} · Shift for fine`
+ ? t('Drag horizontally to scrub {label} · Shift for fine · Double-click to reset', {
+ label,
+ })
+ : t('Drag horizontally to scrub {label} · Shift for fine', { label })
}
className={`h-full flex items-center pl-1.5 pr-1 text-[10px] select-none shrink-0 touch-none ${
disabled
@@ -265,7 +269,7 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
type="text"
inputMode="decimal"
disabled={disabled}
- aria-label={ariaLabel ?? label ?? 'Numeric input'}
+ aria-label={ariaLabel ?? label ?? t('Numeric input')}
value={isFocused ? draft : formatNumericValue(clamped, step)}
onFocus={(e) => {
cancelledRef.current = false;
@@ -280,6 +284,7 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
}}
onKeyDown={(e) => {
e.stopPropagation();
+ if (isImeComposing(e)) return;
if (e.key === 'Enter') {
e.preventDefault();
commitDraft();
@@ -314,7 +319,7 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
<button
type="button"
tabIndex={-1}
- aria-label={label ? `Increase ${label}` : 'Increase value'}
+ aria-label={label ? t('Increase {label}', { label }) : t('Increase value')}
onMouseDown={(e) => e.preventDefault()}
onClick={(e) => stepBy(1, e.shiftKey)}
className="flex-1 w-3.5 flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover cursor-pointer"
@@ -324,7 +329,7 @@ const PrecisionNumberInputInner: React.FC<PrecisionNumberInputProps> = ({
<button
type="button"
tabIndex={-1}
- aria-label={label ? `Decrease ${label}` : 'Decrease value'}
+ aria-label={label ? t('Decrease {label}', { label }) : t('Decrease value')}
onMouseDown={(e) => e.preventDefault()}
onClick={(e) => stepBy(-1, e.shiftKey)}
className="flex-1 w-3.5 flex items-center justify-center text-ui-icon-muted hover:text-ui-primary hover:bg-ui-control-hover border-t border-ui-subtle cursor-pointer"
diff --git a/src/components/ui/ScrubSlider.tsx b/src/components/ui/ScrubSlider.tsx
index 24b3e6c..333955c 100644
--- a/src/components/ui/ScrubSlider.tsx
+++ b/src/components/ui/ScrubSlider.tsx
@@ -19,6 +19,7 @@ import {
roundToDecimals,
valueToRatio,
} from './sliderMath';
+import { isImeComposing, useI18n } from '../../i18n';
export type ScrubSliderVariant = 'default' | 'opacity' | 'size' | 'hue';
export type ScrubSliderSize = 'xs' | 'sm' | 'md';
@@ -126,6 +127,7 @@ const ScrubSliderInner: React.FC<ScrubSliderProps> = ({
'data-testid': dataTestId,
title,
}) => {
+ const { t } = useI18n();
const globalSliderStyle = useUiStore((s) => s.appSettings.appearance.sliderStyle);
const effectiveStyle: SliderStyle = sliderStyleProp ?? globalSliderStyle ?? 'scrubber';
@@ -505,8 +507,12 @@ const ScrubSliderInner: React.FC<ScrubSliderProps> = ({
const computedTitle =
title ??
(defaultValue !== undefined
- ? `${label ? `${label}: ` : ''}${formattedValue} (Drag · Shift for fine · Double-click to reset)`
- : `${label ? `${label}: ` : ''}${formattedValue} (Drag · Shift for fine)`);
+ ? label
+ ? t('{label}: {value} (Drag · Shift for fine · Double-click to reset)', { label, value: formattedValue })
+ : t('{value} (Drag · Shift for fine · Double-click to reset)', { value: formattedValue })
+ : label
+ ? t('{label}: {value} (Drag · Shift for fine)', { label, value: formattedValue })
+ : t('{value} (Drag · Shift for fine)', { value: formattedValue }));
const renderReadout = (compact: boolean) => {
if (hideValue) return null;
@@ -523,6 +529,7 @@ const ScrubSliderInner: React.FC<ScrubSliderProps> = ({
onPointerDown={(e) => e.stopPropagation()}
onClick={(e) => e.stopPropagation()}
onKeyDown={(e) => {
+ if (isImeComposing(e)) return;
e.stopPropagation();
if (e.key === 'Enter') {
e.preventDefault();
@@ -532,7 +539,7 @@ const ScrubSliderInner: React.FC<ScrubSliderProps> = ({
cancelInlineEdit();
}
}}
- aria-label={ariaLabel ?? (label ? `${label} value` : 'Numeric value')}
+ aria-label={ariaLabel ?? (label ? t('{label} value', { label }) : t('Numeric value'))}
className={`w-14 bg-ui-elevated text-ui-primary font-ui-mono tabular-nums text-right border border-ui-focus rounded-ui-xs px-1 py-0 select-text focus:outline-none ${
compact ? 'text-[10px] h-4 leading-4' : 'text-[10.5px] h-[18px] leading-[18px]'
}`}
@@ -556,7 +563,7 @@ const ScrubSliderInner: React.FC<ScrubSliderProps> = ({
startInlineEdit(e);
}
}}
- title={allowInlineEdit && !disabled ? 'Click to type exact value' : undefined}
+ title={allowInlineEdit && !disabled ? t('Click to type exact value') : undefined}
className={`font-ui-mono tabular-nums shrink-0 rounded-ui-xs transition-colors ${
compact ? 'text-[10px] px-1' : 'text-[10.5px] px-1 -mr-0.5'
} ${
diff --git a/src/components/ui/ToggleSwitch.tsx b/src/components/ui/ToggleSwitch.tsx
index 37a126e..da7bd72 100644
--- a/src/components/ui/ToggleSwitch.tsx
+++ b/src/components/ui/ToggleSwitch.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useI18n } from '../../i18n';
export interface ToggleSwitchProps {
checked: boolean;
@@ -25,6 +26,7 @@ const ToggleSwitchInner: React.FC<ToggleSwitchProps> = ({
'aria-label': ariaLabel,
'data-testid': dataTestId,
}) => {
+ const { t } = useI18n();
const isXs = size === 'xs';
const trackDimensions = isXs ? 'w-[24px] h-[14px]' : 'w-[28px] h-[16px]';
@@ -65,7 +67,7 @@ const ToggleSwitchInner: React.FC<ToggleSwitchProps> = ({
type="button"
role="switch"
aria-checked={checked}
- aria-label={ariaLabel ?? title ?? 'Toggle'}
+ aria-label={ariaLabel ?? title ?? t('Toggle')}
disabled={disabled}
data-testid={dataTestId}
data-checked={checked ? 'true' : 'false'}
diff --git a/src/hooks/drawing/brushStrokeSession/nativeTabletBridge.ts b/src/hooks/drawing/brushStrokeSession/nativeTabletBridge.ts
index ea17e32..b9abb20 100644
--- a/src/hooks/drawing/brushStrokeSession/nativeTabletBridge.ts
+++ b/src/hooks/drawing/brushStrokeSession/nativeTabletBridge.ts
@@ -13,6 +13,8 @@ export interface NativeTabletBridgeState {
* Blocks phase=2 missed-down recovery from starting an accidental canvas stroke until genuine pen-up.
*/
contactBlockedUntilPenUp?: boolean;
+ /** Timestamp (ms) of the last in-contact sample processed during an active native stroke. */
+ lastActiveSampleTimestamp?: number;
}
export interface NativeTabletBridgeCallbacks {
@@ -21,7 +23,7 @@ export interface NativeTabletBridgeCallbacks {
isDisabled: () => boolean;
isStrokeActive?: () => boolean;
isPointOverCanvasViewport: (x: number, y: number) => boolean;
- onPointerDown: (e: React.PointerEvent<HTMLElement>) => void;
+ onPointerDown: (e: React.PointerEvent<HTMLElement>) => boolean | void;
onPointerMove: (
e: React.PointerEvent<HTMLElement>,
coalesced: PointerEvent[]
@@ -86,12 +88,26 @@ export function processNativeTabletBatch(
cb.selectTool('eraser');
}
bridge.nativeStrokeActive = true;
- cb.onPointerDown(createSyntheticNativePenEvent(s, modKeys));
+ bridge.lastActiveSampleTimestamp = s.timestamp;
+ const started = cb.onPointerDown(createSyntheticNativePenEvent(s, modKeys));
+ // If runPointerDown rejected the stroke (e.g. locked/hidden layer, mask mode without mask,
+ // unsupported layer type), do not leave nativeStrokeActive desynced as true.
+ if (started === false) {
+ bridge.nativeStrokeActive = false;
+ bridge.lastActiveSampleTimestamp = undefined;
+ if (bridge.prevToolBeforeEraserFlip !== null) {
+ const prev = bridge.prevToolBeforeEraserFlip;
+ bridge.prevToolBeforeEraserFlip = null;
+ cb.selectTool(prev);
+ }
+ return false;
+ }
return true;
};
const endActiveStroke = (s: NativeTabletSample): void => {
bridge.nativeStrokeActive = false;
+ bridge.lastActiveSampleTimestamp = undefined;
cb.onPointerUp(createSyntheticNativePenEvent(s, modKeys));
if (bridge.prevToolBeforeEraserFlip !== null) {
const prev = bridge.prevToolBeforeEraserFlip;
@@ -109,6 +125,7 @@ export function processNativeTabletBatch(
// pen-up hysteresis), resync bridge.nativeStrokeActive so the next pen-down starts cleanly.
if (bridge.nativeStrokeActive && cb.isStrokeActive && !cb.isStrokeActive()) {
bridge.nativeStrokeActive = false;
+ bridge.lastActiveSampleTimestamp = undefined;
if (bridge.prevToolBeforeEraserFlip !== null) {
const prev = bridge.prevToolBeforeEraserFlip;
bridge.prevToolBeforeEraserFlip = null;
@@ -120,8 +137,20 @@ export function processNativeTabletBatch(
if (!startStrokeFromSample(s)) {
bridge.contactBlockedUntilPenUp = true;
}
+ } else if (
+ cb.isDisabled() ||
+ (bridge.lastActiveSampleTimestamp !== undefined &&
+ s.timestamp - bridge.lastActiveSampleTimestamp > 60)
+ ) {
+ // Previous stroke missed its pen-up (or drawing became disabled); close it cleanly and start fresh.
+ endActiveStroke(s);
+ bridge.contactBlockedUntilPenUp = false;
+ if (!startStrokeFromSample(s)) {
+ bridge.contactBlockedUntilPenUp = true;
+ }
} else {
- // Already active (e.g. duplicate down): treat as drag point so we don't abort mid-stroke
+ // Immediate duplicate down from parent/child HWND: treat as drag point so we don't abort mid-stroke
+ bridge.lastActiveSampleTimestamp = s.timestamp;
const evt = createSyntheticNativePenEvent(s, modKeys);
cb.onPointerMove(evt, [evt as unknown as PointerEvent]);
}
@@ -139,11 +168,16 @@ export function processNativeTabletBatch(
// Batch all contiguous drag samples in this hardware burst
const coalesced: PointerEvent[] = [];
+ let lastDragTs: number | undefined;
while (i < batch.length && batch[i].phase === 2) {
+ lastDragTs = batch[i].timestamp;
coalesced.push(createSyntheticNativePenEvent(batch[i], modKeys) as unknown as PointerEvent);
i++;
}
if (bridge.nativeStrokeActive && coalesced.length > 0) {
+ if (lastDragTs !== undefined) {
+ bridge.lastActiveSampleTimestamp = lastDragTs;
+ }
const last = coalesced[coalesced.length - 1] as unknown as React.PointerEvent<HTMLElement>;
cb.onPointerMove(last, coalesced);
}
@@ -165,9 +199,13 @@ export function processNativeTabletBatch(
}
i++;
} else {
- // Hover (phase 0)
+ // Hover (phase 0): if pen is genuinely out of contact (no tip button, zero pressure),
+ // clear any missed pen-up / stuck nativeStrokeActive state immediately.
if ((s.buttons & 1) === 0 && s.pressure <= 0.001) {
bridge.contactBlockedUntilPenUp = false;
+ if (bridge.nativeStrokeActive) {
+ endActiveStroke(s);
+ }
}
if (
!bridge.nativeStrokeActive &&
diff --git a/src/hooks/drawing/brushStrokeSession/pointerDownHandler.ts b/src/hooks/drawing/brushStrokeSession/pointerDownHandler.ts
index e54355a..0df6acb 100644
--- a/src/hooks/drawing/brushStrokeSession/pointerDownHandler.ts
+++ b/src/hooks/drawing/brushStrokeSession/pointerDownHandler.ts
@@ -36,6 +36,7 @@ import {
} from './pointerDownInitialStamp';
import { cleanupQuickShapeState } from './quickShapeController';
import { NATIVE_PEN_POINTER_ID } from './nativeTabletBridge';
+import { isNativePenInActiveContact } from '../../../utils/nativeTabletInput';
import { isWorkspaceInteractionActive } from '../../../utils/workspacePointerGuard';
export function runPointerDown(
@@ -44,7 +45,7 @@ export function runPointerDown(
helpers: StrokeSessionHelpers,
e: React.PointerEvent<HTMLElement>,
_coalescedEvents?: PointerEvent[]
-): void {
+): boolean {
const currentTool = helpers.getTool();
const isBrushOrEraser = isBrushLikeTool(currentTool);
if (
@@ -55,24 +56,31 @@ export function runPointerDown(
params.activeLayerLockedRef.current ||
!params.activeLayerVisibleRef.current
) {
- return;
+ return false;
}
e.preventDefault();
if (params.isDrawingRef.current) {
// Defense-in-depth: never let a WinTab CXO_SYSTEM-synthesized DOM mouse pointerdown
// abort an active native pen stroke that carries true hardware pressure.
+ // Only preserve the native stroke while the native pen is genuinely in active contact;
+ // if a native pen-up was ever missed or went stale, abort cleanly so drawing never locks out.
if (
state.activePointerId === NATIVE_PEN_POINTER_ID &&
- e.pointerId !== NATIVE_PEN_POINTER_ID
+ e.pointerId !== NATIVE_PEN_POINTER_ID &&
+ isNativePenInActiveContact()
) {
- return;
+ return false;
}
helpers.abortActiveStroke();
}
+ if (state.drawRafId !== null) {
+ cancelAnimationFrame(state.drawRafId);
+ state.drawRafId = null;
+ }
const dims = params.dimensionsRef.current;
const currentLayerIdCheck = params.activeLayerIdRef.current;
- if (!currentLayerIdCheck || dims.width <= 0 || dims.height <= 0) return;
+ if (!currentLayerIdCheck || dims.width <= 0 || dims.height <= 0) return false;
// Flush any deferred idle history tasks from previous strokes before starting a new stroke
// so undo/redo order and tile deltas stay strictly consistent during rapid sketching.
@@ -80,20 +88,20 @@ export function runPointerDown(
const maskCanvas = params.getActiveMaskCanvas();
if (params.isMaskModeRef.current) {
- if (!maskCanvas) return;
+ if (!maskCanvas) return false;
}
if (params.viewportRef.current) {
state.cachedViewportRect = params.viewportRef.current.getBoundingClientRect();
}
const vRect = helpers.getViewportRect();
- if (!vRect) return;
+ if (!vRect) return false;
const draftCanvas = params.effectiveDraftCanvasRef?.current as
| DraftCanvasElement
| null
| undefined;
- if (!draftCanvas) return;
+ if (!draftCanvas) return false;
if (state.clearDraftRaf !== null) {
cancelAnimationFrame(state.clearDraftRaf);
@@ -101,7 +109,7 @@ export function runPointerDown(
}
const draftCtx = getGpu2DContext(draftCanvas);
- if (!draftCtx) return;
+ if (!draftCtx) return false;
const isEraser = currentTool === 'eraser';
const currentLayerId = params.activeLayerIdRef.current;
@@ -617,4 +625,5 @@ export function runPointerDown(
if (pipeline.getPendingCount() > 0 && state.drawRafId === null) {
state.drawRafId = requestAnimationFrame(helpers.flushPendingPoints);
}
+ return true;
}
diff --git a/src/hooks/drawing/brushStrokeSession/pointerUpHandler.ts b/src/hooks/drawing/brushStrokeSession/pointerUpHandler.ts
index 348b07a..70cad9d 100644
--- a/src/hooks/drawing/brushStrokeSession/pointerUpHandler.ts
+++ b/src/hooks/drawing/brushStrokeSession/pointerUpHandler.ts
@@ -61,40 +61,57 @@ export function runPointerUp(
}
clearQuickShapeHoldTimer(state);
- const isQuickShape = state.quickShapeSession !== null;
- const quickShapeKind = state.quickShapeSession?.currentShape.kind ?? null;
- if (isQuickShape) {
- if (state.quickShapeRafId !== null) {
- cancelAnimationFrame(state.quickShapeRafId);
- state.quickShapeRafId = null;
+ let postCommitMeta: {
+ isEraser: boolean;
+ isTransparentInk: boolean;
+ strokeColor: string;
+ currentLayerId: string;
+ isMaskMode: boolean;
+ } | null = null;
+
+ try {
+ const isQuickShape = state.quickShapeSession !== null;
+ const quickShapeKind = state.quickShapeSession?.currentShape.kind ?? null;
+ if (isQuickShape) {
+ if (state.quickShapeRafId !== null) {
+ cancelAnimationFrame(state.quickShapeRafId);
+ state.quickShapeRafId = null;
+ }
+ flushPendingQuickShapeDrag(state, params, helpers);
+ } else {
+ helpers.flushPendingPoints(true);
}
- flushPendingQuickShapeDrag(state, params, helpers);
- } else {
- helpers.flushPendingPoints(true);
- }
- const bs = helpers.getBrushSettings();
- const dims = params.dimensionsRef.current;
- const grid = params.activeTileGridRef.current;
- const endPoint = helpers.getCanvasPoint(e);
- const draftCanvas = params.effectiveDraftCanvasRef?.current as
- | DraftCanvasElement
- | null
- | undefined;
- const maskCanvas = params.getActiveMaskCanvas();
+ const bs = helpers.getBrushSettings();
+ const dims = params.dimensionsRef.current;
+ const grid = params.activeTileGridRef.current;
+ const endPoint = helpers.getCanvasPoint(e);
+ const draftCanvas = params.effectiveDraftCanvasRef?.current as
+ | DraftCanvasElement
+ | null
+ | undefined;
+ const maskCanvas = params.getActiveMaskCanvas();
- const currentTool = helpers.getTool();
- const currentLayerId = params.activeLayerIdRef.current;
- const isEraser = currentTool === 'eraser';
- const isBgEraser = isEraser && isBackgroundLayerId(currentLayerId);
- const mode = params.colorModeRef.current;
- const isPencil =
- !isEraser && !bs.customTipImage && (bs.preset?.startsWith('pencil') ?? false);
+ const currentTool = helpers.getTool();
+ const currentLayerId = params.activeLayerIdRef.current;
+ const isEraser = currentTool === 'eraser';
+ const isBgEraser = isEraser && isBackgroundLayerId(currentLayerId);
+ const mode = params.colorModeRef.current;
+ const isPencil =
+ !isEraser && !bs.customTipImage && (bs.preset?.startsWith('pencil') ?? false);
- const activeLayer = params.layersRef.current?.find((l) => l.id === currentLayerId);
- const isMonoLayer = activeLayer?.expressionColor === 'monochrome';
- const isMonochrome = mode === 'monochrome' || isMonoLayer;
- const strokeColor = helpers.resolveStrokeColor(bs, isEraser, isBgEraser, isMonochrome, mode);
+ const activeLayer = params.layersRef.current?.find((l) => l.id === currentLayerId);
+ const isMonoLayer = activeLayer?.expressionColor === 'monochrome';
+ const isMonochrome = mode === 'monochrome' || isMonoLayer;
+ const strokeColor = helpers.resolveStrokeColor(bs, isEraser, isBgEraser, isMonochrome, mode);
+
+ postCommitMeta = {
+ isEraser,
+ isTransparentInk: Boolean(bs.isTransparentInk),
+ strokeColor,
+ currentLayerId,
+ isMaskMode: params.isMaskModeRef.current,
+ };
const pipeline = state.strokePipeline;
const scatterFactor = Math.max(0, bs.dynamics?.scatter ?? 0);
@@ -471,53 +488,74 @@ export function runPointerUp(
}
state.currentStrokeId = null;
}
-
- state.strokePipeline.abortStroke();
- state.frameGpuDabs.length = 0;
- params.isDrawingRef.current = false;
- recoveryService.setDrawingActive(false);
- uiStoreActions.setIsDrawing(false);
- state.activePointerId = null;
- state.allStrokePoints = [];
- state.stabilizedPoint = null;
- state.hasLastProcessedPoint = false;
- state.dirtyRect = null;
- state.touchedTiles.clear();
- state.liveNeedsNotify = false;
- state.isShiftLineStroke = false;
- state.deferredInitialDot = false;
- state.deferredStartRawPressure = 0;
- state.layerPixelSampler = null;
- state.activeReservoir = null;
- state.isStrokePaperTextureActive = false;
- state.isDualBrushStroke = false;
- state.dualSecondaryRemainderDist = 0;
- state.dualSecondaryDabCounter.count = 0;
- state.dualSecondaryDabCounter.lastAngle = undefined;
- state.dualSecondaryDabCounter.lastStepDist = undefined;
- state.dualSecondaryRibbonSession = null;
- state.dualFrameSecondaryGpuDabs.length = 0;
- if (state.naturalPaintSession) {
- state.naturalPaintSession.finishAndDispose();
- state.naturalPaintSession = null;
+ } catch (err) {
+ console.error('Failed to finalize brush stroke:', err);
+ postCommitMeta = null;
+ const failedDraft = params.effectiveDraftCanvasRef?.current as
+ | DraftCanvasElement
+ | null
+ | undefined;
+ if (failedDraft) {
+ resetAndClearOffscreenDraftCanvas(failedDraft);
+ failedDraft.__draftHasContent = false;
+ failedDraft.__draftVersion = (failedDraft.__draftVersion || 0) + 1;
+ params.activeTileGridRef.current?.notifyChange(true);
+ }
+ } finally {
+ if (state.drawRafId !== null) {
+ cancelAnimationFrame(state.drawRafId);
+ state.drawRafId = null;
+ }
+ state.currentStrokeId = null;
+ state.strokePipeline.abortStroke();
+ state.frameGpuDabs.length = 0;
+ params.isDrawingRef.current = false;
+ recoveryService.setDrawingActive(false);
+ uiStoreActions.setIsDrawing(false);
+ state.activePointerId = null;
+ state.allStrokePoints = [];
+ state.stabilizedPoint = null;
+ state.hasLastProcessedPoint = false;
+ state.dirtyRect = null;
+ state.touchedTiles.clear();
+ state.liveNeedsNotify = false;
+ state.isShiftLineStroke = false;
+ state.deferredInitialDot = false;
+ state.deferredStartRawPressure = 0;
+ state.layerPixelSampler = null;
+ state.activeReservoir = null;
+ state.isStrokePaperTextureActive = false;
+ state.isDualBrushStroke = false;
+ state.dualSecondaryRemainderDist = 0;
+ state.dualSecondaryDabCounter.count = 0;
+ state.dualSecondaryDabCounter.lastAngle = undefined;
+ state.dualSecondaryDabCounter.lastStepDist = undefined;
+ state.dualSecondaryRibbonSession = null;
+ state.dualFrameSecondaryGpuDabs.length = 0;
+ if (state.naturalPaintSession) {
+ state.naturalPaintSession.finishAndDispose();
+ state.naturalPaintSession = null;
+ }
+ state.ribbonSession = null;
+ state.snapSession.endStroke();
+ state.straightSnapSession.endStroke();
+ cleanupQuickShapeState(state, params);
+ helpers.emitConstraintAxisChange(null);
}
- state.ribbonSession = null;
- state.snapSession.endStroke();
- state.straightSnapSession.endStroke();
- cleanupQuickShapeState(state, params);
- helpers.emitConstraintAxisChange(null);
- if (!isEraser && !bs.isTransparentInk && !params.isMaskModeRef.current) {
- toolStoreActions.addRecentColor(strokeColor);
+ if (!postCommitMeta) return;
+
+ if (!postCommitMeta.isEraser && !postCommitMeta.isTransparentInk && !postCommitMeta.isMaskMode) {
+ toolStoreActions.addRecentColor(postCommitMeta.strokeColor);
}
- if (params.isMaskModeRef.current) {
+ if (postCommitMeta.isMaskMode) {
// commitMaskModeStroke already bumped maskVersion and grid.notifyChange(true) already presented it;
// avoid double-bumping maskVersion which triggered a redundant second full-canvas mask upload!
- params.onUpdateMaskThumbnailRef.current?.(currentLayerId, false, true);
+ params.onUpdateMaskThumbnailRef.current?.(postCommitMeta.currentLayerId, false, true);
} else {
// onUpdateLayerThumbnail is already debounced (900ms for >1MP canvases); invoke directly so
// flushPendingHistoryTasks() on rapid next pointerDown never blocks touchdown with thumbnail work!
- params.onUpdateLayerThumbnail(currentLayerId);
+ params.onUpdateLayerThumbnail(postCommitMeta.currentLayerId);
}
}
diff --git a/src/hooks/drawing/brushStrokeSession/strokeHelpers.ts b/src/hooks/drawing/brushStrokeSession/strokeHelpers.ts
index 60ba835..3fddbe9 100644
--- a/src/hooks/drawing/brushStrokeSession/strokeHelpers.ts
+++ b/src/hooks/drawing/brushStrokeSession/strokeHelpers.ts
@@ -203,11 +203,18 @@ export function abortActiveStrokeSession(
if (hadQuickShape) {
params.onQuickShapePreviewChangeRef?.current?.(null);
}
- if (!params.isDrawingRef.current) return;
if (state.drawRafId !== null) {
cancelAnimationFrame(state.drawRafId);
state.drawRafId = null;
}
+ if (state.clearDraftRaf !== null) {
+ cancelAnimationFrame(state.clearDraftRaf);
+ state.clearDraftRaf = null;
+ }
+ if (!params.isDrawingRef.current) {
+ state.activePointerId = null;
+ return;
+ }
const draftCanvas = params.effectiveDraftCanvasRef?.current as
| DraftCanvasElement
| null
diff --git a/src/hooks/drawing/types.ts b/src/hooks/drawing/types.ts
index 21f1d23..8c9e5fb 100644
--- a/src/hooks/drawing/types.ts
+++ b/src/hooks/drawing/types.ts
@@ -9,6 +9,7 @@ import {
HistoryActionType,
CanvasColorMode,
DirtyRect,
+ DocumentStateDelta,
LayerItem,
LayerTreeDelta,
TileDelta,
@@ -59,6 +60,11 @@ export type ApplyLayerTreeDeltaFn = (
addedLayers: LayerItem[];
};
+export type ApplyDocumentStateDeltaFn = (
+ delta: DocumentStateDelta,
+ direction: 'undo' | 'redo'
+) => void;
+
export type PushHistoryStepFn = (
actionType: HistoryActionType,
label: string,
@@ -71,7 +77,8 @@ export type PushHistoryStepFn = (
peerId?: string | number,
strokeId?: string,
isMaskEdit?: boolean,
- layerTreeDelta?: LayerTreeDelta
+ layerTreeDelta?: LayerTreeDelta,
+ documentStateDelta?: DocumentStateDelta
) => void;
export interface UseCanvasDrawingProps {
@@ -94,6 +101,7 @@ export interface UseCanvasDrawingProps {
layers?: LayerItem[];
onUpdateLayerThumbnail: (layerId: string, immediate?: boolean) => void;
onApplyLayerTreeDelta?: ApplyLayerTreeDeltaFn;
+ onApplyDocumentStateDelta?: ApplyDocumentStateDeltaFn;
isMaskMode?: boolean;
onUpdateMaskThumbnail?: (
layerId: string,
@@ -136,6 +144,9 @@ export function applySelectionCanvasClip(
): void {
if (!sel) return;
if (sel.type === 'rect') {
+ if (!Number.isFinite(sel.bounds.width) || !Number.isFinite(sel.bounds.height) || sel.bounds.width <= 0 || sel.bounds.height <= 0) {
+ return;
+ }
ctx.beginPath();
ctx.rect(sel.bounds.x, sel.bounds.y, sel.bounds.width, sel.bounds.height);
ctx.clip();
diff --git a/src/hooks/drawing/useBrushStrokeSession.ts b/src/hooks/drawing/useBrushStrokeSession.ts
index dc749c9..1ca589d 100644
--- a/src/hooks/drawing/useBrushStrokeSession.ts
+++ b/src/hooks/drawing/useBrushStrokeSession.ts
@@ -14,6 +14,7 @@ import { useToolStore, toolStoreActions, uiStoreActions } from '../../stores';
import { recoveryService } from '../../services/recoveryService';
import { isNativeRustAvailable } from '../../utils/nativeBackend';
import {
+ clearNativePenContact,
startNativeTablet,
subscribeNativeTablet,
} from '../../utils/nativeTabletInput';
@@ -161,33 +162,8 @@ export function useBrushStrokeSession(
window.removeEventListener('resize', handleResize);
window.removeEventListener('scroll', handleResize, true);
ro?.disconnect();
- const state = sessionStateRef.current!;
- if (state.clearDraftRaf !== null) {
- cancelAnimationFrame(state.clearDraftRaf);
- }
- if (state.drawRafId !== null) {
- cancelAnimationFrame(state.drawRafId);
- }
- if (state.quickShapeHoldTimer !== null) {
- clearTimeout(state.quickShapeHoldTimer);
- state.quickShapeHoldTimer = null;
- }
- if (state.quickShapeRafId !== null) {
- cancelAnimationFrame(state.quickShapeRafId);
- state.quickShapeRafId = null;
- }
- if (state.quickShapeKeyCleanup) {
- state.quickShapeKeyCleanup();
- state.quickShapeKeyCleanup = null;
- }
- if (state.quickShapeSession) {
- state.quickShapeSession = null;
- paramsRef.current.onQuickShapePreviewChangeRef?.current?.(null);
- }
- recoveryService.setDrawingActive(false);
- uiStoreActions.setIsDrawing(false);
};
- }, [viewportRef, disabled, activeSessionId]);
+ }, [viewportRef]);
const dispatchPointerStat = useCallback(
(x: number | null, y: number | null, pressure: number) => {
@@ -200,6 +176,7 @@ export function useBrushStrokeSession(
nativeStrokeActive: false,
prevToolBeforeEraserFlip: null,
contactBlockedUntilPenUp: false,
+ lastActiveSampleTimestamp: undefined,
});
const abortActiveStroke = useCallback(() => {
@@ -217,6 +194,8 @@ export function useBrushStrokeSession(
);
const bridge = nativeBridgeStateRef.current;
bridge.nativeStrokeActive = false;
+ bridge.contactBlockedUntilPenUp = false;
+ bridge.lastActiveSampleTimestamp = undefined;
if (bridge.prevToolBeforeEraserFlip !== null) {
const prev = bridge.prevToolBeforeEraserFlip;
bridge.prevToolBeforeEraserFlip = null;
@@ -232,6 +211,49 @@ export function useBrushStrokeSession(
onQuickShapePreviewChangeRef,
]);
+ // Abort any in-progress stroke cleanly when drawing becomes disabled (e.g. Space/pan/rotate/zoom),
+ // rather than cancelling RAF IDs without nulling them or leaving isDrawingRef stuck true.
+ useEffect(() => {
+ if (disabled) {
+ abortActiveStroke();
+ }
+ }, [disabled, abortActiveStroke]);
+
+ // Clean up stroke & deferred draft RAFs on document/session switch or unmount.
+ useEffect(() => {
+ return () => {
+ abortActiveStroke();
+ const state = sessionStateRef.current!;
+ if (state.statRaf !== null) {
+ cancelAnimationFrame(state.statRaf);
+ state.statRaf = null;
+ }
+ recoveryService.setDrawingActive(false);
+ uiStoreActions.setIsDrawing(false);
+ };
+ }, [activeSessionId, abortActiveStroke]);
+
+ // Self-heal if window loses focus or tab becomes hidden mid-stroke (missed OS pointerup/pen-up).
+ useEffect(() => {
+ const handleFocusLoss = () => {
+ if (isDrawingRef.current || nativeBridgeStateRef.current.nativeStrokeActive) {
+ abortActiveStroke();
+ clearNativePenContact();
+ }
+ };
+ const handleVisibilityChange = () => {
+ if (typeof document !== 'undefined' && document.hidden) {
+ handleFocusLoss();
+ }
+ };
+ window.addEventListener('blur', handleFocusLoss);
+ document.addEventListener('visibilitychange', handleVisibilityChange);
+ return () => {
+ window.removeEventListener('blur', handleFocusLoss);
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
+ };
+ }, [abortActiveStroke, isDrawingRef]);
+
const getCanvasPoint = useCallback(
(e: React.PointerEvent<HTMLElement> | PointerEvent): Point =>
computeCanvasPoint(
@@ -440,6 +462,7 @@ export function useBrushStrokeSession(
bridgeState.nativeStrokeActive = false;
bridgeState.prevToolBeforeEraserFlip = null;
bridgeState.contactBlockedUntilPenUp = false;
+ bridgeState.lastActiveSampleTimestamp = undefined;
const modKeys = { shift: false, alt: false };
const onKeyDown = (ev: KeyboardEvent) => {
diff --git a/src/hooks/drawing/useDrawingHistory.ts b/src/hooks/drawing/useDrawingHistory.ts
index 92fe5e1..510eb07 100644
--- a/src/hooks/drawing/useDrawingHistory.ts
+++ b/src/hooks/drawing/useDrawingHistory.ts
@@ -3,6 +3,7 @@ import {
CanvasDimensions,
CanvasColorMode,
DirtyRect,
+ DocumentStateDelta,
HistoryActionType,
HistoryItem,
HistoryItemMeta,
@@ -31,11 +32,13 @@ import {
markVectorStrokeDeleted,
} from '../../utils/collabUndoUtils';
import {
+ ApplyDocumentStateDeltaFn,
ApplyLayerTreeDeltaFn,
isBackgroundLayerId,
LastStrokeEndState,
PushHistoryStepFn,
} from './types';
+import { t } from '../../i18n';
function rerenderVectorStrokesToGrid(
targetLayerId: string,
@@ -104,6 +107,7 @@ export interface UseDrawingHistoryParams {
layersRef: React.MutableRefObject<LayerItem[] | undefined>;
onUpdateLayerThumbnail: (layerId: string, immediate?: boolean) => void;
onApplyLayerTreeDeltaRef?: React.MutableRefObject<ApplyLayerTreeDeltaFn | undefined>;
+ onApplyDocumentStateDeltaRef?: React.MutableRefObject<ApplyDocumentStateDeltaFn | undefined>;
onUpdateMaskThumbnailRef: React.MutableRefObject<((layerId: string) => void) | undefined>;
isDrawingRef: React.MutableRefObject<boolean>;
lastStrokeEndRef: React.MutableRefObject<LastStrokeEndState | null>;
@@ -157,6 +161,7 @@ export function useDrawingHistory({
layersRef,
onUpdateLayerThumbnail,
onApplyLayerTreeDeltaRef,
+ onApplyDocumentStateDeltaRef,
onUpdateMaskThumbnailRef,
isDrawingRef,
lastStrokeEndRef,
@@ -280,7 +285,7 @@ export function useDrawingHistory({
const initialItem: HistoryItem = {
id: `hist-init-${now}`,
type: 'initial',
- label: 'New Document',
+ label: t('New Document'),
timestamp: now,
timeFormatted: formatTime(now),
thumbnailUrl: initialThumb,
@@ -310,7 +315,8 @@ export function useDrawingHistory({
peerId?: string | number,
strokeId?: string,
isMaskEdit?: boolean,
- layerTreeDelta?: LayerTreeDelta
+ layerTreeDelta?: LayerTreeDelta,
+ documentStateDelta?: DocumentStateDelta
) => {
ensureInitialHistory();
const now = Date.now();
@@ -406,6 +412,49 @@ export function useDrawingHistory({
}
}
+ // Coalesce rapid continuous document state edits (e.g. ruler handle drag, animation FPS/settings)
+ if (
+ !hasDeltas &&
+ !layerTreeDelta &&
+ documentStateDelta?.coalesceKey &&
+ historyIndexRef.current >= 0 &&
+ historyIndexRef.current === historyRef.current.length - 1
+ ) {
+ const topItem = historyRef.current[historyIndexRef.current];
+ if (
+ topItem &&
+ !topItem.tileDeltas &&
+ !topItem.layerTreeDelta &&
+ topItem.documentStateDelta?.coalesceKey === documentStateDelta.coalesceKey &&
+ now - topItem.timestamp <= 800
+ ) {
+ topItem.label = label;
+ topItem.timestamp = now;
+ topItem.timeFormatted = formatTime(now);
+ topItem.documentStateDelta = {
+ ...topItem.documentStateDelta,
+ ...(documentStateDelta.afterDimensions !== undefined
+ ? { afterDimensions: documentStateDelta.afterDimensions }
+ : {}),
+ ...(documentStateDelta.afterPerspectiveRuler !== undefined
+ ? { afterPerspectiveRuler: documentStateDelta.afterPerspectiveRuler }
+ : {}),
+ ...(documentStateDelta.afterStraightRuler !== undefined
+ ? { afterStraightRuler: documentStateDelta.afterStraightRuler }
+ : {}),
+ ...(documentStateDelta.afterAnimationTimeline !== undefined
+ ? { afterAnimationTimeline: documentStateDelta.afterAnimationTimeline }
+ : {}),
+ ...(documentStateDelta.afterSelection !== undefined
+ ? { afterSelection: documentStateDelta.afterSelection }
+ : {}),
+ };
+ persistSessionHistory(docId);
+ syncHistoryState();
+ return;
+ }
+ }
+
let tileRemoteEpochs: Record<string, number> | undefined;
if (hasDeltas && tileDeltas) {
tileRemoteEpochs = {};
@@ -431,6 +480,7 @@ export function useDrawingHistory({
tileRemoteEpochs,
vectorStrokesDelta: vectorDelta,
layerTreeDelta,
+ documentStateDelta,
peerId,
strokeId,
isMaskEdit,
@@ -466,13 +516,13 @@ export function useDrawingHistory({
pendingTargetIndexRef.current = null;
persistSessionHistory(docId);
- if (dims.width > 0 && dims.height > 0) {
+ if (targetLayerId && dims.width > 0 && dims.height > 0) {
const isLarge = dims.width * dims.height > 1024 * 1024;
if (isLarge && hasDeltas) {
const existingLayerThumb =
layersRef.current?.find((l) => l.id === targetLayerId)?.thumbnailUrl || '';
item.thumbnailUrl = existingLayerThumb;
- } else {
+ } else if (!documentStateDelta || hasDeltas || layerTreeDelta) {
item.thumbnailUrl = createCanvasThumbnail(
{ grid, layerId: targetLayerId, dimensions: dims },
!isBackgroundLayerId(targetLayerId)
@@ -592,6 +642,19 @@ export function useDrawingHistory({
grid: SparseTileGrid,
dims: CanvasDimensions
) => {
+ let effectiveDims = dims;
+ if (item.documentStateDelta) {
+ const targetDims =
+ direction === 'undo'
+ ? item.documentStateDelta.beforeDimensions
+ : item.documentStateDelta.afterDimensions;
+ if (targetDims) {
+ effectiveDims = targetDims;
+ dimensionsRef.current = targetDims;
+ }
+ onApplyDocumentStateDeltaRef?.current?.(item.documentStateDelta, direction);
+ }
+
const targetLayerId = item.layerId || activeLayerId;
const targetLayer = layersRef.current?.find((l) => l.id === targetLayerId);
const dataToApply =
@@ -658,7 +721,13 @@ export function useDrawingHistory({
targetLayer.vectorStrokes =
direction === 'undo' ? item.vectorStrokesDelta.before : item.vectorStrokesDelta.after;
const isMono = targetLayer.expressionColor === 'monochrome';
- rerenderVectorStrokesToGrid(targetLayerId, targetLayer.vectorStrokes, isMono, dims, grid);
+ rerenderVectorStrokesToGrid(
+ targetLayerId,
+ targetLayer.vectorStrokes,
+ isMono,
+ effectiveDims,
+ grid
+ );
if (multiplayerService.isConnected()) {
multiplayerService.sendLayerUpdate(targetLayerId, {
vectorStrokes: targetLayer.vectorStrokes,
@@ -711,16 +780,32 @@ export function useDrawingHistory({
grid.writeImageData(targetLayerId, dataToApply, ax, ay, targetFormat);
} else if (item.type === 'initial') {
if (isBackgroundLayerId(targetLayerId)) {
- grid.fillLayerSolidWhite(targetLayerId, dims.width, dims.height, 'color-32bit');
+ grid.fillLayerSolidWhite(
+ targetLayerId,
+ effectiveDims.width,
+ effectiveDims.height,
+ 'color-32bit'
+ );
} else {
grid.clearLayer(targetLayerId);
}
}
}
+ const hasVisualLayerChange = Boolean(
+ item.layerTreeDelta ||
+ item.isMaskEdit ||
+ item.vectorStrokesDelta ||
+ (deltas && deltas.length > 0) ||
+ dataToApply ||
+ item.type === 'initial'
+ );
+
if (
- !item.layerTreeDelta ||
- (layersRef.current ?? []).some((l) => l.id === targetLayerId)
+ hasVisualLayerChange &&
+ targetLayerId &&
+ (!item.layerTreeDelta ||
+ (layersRef.current ?? []).some((l) => l.id === targetLayerId))
) {
onUpdateLayerThumbnail(targetLayerId, true);
}
@@ -729,7 +814,9 @@ export function useDrawingHistory({
activeLayerId,
activeLayerIdRef,
colorModeRef,
+ dimensionsRef,
layersRef,
+ onApplyDocumentStateDeltaRef,
onApplyLayerTreeDeltaRef,
onUpdateLayerThumbnail,
onUpdateMaskThumbnailRef,
@@ -777,13 +864,12 @@ export function useDrawingHistory({
if (canRunSync) {
const grid = activeTileGridRef.current;
- const dims = dimensionsRef.current;
if (targetIndex < currentIndex) {
for (let i = currentIndex; i > targetIndex; i--) {
const item = historyRef.current[i];
if (item) {
const deltas = undoCache.resolveDeltasSync(item);
- applySingleHistoryStep(item, deltas, 'undo', grid, dims);
+ applySingleHistoryStep(item, deltas, 'undo', grid, dimensionsRef.current);
}
}
} else {
@@ -791,7 +877,7 @@ export function useDrawingHistory({
const item = historyRef.current[i];
if (item) {
const deltas = undoCache.resolveDeltasSync(item);
- applySingleHistoryStep(item, deltas, 'redo', grid, dims);
+ applySingleHistoryStep(item, deltas, 'redo', grid, dimensionsRef.current);
}
}
}
@@ -813,14 +899,13 @@ export function useDrawingHistory({
const grid = activeTileGridRef.current;
const undoCache = activeUndoCacheRef.current;
- const dims = dimensionsRef.current;
if (targetIndex < currentIndex) {
for (let i = currentIndex; i > targetIndex; i--) {
const item = historyRef.current[i];
if (item) {
const deltas = await undoCache.resolveDeltas(item);
- applySingleHistoryStep(item, deltas, 'undo', grid, dims);
+ applySingleHistoryStep(item, deltas, 'undo', grid, dimensionsRef.current);
}
}
} else {
@@ -828,7 +913,7 @@ export function useDrawingHistory({
const item = historyRef.current[i];
if (item) {
const deltas = await undoCache.resolveDeltas(item);
- applySingleHistoryStep(item, deltas, 'redo', grid, dims);
+ applySingleHistoryStep(item, deltas, 'redo', grid, dimensionsRef.current);
}
}
}
@@ -973,7 +1058,7 @@ export function useDrawingHistory({
strokeId: item.strokeId,
layerId: targetLayerId,
syncedRemotely: true,
- conflictNotice: perm.reason || 'Layer is locked by its owner',
+ conflictNotice: perm.reason || t('Layer is locked by its owner'),
};
return;
}
@@ -986,6 +1071,15 @@ export function useDrawingHistory({
let preservedPeerEdits = false;
let conflictNotice: string | undefined;
+ let effectiveDims = dims;
+ if (item.documentStateDelta) {
+ if (item.documentStateDelta.beforeDimensions) {
+ effectiveDims = item.documentStateDelta.beforeDimensions;
+ dimensionsRef.current = effectiveDims;
+ }
+ onApplyDocumentStateDeltaRef?.current?.(item.documentStateDelta, 'undo');
+ }
+
if (item.layerTreeDelta) {
const resolvedDeltas = await undoCache.resolveDeltas(item);
const applied = onApplyLayerTreeDeltaRef?.current?.(item.layerTreeDelta, 'undo');
@@ -1043,7 +1137,13 @@ export function useDrawingHistory({
);
targetLayer.vectorStrokes = vecRes.nextStrokes;
const isMono = targetLayer.expressionColor === 'monochrome';
- rerenderVectorStrokesToGrid(targetLayerId, targetLayer.vectorStrokes, isMono, dims, grid);
+ rerenderVectorStrokesToGrid(
+ targetLayerId,
+ targetLayer.vectorStrokes,
+ isMono,
+ effectiveDims,
+ grid
+ );
if (isLocalUndo && multiplayerService.isConnected()) {
if (vecRes.broadcastMode === 'selective-undo' && vecRes.selectiveUndoStrokeId) {
multiplayerService.sendSelectiveUndo(vecRes.selectiveUndoStrokeId);
@@ -1115,9 +1215,19 @@ export function useDrawingHistory({
persistSessionHistory();
syncHistoryState();
+ const hasVisualLayerChange = Boolean(
+ item.layerTreeDelta ||
+ item.isMaskEdit ||
+ item.vectorStrokesDelta ||
+ (appliedDeltas && appliedDeltas.length > 0) ||
+ item.beforeImageData
+ );
+
if (
- !item.layerTreeDelta ||
- (layersRef.current ?? []).some((l) => l.id === targetLayerId)
+ hasVisualLayerChange &&
+ targetLayerId &&
+ (!item.layerTreeDelta ||
+ (layersRef.current ?? []).some((l) => l.id === targetLayerId))
) {
onUpdateLayerThumbnail(targetLayerId);
}
@@ -1149,6 +1259,7 @@ export function useDrawingHistory({
isDrawingRef,
lastStrokeEndRef,
layersRef,
+ onApplyDocumentStateDeltaRef,
onApplyLayerTreeDeltaRef,
onUpdateLayerThumbnail,
onUpdateMaskThumbnailRef,
@@ -1227,7 +1338,7 @@ export function useDrawingHistory({
strokeId: targetItem.strokeId,
layerId: targetLayerId,
syncedRemotely: true,
- conflictNotice: perm.reason || 'Layer is locked by its owner',
+ conflictNotice: perm.reason || t('Layer is locked by its owner'),
};
return;
}
@@ -1240,6 +1351,15 @@ export function useDrawingHistory({
let preservedPeerEdits = false;
let conflictNotice: string | undefined;
+ let effectiveDims = dims;
+ if (targetItem.documentStateDelta) {
+ if (targetItem.documentStateDelta.afterDimensions) {
+ effectiveDims = targetItem.documentStateDelta.afterDimensions;
+ dimensionsRef.current = effectiveDims;
+ }
+ onApplyDocumentStateDeltaRef?.current?.(targetItem.documentStateDelta, 'redo');
+ }
+
if (targetItem.layerTreeDelta) {
const resolvedDeltas = await undoCache.resolveDeltas(targetItem);
const applied = onApplyLayerTreeDeltaRef?.current?.(targetItem.layerTreeDelta, 'redo');
@@ -1298,7 +1418,13 @@ export function useDrawingHistory({
);
targetLayer.vectorStrokes = vecRes.nextStrokes;
const isMono = targetLayer.expressionColor === 'monochrome';
- rerenderVectorStrokesToGrid(targetLayerId, targetLayer.vectorStrokes, isMono, dims, grid);
+ rerenderVectorStrokesToGrid(
+ targetLayerId,
+ targetLayer.vectorStrokes,
+ isMono,
+ effectiveDims,
+ grid
+ );
if (isLocalRedo && multiplayerService.isConnected()) {
if (vecRes.broadcastMode === 'layer-update') {
multiplayerService.sendLayerUpdate(targetLayerId, {
@@ -1367,9 +1493,20 @@ export function useDrawingHistory({
persistSessionHistory();
syncHistoryState();
+ const hasVisualLayerChange = Boolean(
+ targetItem.layerTreeDelta ||
+ targetItem.isMaskEdit ||
+ targetItem.vectorStrokesDelta ||
+ (appliedDeltas && appliedDeltas.length > 0) ||
+ targetItem.afterImageData ||
+ targetItem.imageData
+ );
+
if (
- !targetItem.layerTreeDelta ||
- (layersRef.current ?? []).some((l) => l.id === targetLayerId)
+ hasVisualLayerChange &&
+ targetLayerId &&
+ (!targetItem.layerTreeDelta ||
+ (layersRef.current ?? []).some((l) => l.id === targetLayerId))
) {
onUpdateLayerThumbnail(targetLayerId);
}
@@ -1401,6 +1538,7 @@ export function useDrawingHistory({
isDrawingRef,
lastStrokeEndRef,
layersRef,
+ onApplyDocumentStateDeltaRef,
onApplyLayerTreeDeltaRef,
onUpdateLayerThumbnail,
onUpdateMaskThumbnailRef,
@@ -1475,7 +1613,7 @@ export function useDrawingHistory({
onUpdateLayerThumbnail(activeLayerId);
pushHistoryStep(
'clear',
- 'Clear Layer',
+ t('Clear Layer'),
null,
null,
activeLayerId,
@@ -1532,7 +1670,7 @@ export function useDrawingHistory({
const initialItem: HistoryItem = {
id: `hist-init-${now}`,
type: 'initial',
- label: 'New Document',
+ label: t('New Document'),
timestamp: now,
timeFormatted: formatTime(now),
thumbnailUrl: thumbnail,
diff --git a/src/hooks/drawing/useGradientTool.ts b/src/hooks/drawing/useGradientTool.ts
index 5aa06e6..4cfd5cf 100644
--- a/src/hooks/drawing/useGradientTool.ts
+++ b/src/hooks/drawing/useGradientTool.ts
@@ -24,6 +24,7 @@ import { documentStore } from '../../utils/documentStore';
import { TileFormat } from '../../utils/tileEngine';
import { multiplayerService } from '../../services/multiplayerService';
import { interactiveToolBridge, toolStoreActions, useToolStore } from '../../stores';
+import { t } from '../../i18n';
import type { PushHistoryStepFn } from './types';
export interface GradientMeshMarqueeRect {
@@ -131,7 +132,7 @@ export function useGradientTool({
activeLayer.locked ||
!isLayerEffectivelyVisible(activeLayer)
) {
- showToast?.('Select an unlocked, visible raster layer to apply gradients');
+ showToast?.(t('Select an unlocked, visible raster layer to apply gradients'));
return false;
}
return true;
@@ -190,7 +191,7 @@ export function useGradientTool({
if (res.modified && res.tileDeltas.length > 0) {
pushHistoryStep(
'gradient',
- 'Mesh Gradient',
+ t('Mesh Gradient'),
null,
null,
activeLayerId,
@@ -611,7 +612,7 @@ export function useGradientTool({
if (res.modified && res.tileDeltas.length > 0) {
pushHistoryStep(
'gradient',
- dragType === 'radial' ? 'Radial Gradient' : 'Linear Gradient',
+ dragType === 'radial' ? t('Radial Gradient') : t('Linear Gradient'),
null,
null,
activeLayerId,
diff --git a/src/hooks/drawing/usePenTool.ts b/src/hooks/drawing/usePenTool.ts
index 3beed09..6023c17 100644
--- a/src/hooks/drawing/usePenTool.ts
+++ b/src/hooks/drawing/usePenTool.ts
@@ -24,6 +24,7 @@ import { TileFormat, TileSnapshotEntry, releaseTemporaryCanvas } from '../../uti
import { get2DContext } from '../../utils/canvasUtils';
import { multiplayerService } from '../../services/multiplayerService';
import { interactiveToolBridge, toolStoreActions, useToolStore } from '../../stores';
+import { t } from '../../i18n';
import type { PushHistoryStepFn } from './types';
export interface UsePenToolParams {
@@ -149,7 +150,7 @@ export function usePenTool({
activeLayer.locked ||
!isLayerEffectivelyVisible(activeLayer)
) {
- showToast?.('Select an unlocked, visible Raster or Vector layer to commit Bézier path');
+ showToast?.(t('Select an unlocked, visible Raster or Vector layer to commit Bézier path'));
return;
}
@@ -164,7 +165,7 @@ export function usePenTool({
);
if (strokeColor === 'none' && !fillColor) {
- showToast?.('Enable Stroke or Fill (closed path) before committing');
+ showToast?.(t('Enable Stroke or Fill (closed path) before committing'));
return;
}
@@ -250,7 +251,7 @@ export function usePenTool({
pushHistoryStep(
'pen',
- existingIdx >= 0 ? 'Edit Bézier Path' : 'Bézier Pen Path',
+ existingIdx >= 0 ? t('Edit Bézier Path') : t('Bézier Pen Path'),
null,
null,
activeLayerId,
@@ -342,7 +343,7 @@ export function usePenTool({
if (tileDeltas.length > 0) {
pushHistoryStep(
'pen',
- 'Bézier Pen Path',
+ t('Bézier Pen Path'),
null,
null,
activeLayerId,
@@ -454,7 +455,7 @@ export function usePenTool({
activeLayer.locked ||
!isLayerEffectivelyVisible(activeLayer)
) {
- showToast?.('Select an unlocked, visible Raster or Vector layer to use the Pen Tool');
+ showToast?.(t('Select an unlocked, visible Raster or Vector layer to use the Pen Tool'));
return true;
}
@@ -560,10 +561,10 @@ export function usePenTool({
selectedAnchorIndex: 0,
hoverPoint: pt,
});
- showToast?.('Loaded vector path for Bézier editing');
+ showToast?.(t('Loaded vector path for Bézier editing'));
return true;
}
- showToast?.('Click a vector path to edit, or switch to Draw mode to plot a new Bézier path');
+ showToast?.(t('Click a vector path to edit, or switch to Draw mode to plot a new Bézier path'));
return true;
}
diff --git a/src/hooks/drawing/useRetouchTool.ts b/src/hooks/drawing/useRetouchTool.ts
index 651c07d..0bb1b7c 100644
--- a/src/hooks/drawing/useRetouchTool.ts
+++ b/src/hooks/drawing/useRetouchTool.ts
@@ -17,6 +17,7 @@ import { documentStore } from '../../utils/documentStore';
import { TileFormat } from '../../utils/tileEngine';
import { multiplayerService } from '../../services/multiplayerService';
import { toolStoreActions, useToolStore } from '../../stores';
+import { t } from '../../i18n';
import type { PushHistoryStepFn } from './types';
export interface CloneSourceIndicator {
@@ -121,7 +122,7 @@ export function useRetouchTool({
setLiveSamplePos(null);
alignedOffsetRef.current = null;
setIsPickingCloneSource(false);
- showToast?.(`Clone source set (${Math.round(pt.x)}, ${Math.round(pt.y)})`);
+ showToast?.(t('Clone source set ({x}, {y})', { x: Math.round(pt.x), y: Math.round(pt.y) }));
return true;
}
@@ -131,7 +132,7 @@ export function useRetouchTool({
activeLayer.locked ||
!isLayerEffectivelyVisible(activeLayer)
) {
- showToast?.('Select an unlocked, visible raster layer to use Retouch tools');
+ showToast?.(t('Select an unlocked, visible raster layer to use Retouch tools'));
return true;
}
@@ -139,7 +140,7 @@ export function useRetouchTool({
if (retouchSettings.mode === 'clone-stamp') {
const anchor = cloneAnchorRef.current;
if (!anchor) {
- showToast?.('Alt+Click on canvas (or click Pick Source) to set Clone Stamp origin');
+ showToast?.(t('Alt+Click on canvas (or click Pick Source) to set Clone Stamp origin'));
return true;
}
if (retouchSettings.cloneAligned && alignedOffsetRef.current) {
@@ -275,7 +276,7 @@ export function useRetouchTool({
if (tileDeltas.length > 0) {
pushHistoryStep(
'retouch',
- MODE_LABELS[session.mode] || 'Retouch',
+ t(MODE_LABELS[session.mode] || 'Retouch'),
null,
null,
session.layerId,
diff --git a/src/hooks/drawing/useSelectionTools.ts b/src/hooks/drawing/useSelectionTools.ts
index 629fbd8..6eb8d35 100644
--- a/src/hooks/drawing/useSelectionTools.ts
+++ b/src/hooks/drawing/useSelectionTools.ts
@@ -35,6 +35,8 @@ import {
selectionToMask,
maskToBounds,
maskToSvgPath,
+ cloneSelectionForHistory,
+ areSelectionsEqualForHistory,
SelectionTileSnapshot,
} from '../../utils/selectionUtils';
import {
@@ -71,6 +73,7 @@ import {
} from '../../utils/cageWarpEngine';
import { get2DContext, getCanvasCompositeOperation } from '../../utils/canvasUtils';
import { useToolStore, toolStoreActions } from '../../stores';
+import { t } from '../../i18n';
import { PushHistoryStepFn } from './types';
function computeTransformDestRect(
@@ -540,8 +543,9 @@ export interface UseSelectionToolsResult {
transformSession: TransformSession | null;
setTransformSession: React.Dispatch<React.SetStateAction<TransformSession | null>>;
isSelectionPenDrawingRef: React.MutableRefObject<boolean>;
+ restoreSelectionFromHistory: (sel: CanvasSelection | null) => void;
handleCommitFloatingSelection: () => void;
- handleDeselect: () => void;
+ handleDeselect: (recordHistory?: boolean | unknown) => void;
handleClearSelection: () => void;
handleDeleteOutsideSelection: () => void;
handleCopySelection: () => void;
@@ -623,6 +627,48 @@ export function useSelectionTools({
const selectRectStartRef = useRef<{ x: number; y: number } | null>(null);
const lassoPointsRef = useRef<Array<{ x: number; y: number }>>([]);
+ const selectionBeforeGestureRef = useRef<CanvasSelection | null>(null);
+
+ const recordSelectionHistory = useCallback(
+ (label: string, beforeSel: CanvasSelection | null, afterSel: CanvasSelection | null) => {
+ const clonedBefore = cloneSelectionForHistory(beforeSel);
+ const clonedAfter = cloneSelectionForHistory(afterSel);
+ if (areSelectionsEqualForHistory(clonedBefore, clonedAfter)) return;
+ pushHistoryStep(
+ 'selection',
+ label,
+ null,
+ null,
+ activeLayerId || '',
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeSelection: clonedBefore,
+ afterSelection: clonedAfter,
+ }
+ );
+ },
+ [activeLayerId, pushHistoryStep]
+ );
+
+ const restoreSelectionFromHistory = useCallback((sel: CanvasSelection | null) => {
+ selectRectStartRef.current = null;
+ lassoPointsRef.current = [];
+ selectionDragRef.current = null;
+ selectionPenDrawingRef.current = null;
+ isSelectionPenDrawingRef.current = false;
+ setSelection((prev) => {
+ if (prev?.floating?.canvas) {
+ releaseTemporaryCanvas(prev.floating.canvas);
+ }
+ return cloneSelectionForHistory(sel);
+ });
+ }, []);
const handleCommitFloatingSelection = useCallback(() => {
if (!selection?.floating) return;
@@ -643,7 +689,7 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'selection-move',
- 'Move Selection',
+ t('Move Selection'),
null,
null,
targetLayerId,
@@ -664,17 +710,25 @@ export function useSelectionTools({
updateLayerThumbnail,
]);
- const handleDeselect = useCallback(() => {
- if (selection?.floating) {
- handleCommitFloatingSelection();
- }
- setSelection(null);
- }, [selection, handleCommitFloatingSelection]);
+ const handleDeselect = useCallback(
+ (recordHistory?: boolean | unknown) => {
+ const shouldRecord = recordHistory !== false;
+ const beforeSel = cloneSelectionForHistory(selection);
+ if (selection?.floating) {
+ handleCommitFloatingSelection();
+ }
+ setSelection(null);
+ if (shouldRecord && beforeSel) {
+ recordSelectionHistory(t('Deselect'), beforeSel, null);
+ }
+ },
+ [selection, handleCommitFloatingSelection, recordSelectionHistory]
+ );
const handleClearSelection = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster' || activeLayer.locked) {
- showToast('Select an unlocked raster layer');
+ showToast(t('Select an unlocked raster layer'));
return;
}
flushPendingHistoryTasks?.();
@@ -690,12 +744,21 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'clear',
- 'Delete Selection',
+ t('Delete Selection'),
null,
null,
targetLayerId,
selection.bounds,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeSelection: cloneSelectionForHistory(selection),
+ afterSelection: null,
+ }
);
}
}
@@ -720,7 +783,7 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'clear',
- 'Delete Selection',
+ t('Delete Selection'),
null,
null,
activeLayerId,
@@ -745,7 +808,7 @@ export function useSelectionTools({
const handleDeleteOutsideSelection = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster' || activeLayer.locked) {
- showToast('Select an unlocked raster layer');
+ showToast(t('Select an unlocked raster layer'));
return;
}
flushPendingHistoryTasks?.();
@@ -771,16 +834,16 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'clear',
- 'Delete Outside Selection',
+ t('Delete Outside Selection'),
null,
null,
targetLayerId,
dirtyRect ?? undefined,
tileDeltas
);
- showToast('Deleted outside selection');
+ showToast(t('Deleted outside selection'));
} else {
- showToast('Nothing outside selection to delete');
+ showToast(t('Nothing outside selection to delete'));
}
updateLayerThumbnail(targetLayerId, true);
}, [
@@ -799,23 +862,23 @@ export function useSelectionTools({
const handleCopySelection = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster') {
- showToast('Select a raster layer to copy selection');
+ showToast(t('Select a raster layer to copy selection'));
return;
}
if (!copySelectionToClipboard) return;
const targetLayerId = selection.floating?.layerId || activeLayerId;
const res = copySelectionToClipboard(selection, targetLayerId);
if (res.copied) {
- showToast(`Copied selection from "${res.layerName || activeLayer.name}"`);
+ showToast(t('Copied selection from "{name}"', { name: res.layerName || activeLayer.name }));
} else if (res.empty) {
- showToast('Selected area is empty');
+ showToast(t('Selected area is empty'));
}
}, [selection, activeLayer, activeLayerId, copySelectionToClipboard, showToast]);
const handleCutSelection = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster' || activeLayer.locked) {
- showToast('Select an unlocked raster layer to cut');
+ showToast(t('Select an unlocked raster layer to cut'));
return;
}
if (!copySelectionToClipboard) return;
@@ -824,7 +887,7 @@ export function useSelectionTools({
const targetLayerId = selection.floating?.layerId || activeLayerId;
const copyRes = copySelectionToClipboard(selection, targetLayerId);
if (!copyRes.copied) {
- showToast(copyRes.empty ? 'Selected area is empty' : 'Failed to cut selection');
+ showToast(copyRes.empty ? t('Selected area is empty') : t('Failed to cut selection'));
return;
}
@@ -838,12 +901,21 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'clear',
- 'Cut Selection',
+ t('Cut Selection'),
null,
null,
targetLayerId,
selection.bounds,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeSelection: cloneSelectionForHistory(selection),
+ afterSelection: null,
+ }
);
}
}
@@ -851,7 +923,7 @@ export function useSelectionTools({
grid.notifyChange(true);
updateLayerThumbnail(targetLayerId, true);
setSelection(null);
- showToast(`Cut selection from "${activeLayer.name}"`);
+ showToast(t('Cut selection from "{name}"', { name: activeLayer.name }));
return;
}
@@ -869,17 +941,26 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'clear',
- 'Cut Selection',
+ t('Cut Selection'),
null,
null,
targetLayerId,
dirtyRect ?? undefined,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ {
+ beforeSelection: cloneSelectionForHistory(selection),
+ afterSelection: null,
+ }
);
}
updateLayerThumbnail(targetLayerId, true);
setSelection(null);
- showToast(`Cut selection from "${activeLayer.name}"`);
+ showToast(t('Cut selection from "{name}"', { name: activeLayer.name }));
}, [
selection,
activeLayer,
@@ -897,7 +978,7 @@ export function useSelectionTools({
const handleMoveSelectionToNewLayer = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster' || activeLayer.locked) {
- showToast('Select an unlocked raster layer');
+ showToast(t('Select an unlocked raster layer'));
return;
}
if (!createLayerFromTileSnapshot) return;
@@ -915,7 +996,7 @@ export function useSelectionTools({
});
if (!snapshot || snapshot.tiles.length === 0) {
- showToast('Selected area is empty');
+ showToast(t('Selected area is empty'));
return;
}
@@ -949,7 +1030,7 @@ export function useSelectionTools({
: undefined;
const created = createLayerFromTileSnapshot(
snapshot,
- `${activeLayer.name} (Cut)`,
+ t('{name} (Cut)', { name: activeLayer.name }),
activeLayer.blendMode,
activeLayer.opacity,
overrides
@@ -959,7 +1040,7 @@ export function useSelectionTools({
if (combinedDeltas.length > 0 || created.layerTreeDelta) {
pushHistoryStep(
'selection-move',
- 'Move Selection to New Layer',
+ t('Move Selection to New Layer'),
null,
null,
created.id,
@@ -969,13 +1050,17 @@ export function useSelectionTools({
undefined,
undefined,
false,
- created.layerTreeDelta
+ created.layerTreeDelta,
+ {
+ beforeSelection: cloneSelectionForHistory(selection),
+ afterSelection: null,
+ }
);
}
updateLayerThumbnail(targetLayerId, true);
setSelection(null);
- showToast(`Moved selection to "${created.name}"`);
+ showToast(t('Moved selection to "{name}"', { name: created.name }));
}, [
selection,
activeLayer,
@@ -993,7 +1078,7 @@ export function useSelectionTools({
const handleCopySelectionToNewLayer = useCallback(() => {
if (!selection) return;
if (!activeLayer || activeLayer.type !== 'raster') {
- showToast('Select a raster layer');
+ showToast(t('Select a raster layer'));
return;
}
if (!createLayerFromTileSnapshot) return;
@@ -1011,7 +1096,7 @@ export function useSelectionTools({
});
if (!snapshot || snapshot.tiles.length === 0) {
- showToast('Selected area is empty');
+ showToast(t('Selected area is empty'));
return;
}
@@ -1020,7 +1105,7 @@ export function useSelectionTools({
: undefined;
const created = createLayerFromTileSnapshot(
snapshot,
- `${activeLayer.name} (Copy)`,
+ t('{name} (Copy)', { name: activeLayer.name }),
activeLayer.blendMode,
activeLayer.opacity,
overrides
@@ -1029,7 +1114,7 @@ export function useSelectionTools({
if (created.tileDeltas.length > 0 || created.layerTreeDelta) {
pushHistoryStep(
'selection-move',
- 'Copy Selection to New Layer',
+ t('Copy Selection to New Layer'),
null,
null,
created.id,
@@ -1039,7 +1124,11 @@ export function useSelectionTools({
undefined,
undefined,
false,
- created.layerTreeDelta
+ created.layerTreeDelta,
+ {
+ beforeSelection: cloneSelectionForHistory(selection),
+ afterSelection: null,
+ }
);
}
@@ -1047,7 +1136,7 @@ export function useSelectionTools({
handleCommitFloatingSelection();
}
setSelection(null);
- showToast(`Copied selection to "${created.name}"`);
+ showToast(t('Copied selection to "{name}"', { name: created.name }));
}, [
selection,
activeLayer,
@@ -1068,19 +1157,19 @@ export function useSelectionTools({
handleCommitFloatingSelection();
}
if (!activeLayer || !activeLayerId) {
- showToast('Select a raster layer to fill');
+ showToast(t('Select a raster layer to fill'));
return;
}
if (activeLayer.type === 'frame-folder') {
- showToast('Select a child layer inside the Frame Border Folder to fill');
+ showToast(t('Select a child layer inside the Frame Border Folder to fill'));
return;
}
if (activeLayer.type !== 'raster') {
- showToast('Select a raster layer to fill');
+ showToast(t('Select a raster layer to fill'));
return;
}
if (activeLayer.locked) {
- showToast('Active layer is locked');
+ showToast(t('Active layer is locked'));
return;
}
// Check effective visibility (including ancestor folders)
@@ -1095,7 +1184,7 @@ export function useSelectionTools({
guard++;
}
if (!effectivelyVisible) {
- showToast('Active layer is hidden');
+ showToast(t('Active layer is hidden'));
return;
}
@@ -1108,7 +1197,7 @@ export function useSelectionTools({
flushPendingHistoryTasks?.();
const grid = getGrid();
if (activeLayer.alphaLocked && !grid.hasLayerTiles(activeLayerId)) {
- showToast('Alpha Lock is enabled on an empty layer');
+ showToast(t('Alpha Lock is enabled on an empty layer'));
return;
}
@@ -1127,7 +1216,7 @@ export function useSelectionTools({
if (tileDeltas.length > 0) {
pushHistoryStep(
'fill',
- 'Fill Selection',
+ t('Fill Selection'),
null,
null,
activeLayerId,
@@ -1155,6 +1244,7 @@ export function useSelectionTools({
const handleExpandSelection = useCallback(
(pixels = 5) => {
if (!selection) return;
+ const beforeSel = selection;
const w = dimensions.width;
const h = dimensions.height;
const currentMask = selectionToMask(selection, w, h);
@@ -1162,25 +1252,29 @@ export function useSelectionTools({
const b = maskToBounds(expanded, w, h);
if (!b) {
setSelection(null);
+ recordSelectionHistory(t('Expand Selection (+{pixels}px)', { pixels }), beforeSel, null);
return;
}
const svg = maskToSvgPath(expanded, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'mask',
bounds: b,
mask: expanded,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
- showToast(`Expanded Selection (+${pixels}px)`);
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Expand Selection (+{pixels}px)', { pixels }), beforeSel, nextSel);
+ showToast(t('Expanded Selection (+{pixels}px)', { pixels }));
},
- [selection, dimensions, showToast]
+ [selection, dimensions, recordSelectionHistory, showToast]
);
const handleContractSelection = useCallback(
(pixels = 5) => {
if (!selection) return;
+ const beforeSel = selection;
const w = dimensions.width;
const h = dimensions.height;
const currentMask = selectionToMask(selection, w, h);
@@ -1188,26 +1282,30 @@ export function useSelectionTools({
const b = maskToBounds(contracted, w, h);
if (!b) {
setSelection(null);
- showToast('Selection contracted to empty');
+ recordSelectionHistory(t('Contract Selection (-{pixels}px)', { pixels }), beforeSel, null);
+ showToast(t('Selection contracted to empty'));
return;
}
const svg = maskToSvgPath(contracted, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'mask',
bounds: b,
mask: contracted,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
- showToast(`Contracted Selection (-${pixels}px)`);
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Contract Selection (-{pixels}px)', { pixels }), beforeSel, nextSel);
+ showToast(t('Contracted Selection (-{pixels}px)', { pixels }));
},
- [selection, dimensions, showToast]
+ [selection, dimensions, recordSelectionHistory, showToast]
);
const handleFeatherSelection = useCallback(
(radius = 5) => {
if (!selection) return;
+ const beforeSel = selection;
const w = dimensions.width;
const h = dimensions.height;
const currentMask = selectionToMask(selection, w, h);
@@ -1215,23 +1313,27 @@ export function useSelectionTools({
const b = maskToBounds(feathered, w, h);
if (!b) {
setSelection(null);
+ recordSelectionHistory(t('Feather Selection ({radius}px)', { radius }), beforeSel, null);
return;
}
const svg = maskToSvgPath(feathered, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'mask',
bounds: b,
mask: feathered,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
- showToast(`Feathered Selection (${radius}px)`);
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Feather Selection ({radius}px)', { radius }), beforeSel, nextSel);
+ showToast(t('Feathered Selection ({radius}px)', { radius }));
},
- [selection, dimensions, showToast]
+ [selection, dimensions, recordSelectionHistory, showToast]
);
const handleInvertSelection = useCallback(() => {
+ const beforeSel = selection;
const w = dimensions.width;
const h = dimensions.height;
const currentMask = selection ? selectionToMask(selection, w, h) : new Uint8Array(w * h);
@@ -1239,37 +1341,43 @@ export function useSelectionTools({
const b = maskToBounds(inverted, w, h);
if (!b) {
setSelection(null);
- showToast('Inverted Selection (Empty)');
+ recordSelectionHistory(t('Invert Selection'), beforeSel, null);
+ showToast(t('Inverted Selection (Empty)'));
return;
}
const svg = maskToSvgPath(inverted, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'mask',
bounds: b,
mask: inverted,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
- showToast('Inverted Selection');
- }, [selection, dimensions, showToast]);
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Invert Selection'), beforeSel, nextSel);
+ showToast(t('Inverted Selection'));
+ }, [selection, dimensions, recordSelectionHistory, showToast]);
const handleSelectAll = useCallback(() => {
+ const beforeSel = selection;
const w = dimensions.width;
const h = dimensions.height;
const mask = new Uint8Array(w * h);
mask.fill(255);
const svg = `M 0 0 H ${w} V ${h} H 0 Z`;
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'rect',
bounds: { x: 0, y: 0, width: w, height: h },
mask,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
- showToast('Selected All (Ctrl+A)');
- }, [dimensions, showToast]);
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Select All'), beforeSel, nextSel);
+ showToast(t('Selected All (Ctrl+A)'));
+ }, [selection, dimensions, recordSelectionHistory, showToast]);
const handleStartTransform = useCallback((initialMode?: TransformMode) => {
const requestedMode: TransformMode =
@@ -1299,7 +1407,7 @@ export function useSelectionTools({
const targetLayerId = selection.floating.layerId || activeLayerId;
const floatingTarget = layers.find((l) => l.id === targetLayerId);
if (floatingTarget && (floatingTarget.locked || floatingTarget.type !== 'raster')) {
- showToast('Select an unlocked raster layer or folder to transform');
+ showToast(t('Select an unlocked raster layer or folder to transform'));
return;
}
@@ -1345,13 +1453,13 @@ export function useSelectionTools({
if (resolved.blockedReason === 'locked') {
showToast(
resolved.includesFolder
- ? 'Unlock the selected folder to transform'
- : 'Select an unlocked raster layer or folder to transform'
+ ? t('Unlock the selected folder to transform')
+ : t('Select an unlocked raster layer or folder to transform')
);
} else if (resolved.blockedReason === 'empty-folder') {
- showToast('Selected folder has no unlocked raster layers to transform');
+ showToast(t('Selected folder has no unlocked raster layers to transform'));
} else {
- showToast('Select an unlocked raster layer or folder to transform');
+ showToast(t('Select an unlocked raster layer or folder to transform'));
}
return;
}
@@ -1418,7 +1526,7 @@ export function useSelectionTools({
.map((l) => l.id);
if (!liftBounds || !compositeCanvas || liftedLayerIds.length === 0) {
if (compositeCanvas) releaseTemporaryCanvas(compositeCanvas);
- showToast(includesFolder ? 'Selected folder is empty' : 'Selected layers are empty');
+ showToast(includesFolder ? t('Selected folder is empty') : t('Selected layers are empty'));
return;
}
@@ -1529,7 +1637,7 @@ export function useSelectionTools({
}
if (!isFinite(minX) || !isFinite(minY) || maxX <= minX || maxY <= minY) {
- showToast(includesFolder ? 'Selected folder is empty' : 'Selected layers are empty');
+ showToast(includesFolder ? t('Selected folder is empty') : t('Selected layers are empty'));
return;
}
@@ -1580,7 +1688,7 @@ export function useSelectionTools({
.map((l) => l.id);
if (liftedLayerIds.length === 0) {
releaseTemporaryCanvas(compositeCanvas);
- showToast(includesFolder ? 'Selected folder is empty' : 'Selected layers are empty');
+ showToast(includesFolder ? t('Selected folder is empty') : t('Selected layers are empty'));
return;
}
@@ -1619,7 +1727,7 @@ export function useSelectionTools({
if (isBg) {
b = { x: 0, y: 0, width: dimensions.width, height: dimensions.height };
} else {
- showToast(includesFolder ? 'Selected folder is empty' : 'Active layer is empty');
+ showToast(includesFolder ? t('Selected folder is empty') : t('Active layer is empty'));
return;
}
}
@@ -1740,19 +1848,19 @@ export function useSelectionTools({
const modeLabel =
transformSession.mode === 'puppet'
- ? 'Puppet Warp'
+ ? t('Puppet Warp')
: transformSession.mode === 'cage'
- ? 'Cage Transform'
+ ? t('Cage Transform')
: transformSession.mode === 'mesh'
- ? 'Mesh Warp'
+ ? t('Mesh Warp')
: transformSession.mode === 'perspective'
- ? 'Perspective Transform'
- : 'Free Transform';
+ ? t('Perspective Transform')
+ : t('Free Transform');
if (allTileDeltas.length > 0) {
pushHistoryStep(
'transform',
- `${modeLabel} (${transformSession.layerIds.length} layers)`,
+ t('{mode} ({count} layers)', { mode: modeLabel, count: transformSession.layerIds.length }),
null,
null,
transformSession.layerIds[0],
@@ -1788,14 +1896,14 @@ export function useSelectionTools({
const singleModeLabel =
transformSession.mode === 'puppet'
- ? 'Puppet Warp'
+ ? t('Puppet Warp')
: transformSession.mode === 'cage'
- ? 'Cage Transform'
+ ? t('Cage Transform')
: transformSession.mode === 'mesh'
- ? 'Mesh Warp'
+ ? t('Mesh Warp')
: transformSession.mode === 'perspective'
- ? 'Perspective Transform'
- : 'Free Transform';
+ ? t('Perspective Transform')
+ : t('Free Transform');
const tileDeltas = grid.computeDeltasFromSnapshot(beforeSnap, targetLayerId);
if (tileDeltas.length > 0) {
@@ -1856,6 +1964,7 @@ export function useSelectionTools({
if (tool === 'select-wand') {
e.preventDefault();
+ const beforeSel = selection;
if (selection?.floating) {
handleCommitFloatingSelection();
}
@@ -1879,23 +1988,27 @@ export function useSelectionTools({
if (!bounds || bounds.width === 0 || bounds.height === 0) {
setSelection(null);
+ recordSelectionHistory(t('Deselect'), beforeSel, null);
return true;
}
const svgPath = maskToSvgPath(mask, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'wand',
bounds,
mask,
maskWidth: w,
maskHeight: h,
svgPath,
- });
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Magic Wand Select'), beforeSel, nextSel);
return true;
}
if (tool === 'select-pen' || tool === 'select-eraser') {
e.preventDefault();
+ selectionBeforeGestureRef.current = cloneSelectionForHistory(selection);
if (selection?.floating) {
handleCommitFloatingSelection();
}
@@ -2049,6 +2162,7 @@ export function useSelectionTools({
if (selection?.floating) {
handleCommitFloatingSelection();
}
+ selectionBeforeGestureRef.current = cloneSelectionForHistory(selection);
if (tool === 'select-rect') {
try {
@@ -2088,6 +2202,7 @@ export function useSelectionTools({
dimensions,
layers,
activeLayerId,
+ recordSelectionHistory,
updateLayerThumbnail,
]
);
@@ -2242,6 +2357,8 @@ export function useSelectionTools({
const { ctx: mCtx } = selectionPenDrawingRef.current;
selectionPenDrawingRef.current = null;
isSelectionPenDrawingRef.current = false;
+ const beforeSel = selectionBeforeGestureRef.current;
+ selectionBeforeGestureRef.current = null;
const w = dimensions.width;
const h = dimensions.height;
const mImgData = mCtx.getImageData(0, 0, w, h);
@@ -2250,18 +2367,22 @@ export function useSelectionTools({
newMask[i] = mImgData.data[i * 4 + 3] > 0 ? 255 : 0;
}
const b = maskToBounds(newMask, w, h);
+ const label = tool === 'select-eraser' ? t('Selection Eraser') : t('Selection Pen');
if (b) {
const svg = maskToSvgPath(newMask, w, h);
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'mask',
bounds: b,
mask: newMask,
maskWidth: w,
maskHeight: h,
svgPath: svg,
- });
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(label, beforeSel, nextSel);
} else {
setSelection(null);
+ recordSelectionHistory(label, beforeSel, null);
}
return true;
}
@@ -2276,6 +2397,8 @@ export function useSelectionTools({
releaseCapture();
const s = selectRectStartRef.current;
selectRectStartRef.current = null;
+ const beforeSel = selectionBeforeGestureRef.current;
+ selectionBeforeGestureRef.current = null;
const x0 = Math.max(0, Math.min(dimensions.width, Math.floor(Math.min(s.x, pt.x))));
const y0 = Math.max(0, Math.min(dimensions.height, Math.floor(Math.min(s.y, pt.y))));
const x1 = Math.max(0, Math.min(dimensions.width, Math.ceil(Math.max(s.x, pt.x))));
@@ -2284,19 +2407,25 @@ export function useSelectionTools({
const h = y1 - y0;
if (w < 4 || h < 4) {
setSelection(null);
+ recordSelectionHistory(t('Deselect'), beforeSel, null);
} else {
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'rect',
bounds: { x: x0, y: y0, width: w, height: h },
- });
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Marquee Select'), beforeSel, nextSel);
}
return true;
}
if (lassoPointsRef.current.length > 0) {
releaseCapture();
+ const beforeSel = selectionBeforeGestureRef.current;
+ selectionBeforeGestureRef.current = null;
if (lassoPointsRef.current.length < 3) {
setSelection(null);
+ recordSelectionHistory(t('Deselect'), beforeSel, null);
} else {
const b = computePolygonBounds(lassoPointsRef.current);
const overlapsCanvas =
@@ -2306,12 +2435,15 @@ export function useSelectionTools({
b.y < dimensions.height;
if (!overlapsCanvas || b.width < 2 || b.height < 2) {
setSelection(null);
+ recordSelectionHistory(t('Deselect'), beforeSel, null);
} else {
- setSelection({
+ const nextSel: CanvasSelection = {
type: 'lasso',
bounds: b,
polygon: [...lassoPointsRef.current],
- });
+ };
+ setSelection(nextSel);
+ recordSelectionHistory(t('Lasso Select'), beforeSel, nextSel);
}
}
lassoPointsRef.current = [];
@@ -2320,7 +2452,7 @@ export function useSelectionTools({
return false;
},
- [dimensions.height, dimensions.width]
+ [dimensions.height, dimensions.width, recordSelectionHistory]
);
return {
@@ -2329,6 +2461,7 @@ export function useSelectionTools({
transformSession,
setTransformSession,
isSelectionPenDrawingRef,
+ restoreSelectionFromHistory,
handleCommitFloatingSelection,
handleDeselect,
handleClearSelection,
diff --git a/src/hooks/drawing/useShapeAndFillTools.ts b/src/hooks/drawing/useShapeAndFillTools.ts
index 24b68a2..8e22f20 100644
--- a/src/hooks/drawing/useShapeAndFillTools.ts
+++ b/src/hooks/drawing/useShapeAndFillTools.ts
@@ -46,6 +46,7 @@ import {
import { hitTestEditableVectorLayer } from '../../utils/vectorLayerRenderer';
import { extractPersistableTextStyle, normalizeTextSettings } from '../../utils/textSettings';
import { useToolStore, toolStoreActions } from '../../stores';
+import { t, tc } from '../../i18n';
import { PushHistoryStepFn } from './types';
export interface TextPlacementSession {
@@ -317,7 +318,7 @@ export function useShapeAndFillTools({
const openLayerForEditing = useCallback(
(layer: LayerItem): boolean => {
if (layer.locked) {
- showToast?.('Layer is locked');
+ showToast?.(t('Layer is locked'));
return false;
}
if (layer.type === 'text' && layer.textData) {
@@ -579,7 +580,7 @@ export function useShapeAndFillTools({
activeLayer.locked ||
!isLayerEffectivelyVisible(activeLayer)
) {
- showToast?.('Select an unlocked, visible raster layer to draw shapes');
+ showToast?.(t('Select an unlocked, visible raster layer to draw shapes'));
return true;
}
try {
@@ -746,23 +747,23 @@ export function useShapeAndFillTools({
onCommitFloatingSelection?.();
}
if (!activeLayerId || !activeLayer) {
- showToast?.('Select a raster layer to use the Fill tool');
+ showToast?.(t('Select a raster layer to use the Fill tool'));
return true;
}
if (activeLayer.type === 'frame-folder') {
- showToast?.('Select a child layer inside the Frame Border Folder to fill');
+ showToast?.(t('Select a child layer inside the Frame Border Folder to fill'));
return true;
}
if (activeLayer.type !== 'raster') {
- showToast?.('Select a raster layer to use the Fill tool');
+ showToast?.(t('Select a raster layer to use the Fill tool'));
return true;
}
if (activeLayer.locked) {
- showToast?.('Active layer is locked');
+ showToast?.(t('Active layer is locked'));
return true;
}
if (!isLayerEffectivelyVisible(activeLayer)) {
- showToast?.('Active layer is hidden');
+ showToast?.(t('Active layer is hidden'));
return true;
}
@@ -774,7 +775,7 @@ export function useShapeAndFillTools({
const isTransparentInk = useToolStore.getState().isTransparentColor;
const isBg = activeLayerId === 'layer-bg' || activeLayerId.startsWith('layer-bg');
if (fillSettings.method === 'paint-unfilled' && isTransparentInk && !isBg) {
- showToast?.('Switch off Transparent Ink (C) to paint unfilled areas');
+ showToast?.(t('Switch off Transparent Ink (C) to paint unfilled areas'));
return true;
}
try {
@@ -806,7 +807,7 @@ export function useShapeAndFillTools({
const grid = documentStore.getActiveTileGrid();
if (activeLayer.alphaLocked && !grid.hasLayerTiles(activeLayerId)) {
- showToast?.('Alpha Lock is enabled on an empty layer');
+ showToast?.(t('Alpha Lock is enabled on an empty layer'));
return true;
}
@@ -825,7 +826,7 @@ export function useShapeAndFillTools({
? createSelectionMask(selection, dimensions.width, dimensions.height)
: null;
if (selMask && selMask[py * dimensions.width + px] === 0) {
- showToast?.('Click inside the active selection to fill');
+ showToast?.(t('Click inside the active selection to fill'));
return true;
}
@@ -855,7 +856,7 @@ export function useShapeAndFillTools({
if (fillRes.modified && fillRes.tileDeltas.length > 0) {
pushHistoryStep(
'fill',
- isTransparentInk ? 'Erase Fill' : 'Bucket Fill',
+ isTransparentInk ? t('Erase Fill') : t('Bucket Fill'),
null,
null,
targetLayerId,
@@ -867,7 +868,7 @@ export function useShapeAndFillTools({
})
.catch((err) => {
console.warn('Flood fill failed:', err);
- showToast?.('Fill failed');
+ showToast?.(t('Fill failed'));
});
return true;
}
@@ -891,7 +892,7 @@ export function useShapeAndFillTools({
if (hit) {
openLayerForEditing(hit);
} else {
- showToast?.('Click a Text or Speech Balloon layer to edit');
+ showToast?.(t('Click a Text or Speech Balloon layer to edit'));
}
return true;
}
@@ -1200,11 +1201,13 @@ export function useShapeAndFillTools({
);
if (dirtyRect && tileDeltas.length > 0) {
- const shapeName =
- shapeSettings.shape.charAt(0).toUpperCase() + shapeSettings.shape.slice(1);
+ const shapeName = tc(
+ 'shapeType',
+ shapeSettings.shape.charAt(0).toUpperCase() + shapeSettings.shape.slice(1)
+ );
pushHistoryStep(
'shape',
- `Shape: ${shapeName}`,
+ t('Shape: {name}', { name: shapeName }),
null,
null,
activeLayerId,
@@ -1260,12 +1263,14 @@ export function useShapeAndFillTools({
}
if (allDeltas.length > 0) {
- const modeLabel =
- liquifySettings.mode.charAt(0).toUpperCase() + liquifySettings.mode.slice(1);
+ const modeLabel = tc(
+ 'liquifyMode',
+ liquifySettings.mode.charAt(0).toUpperCase() + liquifySettings.mode.slice(1)
+ );
const stepLabel =
modifiedCount > 1
- ? `Liquify (${modifiedCount} layers): ${modeLabel}`
- : `Liquify: ${modeLabel}`;
+ ? t('Liquify ({count} layers): {mode}', { count: modifiedCount, mode: modeLabel })
+ : t('Liquify: {mode}', { mode: modeLabel });
pushHistoryStep(
'liquify',
stepLabel,
@@ -1319,7 +1324,7 @@ export function useShapeAndFillTools({
const grid = documentStore.getActiveTileGrid();
if (activeLayer.alphaLocked && !grid.hasLayerTiles(activeLayerId)) {
- showToast?.('Alpha Lock is enabled on an empty layer');
+ showToast?.(t('Alpha Lock is enabled on an empty layer'));
return true;
}
@@ -1358,9 +1363,9 @@ export function useShapeAndFillTools({
opacity: fillOpacity,
},
});
- historyLabel = isTransparentInk ? 'Enclose & Erase' : 'Enclose & Fill';
+ historyLabel = isTransparentInk ? t('Enclose & Erase') : t('Enclose & Fill');
if (!res.modified) {
- showToast?.('No closed outline found — try increasing Close Gap or check Reference Layer');
+ showToast?.(t('No closed outline found — try increasing Close Gap or check Reference Layer'));
}
} else if (activeMethod === 'paint-unfilled') {
res = executePaintUnfilledAreaOnTileGrid({
@@ -1383,7 +1388,7 @@ export function useShapeAndFillTools({
opacity: fillOpacity,
},
});
- historyLabel = 'Paint Unfilled Area';
+ historyLabel = t('Paint Unfilled Area');
} else {
res = executeLassoFillOnTileGrid({
grid,
@@ -1396,7 +1401,7 @@ export function useShapeAndFillTools({
selectionMask: selMask,
opacity: fillOpacity,
});
- historyLabel = isTransparentInk ? 'Lasso Erase' : 'Lasso Fill';
+ historyLabel = isTransparentInk ? t('Lasso Erase') : t('Lasso Fill');
}
if (res.modified && res.tileDeltas.length > 0) {
@@ -1450,7 +1455,7 @@ export function useShapeAndFillTools({
}
if (!targetFolder) {
- showToast?.('No Frame Border Folder intersected by cut line');
+ showToast?.(t('No Frame Border Folder intersected by cut line'));
return true;
}
@@ -1460,7 +1465,7 @@ export function useShapeAndFillTools({
if (res.divided) {
pushHistoryStep(
'frame',
- divideMode === 'split-folders' ? 'Divide Frame Folder' : 'Divide Frame Border',
+ divideMode === 'split-folders' ? t('Divide Frame Folder') : t('Divide Frame Border'),
null,
null,
targetFolder.id,
@@ -1474,11 +1479,11 @@ export function useShapeAndFillTools({
);
showToast?.(
divideMode === 'split-folders'
- ? 'Frame split into 2 Frame Folders'
- : 'Frame divided with manga gutter'
+ ? t('Frame split into 2 Frame Folders')
+ : t('Frame divided with manga gutter')
);
} else {
- showToast?.('Cut line must cross completely through a frame border');
+ showToast?.(t('Cut line must cross completely through a frame border'));
}
return true;
}
@@ -1513,7 +1518,7 @@ export function useShapeAndFillTools({
const { folder, layerTreeDelta } = createFrameFolder([rectFrame], undefined, true);
pushHistoryStep(
'frame',
- 'Create Frame Folder',
+ t('Create Frame Folder'),
null,
null,
folder.id,
@@ -1525,7 +1530,7 @@ export function useShapeAndFillTools({
undefined,
layerTreeDelta
);
- showToast?.('Created Frame Border Folder (child layers auto-clip)');
+ showToast?.(t('Created Frame Border Folder (child layers auto-clip)'));
}
return true;
}
diff --git a/src/hooks/drawing/useVectorDrawing.ts b/src/hooks/drawing/useVectorDrawing.ts
index 7b3e91c..96ff4e1 100644
--- a/src/hooks/drawing/useVectorDrawing.ts
+++ b/src/hooks/drawing/useVectorDrawing.ts
@@ -23,6 +23,7 @@ import {
} from '../../utils/vectorEngine';
import { get2DContext } from '../../utils/canvasUtils';
import { useToolStore } from '../../stores';
+import { t, tc, td } from '../../i18n';
import { PushHistoryStepFn } from './types';
export interface CommitVectorStrokeArgs {
@@ -141,7 +142,7 @@ export function commitVectorStrokeOrErase({
pushHistoryStep(
'eraser',
- 'Vector Eraser',
+ t('Vector Eraser'),
null,
null,
currentLayerId,
@@ -209,7 +210,7 @@ export function commitVectorStrokeOrErase({
pushHistoryStep(
isPencil ? 'pencil' : 'brush',
- labelOverride || bs.brushName || (isPencil ? 'Vector Pencil' : 'Vector Pen'),
+ labelOverride || (bs.brushName ? td(bs.brushName) : (isPencil ? t('Vector Pencil') : t('Vector Pen'))),
null,
null,
currentLayerId,
@@ -306,7 +307,7 @@ export function useVectorDrawing({
(e: React.PointerEvent<HTMLElement>, pt: { x: number; y: number }): boolean => {
e.preventDefault();
if (!activeLayer || activeLayer.type !== 'vector' || !activeLayer.vectorStrokes) {
- showToast('Select a Vector Layer to use Correct Line tools');
+ showToast(t('Select a Vector Layer to use Correct Line tools'));
return true;
}
isVectorEditingRef.current = true;
@@ -421,7 +422,7 @@ export function useVectorDrawing({
const updatedStrokes = [...activeLayer.vectorStrokes];
pushHistoryStep(
'brush',
- `Correct Line (${vectorEditSettings.mode})`,
+ t('Correct Line ({mode})', { mode: tc('vectorEditMode', vectorEditSettings.mode) }),
null,
null,
activeLayerId,
diff --git a/src/hooks/layerManager/layerTreeOps.ts b/src/hooks/layerManager/layerTreeOps.ts
index 7d8c4b2..69a8a09 100644
--- a/src/hooks/layerManager/layerTreeOps.ts
+++ b/src/hooks/layerManager/layerTreeOps.ts
@@ -437,9 +437,8 @@ export function cloneMaskCanvasForHistory(
copy.width = canvas.width;
copy.height = canvas.height;
const ctx = copy.getContext('2d');
- if (ctx) {
- ctx.drawImage(canvas, 0, 0);
- }
+ if (!ctx) return canvas;
+ ctx.drawImage(canvas, 0, 0);
return copy;
}
diff --git a/src/hooks/layerManager/useLayerClipboard.ts b/src/hooks/layerManager/useLayerClipboard.ts
index 79b53b5..49853f8 100644
--- a/src/hooks/layerManager/useLayerClipboard.ts
+++ b/src/hooks/layerManager/useLayerClipboard.ts
@@ -25,6 +25,7 @@ import {
} from '../../utils/tileEngine';
import { createLayerTreeSnapshotDelta } from './layerTreeOps';
import { LayerManagerContext } from './types';
+import { t } from '../../i18n';
export function useLayerClipboard(ctx: LayerManagerContext) {
const {
@@ -148,7 +149,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
const pasteLayerFromCanvas = useCallback(
(
sourceCanvas: HTMLCanvasElement,
- layerName: string = 'Pasted Layer',
+ layerName: string = t('Pasted Layer'),
blendMode: BlendMode = 'normal',
opacity: number = 1,
customId?: string,
@@ -174,7 +175,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
const nextLayers = insertNewLayerItem(newId, layerName, blendMode, opacity, thumb, layerOverrides, insertTarget);
setActiveLayerId(newId);
recordLayerHistory(
- `Paste Layer (${layerName})`,
+ t('Paste Layer ({name})', { name: layerName }),
newId,
createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActiveLayerId, newId),
tileDeltas,
@@ -235,11 +236,14 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
const isActiveFolderLike = Boolean(activeItem && isFolderLikeLayer(activeItem));
const parentId = isActiveFolderLike ? activeItem!.id : (activeItem?.parentId || null);
- let name = 'Screen Tone';
+ const baseToneEn = 'Screen Tone';
+ const baseToneLoc = t('Screen Tone');
+ const tonePrefixes = baseToneEn === baseToneLoc ? [baseToneEn] : [baseToneLoc, baseToneEn];
let count = 1;
beforeLayers.forEach((l) => {
- if (l.name.startsWith('Screen Tone')) {
- const num = parseInt(l.name.replace('Screen Tone', '').trim(), 10);
+ const matched = tonePrefixes.find((p) => l.name.startsWith(p));
+ if (matched) {
+ const num = parseInt(l.name.slice(matched.length).trim(), 10);
if (!isNaN(num) && num >= count) {
count = num + 1;
} else if (num === 1 || count === 1) {
@@ -247,9 +251,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
}
}
});
- if (count > 1) {
- name = `Screen Tone ${count}`;
- }
+ const name = count > 1 ? t('Screen Tone {n}', { n: count }) : baseToneLoc;
const newLayer: LayerItem = {
id: newId,
@@ -278,7 +280,10 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
: [...beforeLayers];
nextLayers.splice(insertIdx, 0, newLayer);
- const hasBg = beforeLayers.some((l) => l.id.startsWith('layer-bg') || l.name.toLowerCase() === 'background');
+ const bgLabel = t('Background');
+ const hasBg = beforeLayers.some(
+ (l) => l.id.startsWith('layer-bg') || l.name.toLowerCase() === 'background' || l.name === bgLabel
+ );
if (!hasBg) {
const bgId = `layer-bg-${Date.now()}`;
grid.fillLayerSolidWhite(bgId, dims.width, dims.height, 'color-32bit');
@@ -292,7 +297,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
const bgThumb = createCanvasThumbnail({ grid, layerId: bgId, dimensions: dims }, false);
const bgLayer: LayerItem = {
id: bgId,
- name: 'Background',
+ name: bgLabel,
type: 'raster',
visible: true,
opacity: 1,
@@ -519,7 +524,9 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
// 1. Check internal tile-backed clipboard (zero full-doc canvas)
if (layerClipboardRef.current) {
const data = layerClipboardRef.current;
- const newName = data.isSelection ? `${data.name} (Selection)` : `${data.name} Copy`;
+ const newName = data.isSelection
+ ? t('{name} (Selection)', { name: data.name })
+ : t('{name} Copy', { name: data.name });
const overrides = data.expressionColor ? { expressionColor: data.expressionColor } : undefined;
const created = createLayerFromTileSnapshot(
data.tileSnapshot,
@@ -581,7 +588,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
width: dw,
height: dh,
});
- const newName = 'Pasted Image';
+ const newName = t('Pasted Image');
const thumb = createCanvasThumbnail({ grid, layerId: newId, dimensions }, true);
const nextLayers = insertNewLayerItem(newId, newName, 'normal', 1, thumb);
setActiveLayerId(newId);
@@ -618,7 +625,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
};
img.onerror = () => {
URL.revokeObjectURL(url);
- reject(new Error(`Failed to decode image "${file.name}".`));
+ reject(new Error(t('Failed to decode image "{name}".', { name: file.name })));
};
img.src = url;
return;
@@ -628,10 +635,10 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
reader.onload = (e) => {
const img = new Image();
img.onload = () => resolve(img);
- img.onerror = () => reject(new Error(`Failed to decode image "${file.name}".`));
+ img.onerror = () => reject(new Error(t('Failed to decode image "{name}".', { name: file.name })));
img.src = e.target?.result as string;
};
- reader.onerror = () => reject(new Error(`Failed to read file "${file.name}".`));
+ reader.onerror = () => reject(new Error(t('Failed to read file "{name}".', { name: file.name })));
reader.readAsDataURL(file);
});
@@ -639,7 +646,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
const natW = img.naturalWidth || img.width;
const natH = img.naturalHeight || img.height;
if (natW <= 0 || natH <= 0) {
- throw new Error(`Image "${file.name}" has invalid dimensions.`);
+ throw new Error(t('Image "{name}" has invalid dimensions.', { name: file.name }));
}
const dims = dimensionsRef.current;
@@ -678,7 +685,7 @@ export function useLayerClipboard(ctx: LayerManagerContext) {
setActiveLayerId(newId);
grid.notifyChange(true);
recordLayerHistory(
- `Import Image (${layerName})`,
+ t('Import Image ({name})', { name: layerName }),
newId,
createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActiveLayerId, newId),
tileDeltas,
diff --git a/src/hooks/layerManager/useLayerCrud.ts b/src/hooks/layerManager/useLayerCrud.ts
index beec1e5..655906b 100644
--- a/src/hooks/layerManager/useLayerCrud.ts
+++ b/src/hooks/layerManager/useLayerCrud.ts
@@ -14,6 +14,7 @@ import {
createLayerTreeSnapshotDelta,
} from './layerTreeOps';
import { LayerManagerContext } from './types';
+import { t } from '../../i18n';
export function useLayerCrud(ctx: LayerManagerContext) {
const {
@@ -54,23 +55,32 @@ export function useLayerCrud(ctx: LayerManagerContext) {
const resolveLayerName = (list: LayerItem[]) => {
if (customName) return customName;
let count = 1;
- const prefix =
- type === 'folder' ? 'Folder ' :
- type === 'frame-folder' ? 'Frame ' :
- type === 'vector' ? 'Vector ' :
- type === 'frame' ? 'Frame ' :
- type === 'text' ? 'Text ' :
- type === 'balloon' ? 'Balloon ' :
- type === 'adjustment' ? 'Adjustment ' : 'Layer ';
+ const keyMap: Record<LayerType, string> = {
+ folder: 'Folder {n}',
+ 'frame-folder': 'Frame {n}',
+ vector: 'Vector {n}',
+ frame: 'Frame {n}',
+ text: 'Text {n}',
+ balloon: 'Balloon {n}',
+ adjustment: 'Adjustment {n}',
+ raster: 'Layer {n}',
+ };
+ const templateKey = keyMap[type] ?? 'Layer {n}';
+ const enPrefix = templateKey.replace('{n}', '');
+ const locPrefix = t(templateKey, { n: '' });
+ const prefixes = enPrefix === locPrefix ? [enPrefix] : [locPrefix, enPrefix];
list.forEach((l) => {
- if (l.type === type && l.name.startsWith(prefix)) {
- const num = parseInt(l.name.replace(prefix, ''), 10);
- if (!isNaN(num) && num >= count) {
- count = num + 1;
+ if (l.type === type) {
+ const matched = prefixes.find((p) => l.name.startsWith(p));
+ if (matched) {
+ const num = parseInt(l.name.slice(matched.length), 10);
+ if (!isNaN(num) && num >= count) {
+ count = num + 1;
+ }
}
}
});
- return `${prefix}${count}`;
+ return t(templateKey, { n: count });
};
const createdLayer: LayerItem = {
@@ -118,10 +128,10 @@ export function useLayerCrud(ctx: LayerManagerContext) {
if (nextLayers !== beforeLayers) {
const label =
- type === 'folder' ? 'Add Folder' :
- type === 'vector' ? 'Add Vector Layer' :
- type === 'frame-folder' ? 'Add Frame Folder' :
- 'Add Layer';
+ type === 'folder' ? t('Add Folder') :
+ type === 'vector' ? t('Add Vector Layer') :
+ type === 'frame-folder' ? t('Add Frame Folder') :
+ t('Add Layer');
recordLayerHistory(
label,
id,
@@ -145,7 +155,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
const grid = activeTileGridRef.current;
const allTileDeltas: TileDelta[] = [];
- const cloneSingleLayer = (source: LayerItem, newParentId: string | null, nameSuffix: string = ' Copy'): LayerItem => {
+ const cloneSingleLayer = (source: LayerItem, newParentId: string | null, appendCopy: boolean = true): LayerItem => {
const newId = `${source.type}-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
if (hasTileBackedLayer(source)) {
@@ -177,7 +187,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
return {
...source,
id: newId,
- name: `${source.name}${nameSuffix}`,
+ name: appendCopy ? t('{name} Copy', { name: source.name }) : source.name,
parentId: newParentId,
thumbnailUrl: source.thumbnailUrl,
maskCanvas: newMaskCanvas,
@@ -198,21 +208,21 @@ export function useLayerCrud(ctx: LayerManagerContext) {
let nextActiveId = beforeActiveLayerId;
if (!isFolderLikeLayer(source)) {
- const newLayer = cloneSingleLayer(source, source.parentId, ' Copy');
+ const newLayer = cloneSingleLayer(source, source.parentId, true);
nextLayers = [...prev];
nextLayers.splice(sourceIdx, 0, newLayer);
nextActiveId = newLayer.id;
} else {
const clonedItems: LayerItem[] = [];
const cloneFolderSubtree = (folder: LayerItem, targetParentId: string | null, isRootFolder: boolean) => {
- const folderCopy = cloneSingleLayer(folder, targetParentId, isRootFolder ? ' Copy' : '');
+ const folderCopy = cloneSingleLayer(folder, targetParentId, isRootFolder);
clonedItems.push(folderCopy);
const directChildren = prev.filter((l) => l.parentId === folder.id);
for (const child of directChildren) {
if (isFolderLikeLayer(child)) {
cloneFolderSubtree(child, folderCopy.id, false);
} else {
- clonedItems.push(cloneSingleLayer(child, folderCopy.id, ' Copy'));
+ clonedItems.push(cloneSingleLayer(child, folderCopy.id, true));
}
}
};
@@ -230,7 +240,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setActiveLayerId(nextActiveId);
grid.notifyChange(true);
recordLayerHistory(
- 'Duplicate Layer',
+ t('Duplicate Layer'),
nextActiveId,
createLayerTreeSnapshotDelta(prev, nextLayers, beforeActiveLayerId, nextActiveId),
allTileDeltas,
@@ -282,7 +292,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
}
recordLayerHistory(
- 'Delete Layer',
+ t('Delete Layer'),
afterActiveId || id,
createLayerTreeSnapshotDelta(prev, res.nextLayers, beforeActiveLayerId, afterActiveId, {
cloneMasks: true,
@@ -329,7 +339,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setActiveLayerId(res.nextActiveId);
recordLayerHistory(
- res.deletedIds.length > 1 ? `Delete ${res.deletedIds.length} Layers` : 'Delete Layer',
+ res.deletedIds.length > 1 ? t('Delete {count} Layers', { count: res.deletedIds.length }) : t('Delete Layer'),
res.nextActiveId || beforeActiveLayerId,
createLayerTreeSnapshotDelta(prev, res.nextLayers, beforeActiveLayerId, res.nextActiveId, {
cloneMasks: true,
@@ -351,7 +361,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setActiveLayerId(res.newFolder.id);
recordLayerHistory(
- 'Group Layers',
+ t('Group Layers'),
res.newFolder.id,
createLayerTreeSnapshotDelta(prev, res.nextLayers, beforeActiveLayerId, res.newFolder.id),
undefined,
@@ -371,7 +381,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
layersRef.current = next;
setLayers(next);
recordLayerHistory(
- 'Rename Layer',
+ t('Rename Layer'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -395,7 +405,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Reorder Layer',
+ t('Reorder Layer'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -423,7 +433,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Move Layer to Folder',
+ t('Move Layer to Folder'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -440,7 +450,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Reorder Layers',
+ t('Reorder Layers'),
draggedId,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -502,7 +512,7 @@ export function useLayerCrud(ctx: LayerManagerContext) {
setLayers(remaining);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Move Layers',
+ t('Move Layers'),
activeLayerIdRef.current,
createLayerTreeSnapshotDelta(prev, remaining, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
diff --git a/src/hooks/layerManager/useLayerPropertiesAndMasks.ts b/src/hooks/layerManager/useLayerPropertiesAndMasks.ts
index d6f4f3c..10ba5d2 100644
--- a/src/hooks/layerManager/useLayerPropertiesAndMasks.ts
+++ b/src/hooks/layerManager/useLayerPropertiesAndMasks.ts
@@ -18,6 +18,7 @@ import {
isBackgroundLayerId,
} from './layerTreeOps';
import { LayerCanvasRegistryApi, LayerManagerContext } from './types';
+import { t, tc } from '../../i18n';
export function useLayerPropertiesAndMasks(
ctx: LayerManagerContext,
@@ -44,7 +45,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Toggle Visibility',
+ t('Toggle Visibility'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -63,7 +64,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Layer Opacity',
+ t('Layer Opacity'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current, {
coalesceKey: `opacity:${id}`,
@@ -83,7 +84,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- `Blend Mode (${blendMode})`,
+ t('Blend Mode ({mode})', { mode: tc('blendModeId', blendMode) }),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -99,7 +100,7 @@ export function useLayerPropertiesAndMasks(
layersRef.current = next;
setLayers(next);
recordLayerHistory(
- 'Toggle Layer Lock',
+ t('Toggle Layer Lock'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -128,7 +129,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Toggle Clipping Mask',
+ t('Toggle Clipping Mask'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -145,7 +146,7 @@ export function useLayerPropertiesAndMasks(
layersRef.current = next;
setLayers(next);
recordLayerHistory(
- 'Toggle Alpha Lock',
+ t('Toggle Alpha Lock'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -161,7 +162,7 @@ export function useLayerPropertiesAndMasks(
layersRef.current = next;
setLayers(next);
recordLayerHistory(
- 'Set Layer Color Label',
+ t('Set Layer Color Label'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -200,7 +201,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Add Layer Mask',
+ t('Add Layer Mask'),
layerId,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current, {
cloneMasks: true,
@@ -253,7 +254,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
grid.notifyChange(true);
recordLayerHistory(
- apply ? 'Apply Layer Mask' : 'Delete Layer Mask',
+ apply ? t('Apply Layer Mask') : t('Delete Layer Mask'),
layerId,
delta,
tileDeltas,
@@ -273,7 +274,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Toggle Layer Mask',
+ t('Toggle Layer Mask'),
layerId,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -290,7 +291,7 @@ export function useLayerPropertiesAndMasks(
layersRef.current = next;
setLayers(next);
recordLayerHistory(
- 'Toggle Mask Link',
+ t('Toggle Mask Link'),
layerId,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -341,11 +342,11 @@ export function useLayerPropertiesAndMasks(
const id = `adjustment-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
let defaultData: AdjustmentLayerData;
- let layerName: string;
+ let nameTemplate: string;
switch (type) {
case 'curves':
- layerName = 'Curves 1';
+ nameTemplate = 'Curves {n}';
defaultData = customData || {
type: 'curves',
curves: {
@@ -357,7 +358,7 @@ export function useLayerPropertiesAndMasks(
};
break;
case 'gradient-map':
- layerName = 'Gradient Map 1';
+ nameTemplate = 'Gradient Map {n}';
defaultData = customData || {
type: 'gradient-map',
stops: [
@@ -368,7 +369,7 @@ export function useLayerPropertiesAndMasks(
};
break;
case 'levels':
- layerName = 'Levels 1';
+ nameTemplate = 'Levels {n}';
defaultData = customData || {
type: 'levels',
blackPoint: 0,
@@ -380,7 +381,7 @@ export function useLayerPropertiesAndMasks(
};
break;
case 'color-balance':
- layerName = 'Color Balance 1';
+ nameTemplate = 'Color Balance {n}';
defaultData = customData || {
type: 'color-balance',
shadows: [0, 0, 0],
@@ -400,14 +401,17 @@ export function useLayerPropertiesAndMasks(
: null;
let count = 1;
- const base = layerName.replace(/ \d+$/, '');
+ const enPrefix = nameTemplate.replace('{n}', '');
+ const locPrefix = t(nameTemplate, { n: '' });
+ const prefixes = enPrefix === locPrefix ? [enPrefix] : [locPrefix, enPrefix];
prev.forEach((l) => {
- if (l.name.startsWith(base)) {
- const num = parseInt(l.name.replace(`${base} `, ''), 10);
+ const matched = prefixes.find((p) => l.name.startsWith(p));
+ if (matched) {
+ const num = parseInt(l.name.slice(matched.length), 10);
if (!isNaN(num) && num >= count) count = num + 1;
}
});
- const name = `${base} ${count}`;
+ const name = t(nameTemplate, { n: count });
const newLayer: LayerItem = {
id,
@@ -430,7 +434,7 @@ export function useLayerPropertiesAndMasks(
setActiveLayerId(id);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- `Add ${name}`,
+ t('Add {name}', { name }),
id,
createLayerTreeSnapshotDelta(prev, next, beforeActiveLayerId, id),
undefined,
@@ -450,7 +454,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Update Adjustment',
+ t('Update Adjustment'),
layerId,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
@@ -468,7 +472,7 @@ export function useLayerPropertiesAndMasks(
setLayers(next);
activeTileGridRef.current.notifyChange(true);
recordLayerHistory(
- 'Layer Styles',
+ t('Layer Styles'),
id,
createLayerTreeSnapshotDelta(prev, next, activeLayerIdRef.current, activeLayerIdRef.current),
undefined,
diff --git a/src/hooks/layerManager/useLayerResize.ts b/src/hooks/layerManager/useLayerResize.ts
index 9aba940..c660101 100644
--- a/src/hooks/layerManager/useLayerResize.ts
+++ b/src/hooks/layerManager/useLayerResize.ts
@@ -2,17 +2,35 @@ import { useCallback } from 'react';
import {
CanvasDimensions,
ComicFrame,
+ LayerItem,
+ LayerTreeDelta,
SpeechBalloon,
TextLayerData,
+ TileDelta,
VectorStroke,
hasTileBackedLayer,
} from '../../types/editor';
+import { PerspectiveRuler, StraightRuler } from '../../types/perspective';
import { ResizeCanvasOptions } from '../../types/settings';
import { createCanvasThumbnail, get2DContext } from '../../utils/canvasUtils';
-import { releaseTemporaryCanvas } from '../../utils/tileEngine';
-import { isBackgroundLayerId } from './layerTreeOps';
+import { releaseTemporaryCanvas, SparseTileGrid, TileSnapshotEntry } from '../../utils/tileEngine';
+import { renderVectorLayer } from '../../utils/vectorEngine';
+import { syncVectorObjectLayerToGrid } from '../../utils/vectorLayerRenderer';
+import { createLayerTreeSnapshotDelta, isBackgroundLayerId } from './layerTreeOps';
import { LayerManagerContext } from './types';
+export interface CanvasResizeResult {
+ beforeDimensions: CanvasDimensions;
+ afterDimensions: CanvasDimensions;
+ offsetX: number;
+ offsetY: number;
+ scaleX: number;
+ scaleY: number;
+ scaleContent: boolean;
+ tileDeltas: TileDelta[];
+ layerTreeDelta: LayerTreeDelta;
+}
+
function transformPoint(
x: number,
y: number,
@@ -28,6 +46,126 @@ function transformPoint(
return { x: x + offsetX, y: y + offsetY };
}
+function transformAngleForResize(
+ angleDeg: number,
+ scaleContent: boolean,
+ scaleX: number,
+ scaleY: number
+): number {
+ if (!scaleContent || Math.abs(scaleX - scaleY) < 1e-6) return angleDeg;
+ const rad = (angleDeg * Math.PI) / 180;
+ const nextDeg = (Math.atan2(Math.sin(rad) * scaleY, Math.cos(rad) * scaleX) * 180) / Math.PI;
+ return Number.isFinite(nextDeg) ? nextDeg : angleDeg;
+}
+
+export function transformPerspectiveRulerForResize(
+ ruler: PerspectiveRuler | null,
+ scaleContent: boolean,
+ offsetX: number,
+ offsetY: number,
+ scaleX: number,
+ scaleY: number
+): PerspectiveRuler | null {
+ if (!ruler) return null;
+ return {
+ ...ruler,
+ grid: { ...ruler.grid },
+ horizonAngle: transformAngleForResize(ruler.horizonAngle, scaleContent, scaleX, scaleY),
+ vps: ruler.vps.map((vp) => {
+ const p = transformPoint(vp.x, vp.y, scaleContent, offsetX, offsetY, scaleX, scaleY);
+ return { ...vp, x: p.x, y: p.y };
+ }),
+ };
+}
+
+export function transformStraightRulerForResize(
+ ruler: StraightRuler | null,
+ scaleContent: boolean,
+ offsetX: number,
+ offsetY: number,
+ scaleX: number,
+ scaleY: number
+): StraightRuler | null {
+ if (!ruler) return null;
+ const p = transformPoint(ruler.x, ruler.y, scaleContent, offsetX, offsetY, scaleX, scaleY);
+ return {
+ ...ruler,
+ x: p.x,
+ y: p.y,
+ angle: transformAngleForResize(ruler.angle, scaleContent, scaleX, scaleY),
+ };
+}
+
+function hasWorking2DCanvas(): boolean {
+ if (typeof document === 'undefined') return false;
+ try {
+ const probe = document.createElement('canvas');
+ probe.width = 1;
+ probe.height = 1;
+ const ctx = get2DContext(probe);
+ const ok = Boolean(ctx && typeof ctx.getImageData === 'function');
+ releaseTemporaryCanvas(probe);
+ return ok;
+ } catch {
+ return false;
+ }
+}
+
+function rerenderVectorLayerAtDimensions(
+ layer: LayerItem,
+ dims: CanvasDimensions,
+ grid: SparseTileGrid
+): boolean {
+ if (layer.type !== 'vector' || !layer.vectorStrokes) return false;
+ if (typeof document === 'undefined' || dims.width <= 0 || dims.height <= 0) return false;
+
+ const strokes = layer.vectorStrokes;
+ let minX = dims.width;
+ let minY = dims.height;
+ let maxX = 0;
+ let maxY = 0;
+ for (const st of strokes) {
+ if (st.deleted || !st.bounds) continue;
+ const pad = Math.ceil(Math.max(16, st.baseWidth || 10));
+ if (st.bounds.minX - pad < minX) minX = st.bounds.minX - pad;
+ if (st.bounds.minY - pad < minY) minY = st.bounds.minY - pad;
+ if (st.bounds.maxX + pad > maxX) maxX = st.bounds.maxX + pad;
+ if (st.bounds.maxY + pad > maxY) maxY = st.bounds.maxY + pad;
+ }
+
+ const vx = Math.max(0, Math.floor(minX));
+ const vy = Math.max(0, Math.floor(minY));
+ const vw = Math.max(0, Math.min(dims.width, Math.ceil(maxX)) - vx);
+ const vh = Math.max(0, Math.min(dims.height, Math.ceil(maxY)) - vy);
+ const targetFormat = layer.expressionColor === 'monochrome' ? 'monochrome-1bit' : 'color-32bit';
+
+ if (vw <= 0 || vh <= 0) {
+ grid.clearLayer(layer.id);
+ grid.setLayerFormat(layer.id, targetFormat);
+ grid.markLayerIngested(layer.id);
+ return true;
+ }
+
+ const tempVec = document.createElement('canvas');
+ tempVec.width = vw;
+ tempVec.height = vh;
+ const cCtx = get2DContext(tempVec);
+ if (!cCtx || typeof cCtx.getImageData !== 'function') {
+ releaseTemporaryCanvas(tempVec);
+ return false;
+ }
+
+ cCtx.save();
+ cCtx.translate(-vx, -vy);
+ renderVectorLayer(cCtx, strokes);
+ cCtx.restore();
+ const subData = cCtx.getImageData(0, 0, vw, vh);
+ grid.clearLayer(layer.id);
+ grid.writeImageData(layer.id, subData, vx, vy, targetFormat, true);
+ releaseTemporaryCanvas(tempVec);
+ return true;
+}
+
function transformComicFramesForResize(
frames: ComicFrame[],
scaleContent: boolean,
@@ -182,25 +320,34 @@ function transformBalloonForResize(
export function useLayerResize(ctx: LayerManagerContext) {
const {
dimensions,
+ dimensionsRef,
activeTileGridRef,
layers,
+ layersRef,
+ activeLayerId,
+ activeLayerIdRef,
setLayers,
} = ctx;
// Resize canvas dimensions tile-by-tile directly inside SparseTileGrid (zero full-doc layer canvas)
+ // Returns full tileDeltas + layerTreeDelta so callers can push an atomic undoable history step.
const resizeCanvas = useCallback(
(
newDims: CanvasDimensions,
options: ResizeCanvasOptions = { width: newDims.width, height: newDims.height }
- ) => {
+ ): CanvasResizeResult => {
const {
scaleContent = false,
anchor = 'center',
backgroundColor = '#ffffff',
} = options;
- const currentW = dimensions.width;
- const currentH = dimensions.height;
+ const currentDims = dimensionsRef?.current ?? dimensions;
+ const beforeLayers = layersRef?.current ?? layers;
+ const curActiveLayerId = activeLayerIdRef?.current ?? activeLayerId ?? '';
+
+ const currentW = currentDims.width;
+ const currentH = currentDims.height;
const newW = newDims.width;
const newH = newDims.height;
const scaleX = newW / Math.max(1, currentW);
@@ -231,10 +378,18 @@ export function useLayerResize(ctx: LayerManagerContext) {
}
}
- const updatedThumbnails = new Map<string, string>();
const grid = activeTileGridRef.current;
- for (const layer of layers) {
+ // 1. Snapshot BEFORE tiles for every tile-backed layer so Ctrl+Z restores cropped/resized pixels losslessly
+ const beforeTileSnapshots = new Map<string, Map<string, TileSnapshotEntry>>();
+ for (const layer of beforeLayers) {
+ if (!hasTileBackedLayer(layer)) continue;
+ beforeTileSnapshots.set(layer.id, grid.snapshotLayerTiles(layer.id));
+ }
+
+ const updatedThumbnails = new Map<string, string>();
+
+ for (const layer of beforeLayers) {
if (!hasTileBackedLayer(layer)) continue;
const layerId = layer.id;
const isBg = isBackgroundLayerId(layerId);
@@ -248,7 +403,10 @@ export function useLayerResize(ctx: LayerManagerContext) {
if (!grid.hasLayerTiles(layerId)) {
if (isBg && backgroundColor !== 'transparent') {
grid.fillLayerSolidColor(layerId, newW, newH, backgroundColor, 'color-32bit');
- updatedThumbnails.set(layerId, createCanvasThumbnail({ grid, layerId, dimensions: newDims }, false));
+ updatedThumbnails.set(
+ layerId,
+ createCanvasThumbnail({ grid, layerId, dimensions: newDims }, false)
+ );
} else {
grid.setLayerFormat(layerId, targetFormat);
grid.markLayerIngested(layerId);
@@ -256,7 +414,7 @@ export function useLayerResize(ctx: LayerManagerContext) {
continue;
}
- grid.resizeLayerInGrid(layerId, dimensions, newDims, {
+ grid.resizeLayerInGrid(layerId, currentDims, newDims, {
scaleContent,
offsetX,
offsetY,
@@ -265,129 +423,205 @@ export function useLayerResize(ctx: LayerManagerContext) {
targetFormat,
});
- updatedThumbnails.set(layerId, createCanvasThumbnail({ grid, layerId, dimensions: newDims }, !isBg));
+ updatedThumbnails.set(
+ layerId,
+ createCanvasThumbnail({ grid, layerId, dimensions: newDims }, !isBg)
+ );
}
- // Resize layer masks if present
+ // 2. Resize layer masks into brand-new canvases (never mutate l.maskCanvas in place so undo history stays intact)
const updatedMasks = new Map<string, { maskCanvas: HTMLCanvasElement; maskThumb: string }>();
- layers.forEach((l) => {
- if (l.maskCanvas) {
- const tempMask = document.createElement('canvas');
- tempMask.width = l.maskCanvas.width;
- tempMask.height = l.maskCanvas.height;
- get2DContext(tempMask)?.drawImage(l.maskCanvas, 0, 0);
-
- l.maskCanvas.width = newW;
- l.maskCanvas.height = newH;
- const mCtx = get2DContext(l.maskCanvas);
+ beforeLayers.forEach((l) => {
+ if (l.maskCanvas && typeof document !== 'undefined') {
+ const resizedMask = document.createElement('canvas');
+ resizedMask.width = newW;
+ resizedMask.height = newH;
+ const mCtx = get2DContext(resizedMask);
if (mCtx) {
mCtx.fillStyle = '#ffffff';
mCtx.fillRect(0, 0, newW, newH);
if (scaleContent) {
- mCtx.drawImage(tempMask, 0, 0, tempMask.width, tempMask.height, 0, 0, newW, newH);
+ mCtx.drawImage(
+ l.maskCanvas,
+ 0,
+ 0,
+ l.maskCanvas.width,
+ l.maskCanvas.height,
+ 0,
+ 0,
+ newW,
+ newH
+ );
} else {
- mCtx.drawImage(tempMask, offsetX, offsetY);
+ mCtx.drawImage(l.maskCanvas, offsetX, offsetY);
}
}
- releaseTemporaryCanvas(tempMask);
updatedMasks.set(l.id, {
- maskCanvas: l.maskCanvas,
- maskThumb: createCanvasThumbnail(l.maskCanvas, false),
+ maskCanvas: resizedMask,
+ maskThumb: createCanvasThumbnail(resizedMask, false),
});
}
});
- grid.notifyChange(true);
-
const geometryChanged =
scaleContent
? Math.abs(scaleX - 1) > 1e-6 || Math.abs(scaleY - 1) > 1e-6
: offsetX !== 0 || offsetY !== 0;
- setLayers((prev) =>
- prev.map((l) => {
- const newThumb = updatedThumbnails.get(l.id);
- const maskInfo = updatedMasks.get(l.id);
- const hasCoordMeta =
- geometryChanged &&
- Boolean(
- l.comicFrames?.length ||
- l.vectorStrokes?.length ||
- l.textData ||
- l.balloonData ||
- l.balloons?.length
+ // 3. Transform vector/text/balloon/comicFrame metadata & build nextLayers
+ let nextLayers: LayerItem[] = beforeLayers.map((l) => {
+ const newThumb = updatedThumbnails.get(l.id);
+ const maskInfo = updatedMasks.get(l.id);
+ const hasCoordMeta =
+ geometryChanged &&
+ Boolean(
+ l.comicFrames?.length ||
+ l.vectorStrokes?.length ||
+ l.textData ||
+ l.balloonData ||
+ l.balloons?.length
+ );
+ if (!newThumb && !maskInfo && !hasCoordMeta) return l;
+ return {
+ ...l,
+ ...(newThumb ? { thumbnailUrl: newThumb } : {}),
+ ...(maskInfo
+ ? {
+ maskCanvas: maskInfo.maskCanvas,
+ maskThumbnailUrl: maskInfo.maskThumb,
+ maskVersion: (l.maskVersion || 0) + 1,
+ }
+ : {}),
+ ...(geometryChanged && l.comicFrames?.length
+ ? {
+ comicFrames: transformComicFramesForResize(
+ l.comicFrames,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ ),
+ }
+ : {}),
+ ...(geometryChanged && l.vectorStrokes?.length
+ ? {
+ vectorStrokes: transformVectorStrokesForResize(
+ l.vectorStrokes,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ ),
+ }
+ : {}),
+ ...(geometryChanged && l.textData
+ ? {
+ textData: transformTextDataForResize(
+ l.textData,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ ),
+ }
+ : {}),
+ ...(geometryChanged && l.balloonData
+ ? {
+ balloonData: transformBalloonForResize(
+ l.balloonData,
+ scaleContent,
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY
+ ),
+ }
+ : {}),
+ ...(geometryChanged && l.balloons?.length
+ ? {
+ balloons: l.balloons.map((b) =>
+ transformBalloonForResize(b, scaleContent, offsetX, offsetY, scaleX, scaleY)
+ ),
+ }
+ : {}),
+ };
+ });
+
+ // 4. Re-render non-destructive vector, text & balloon layers crisply at the new dimensions
+ // when Canvas2D is available (keeps scaled typography & vector ink razor-sharp).
+ if (hasWorking2DCanvas()) {
+ const crispThumbs = new Map<string, string>();
+ for (const layer of nextLayers) {
+ if (layer.type === 'text' && layer.textData) {
+ syncVectorObjectLayerToGrid(layer, newDims, grid);
+ crispThumbs.set(
+ layer.id,
+ createCanvasThumbnail({ grid, layerId: layer.id, dimensions: newDims }, true)
+ );
+ } else if (layer.type === 'balloon' && layer.balloonData) {
+ syncVectorObjectLayerToGrid(layer, newDims, grid);
+ crispThumbs.set(
+ layer.id,
+ createCanvasThumbnail({ grid, layerId: layer.id, dimensions: newDims }, true)
);
- if (!newThumb && !maskInfo && !hasCoordMeta) return l;
- return {
- ...l,
- ...(newThumb ? { thumbnailUrl: newThumb } : {}),
- ...(maskInfo
- ? {
- maskCanvas: maskInfo.maskCanvas,
- maskThumbnailUrl: maskInfo.maskThumb,
- maskVersion: (l.maskVersion || 0) + 1,
- }
- : {}),
- ...(geometryChanged && l.comicFrames?.length
- ? {
- comicFrames: transformComicFramesForResize(
- l.comicFrames,
- scaleContent,
- offsetX,
- offsetY,
- scaleX,
- scaleY
- ),
- }
- : {}),
- ...(geometryChanged && l.vectorStrokes?.length
- ? {
- vectorStrokes: transformVectorStrokesForResize(
- l.vectorStrokes,
- scaleContent,
- offsetX,
- offsetY,
- scaleX,
- scaleY
- ),
- }
- : {}),
- ...(geometryChanged && l.textData
- ? {
- textData: transformTextDataForResize(
- l.textData,
- scaleContent,
- offsetX,
- offsetY,
- scaleX,
- scaleY
- ),
- }
- : {}),
- ...(geometryChanged && l.balloonData
- ? {
- balloonData: transformBalloonForResize(
- l.balloonData,
- scaleContent,
- offsetX,
- offsetY,
- scaleX,
- scaleY
- ),
- }
- : {}),
- ...(geometryChanged && l.balloons?.length
- ? {
- balloons: l.balloons.map((b) =>
- transformBalloonForResize(b, scaleContent, offsetX, offsetY, scaleX, scaleY)
- ),
- }
- : {}),
- };
- })
+ } else if (layer.type === 'vector' && layer.vectorStrokes && layer.vectorStrokes.length > 0) {
+ if (rerenderVectorLayerAtDimensions(layer, newDims, grid)) {
+ crispThumbs.set(
+ layer.id,
+ createCanvasThumbnail({ grid, layerId: layer.id, dimensions: newDims }, true)
+ );
+ }
+ }
+ }
+ if (crispThumbs.size > 0) {
+ nextLayers = nextLayers.map((l) => {
+ const thumb = crispThumbs.get(l.id);
+ return thumb ? { ...l, thumbnailUrl: thumb } : l;
+ });
+ }
+ }
+
+ // 5. Compute full tileDeltas across ALL tile-backed layers (union of old & new tile coordinates)
+ const allTileDeltas: TileDelta[] = [];
+ for (const layer of nextLayers) {
+ if (!hasTileBackedLayer(layer)) continue;
+ const beforeSnap = beforeTileSnapshots.get(layer.id) ?? new Map<string, TileSnapshotEntry>();
+ const layerDeltas = grid.computeFullLayerDeltasFromSnapshot(beforeSnap, layer.id);
+ for (let i = 0; i < layerDeltas.length; i++) {
+ allTileDeltas.push(layerDeltas[i]);
+ }
+ }
+
+ const layerTreeDelta = createLayerTreeSnapshotDelta(
+ beforeLayers,
+ nextLayers,
+ curActiveLayerId,
+ curActiveLayerId,
+ { cloneMasks: true }
);
+
+ if (layersRef) {
+ layersRef.current = nextLayers;
+ }
+ setLayers(nextLayers);
+ grid.notifyChange(true);
+
+ return {
+ beforeDimensions: { ...currentDims },
+ afterDimensions: { ...newDims },
+ offsetX,
+ offsetY,
+ scaleX,
+ scaleY,
+ scaleContent,
+ tileDeltas: allTileDeltas,
+ layerTreeDelta,
+ };
},
- [activeTileGridRef, dimensions, layers, setLayers]
+ [activeLayerId, activeLayerIdRef, activeTileGridRef, dimensions, dimensionsRef, layers, layersRef, setLayers]
);
return {
diff --git a/src/hooks/layerManager/useLayerSpecialLayers.ts b/src/hooks/layerManager/useLayerSpecialLayers.ts
index 148ba0f..3b08652 100644
--- a/src/hooks/layerManager/useLayerSpecialLayers.ts
+++ b/src/hooks/layerManager/useLayerSpecialLayers.ts
@@ -21,6 +21,7 @@ import {
createLayerTreeSnapshotDelta,
} from './layerTreeOps';
import { LayerManagerContext } from './types';
+import { t } from '../../i18n';
export interface CreateFrameFolderResult {
folder: LayerItem;
@@ -62,7 +63,7 @@ export function useLayerSpecialLayers(
(textData: TextLayerData, editingLayerId?: string | null): LayerItem => {
const grid = activeTileGridRef.current;
const dims = dimensionsRef.current;
- const snippet = textData.text.trim().replace(/\s+/g, ' ').slice(0, 22) || 'Text';
+ const snippet = textData.text.trim().replace(/\s+/g, ' ').slice(0, 22) || t('Text');
const beforeLayers = layersRef.current;
const beforeActiveLayerId = activeLayerIdRef.current;
@@ -93,7 +94,7 @@ export function useLayerSpecialLayers(
}
updateLayerThumbnail(editingLayerId, true);
recordLayerHistory(
- 'Edit Text Layer',
+ t('Edit Text Layer'),
editingLayerId,
createLayerTreeSnapshotDelta(
beforeLayers,
@@ -134,7 +135,7 @@ export function useLayerSpecialLayers(
});
updateLayerThumbnail(created.id, true);
recordLayerHistory(
- 'Add Text Layer',
+ t('Add Text Layer'),
created.id,
createLayerTreeSnapshotDelta(beforeLayers, layersRef.current, beforeActiveLayerId, created.id),
tileDeltas,
@@ -162,7 +163,7 @@ export function useLayerSpecialLayers(
const dims = dimensionsRef.current;
const clonedBalloon: SpeechBalloon = JSON.parse(JSON.stringify(balloonData));
const snippet = clonedBalloon.text.trim().replace(/\s+/g, ' ').slice(0, 18);
- const label = snippet ? `Balloon: ${snippet}` : undefined;
+ const label = snippet ? t('Balloon: {text}', { text: snippet }) : undefined;
const beforeLayers = layersRef.current;
const beforeActiveLayerId = activeLayerIdRef.current;
@@ -193,7 +194,7 @@ export function useLayerSpecialLayers(
}
updateLayerThumbnail(editingLayerId, true);
recordLayerHistory(
- 'Edit Speech Balloon',
+ t('Edit Speech Balloon'),
editingLayerId,
createLayerTreeSnapshotDelta(
beforeLayers,
@@ -234,7 +235,7 @@ export function useLayerSpecialLayers(
});
updateLayerThumbnail(created.id, true);
recordLayerHistory(
- 'Add Speech Balloon',
+ t('Add Speech Balloon'),
created.id,
createLayerTreeSnapshotDelta(beforeLayers, layersRef.current, beforeActiveLayerId, created.id),
tileDeltas,
@@ -271,10 +272,16 @@ export function useLayerSpecialLayers(
const folderId = `frame-folder-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
let frameCount = 1;
+ const enFramePrefix = 'Frame ';
+ const locFramePrefix = t('Frame {n}', { n: '' });
+ const framePrefixes = enFramePrefix === locFramePrefix ? [enFramePrefix] : [locFramePrefix, enFramePrefix];
for (const l of beforeLayers) {
- if (l.type === 'frame-folder' && l.name.startsWith('Frame ')) {
- const num = parseInt(l.name.replace('Frame ', ''), 10);
- if (!isNaN(num) && num >= frameCount) frameCount = num + 1;
+ if (l.type === 'frame-folder') {
+ const matched = framePrefixes.find((p) => l.name.startsWith(p));
+ if (matched) {
+ const num = parseInt(l.name.slice(matched.length), 10);
+ if (!isNaN(num) && num >= frameCount) frameCount = num + 1;
+ }
}
}
@@ -297,7 +304,7 @@ export function useLayerSpecialLayers(
const updatedFolder: LayerItem = {
id: folderId,
- name: customName || `Frame ${frameCount}`,
+ name: customName || t('Frame {n}', { n: frameCount }),
type: 'frame-folder',
visible: true,
opacity: 1,
@@ -319,7 +326,7 @@ export function useLayerSpecialLayers(
const childId = `raster-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
childLayer = {
id: childId,
- name: 'Panel Layer',
+ name: t('Panel Layer'),
type: 'raster',
visible: true,
opacity: 1,
@@ -437,7 +444,7 @@ export function useLayerSpecialLayers(
const newFolder2: LayerItem = {
...folder,
id: newFolderId,
- name: `${folder.name} B`,
+ name: t('{name} B', { name: folder.name }),
comicFrames: group2Frames,
};
@@ -598,7 +605,7 @@ export function useLayerSpecialLayers(
updateLayerThumbnail(id, true);
grid.notifyChange(true);
recordLayerHistory(
- 'Rasterize Layer',
+ t('Rasterize Layer'),
id,
createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActiveLayerId, activeLayerIdRef.current),
tileDeltas,
diff --git a/src/hooks/useAppMenuSections.tsx b/src/hooks/useAppMenuSections.tsx
index fb59ffc..f83b24c 100644
--- a/src/hooks/useAppMenuSections.tsx
+++ b/src/hooks/useAppMenuSections.tsx
@@ -47,6 +47,7 @@ import { listVisiblePanelIds } from '../utils/workspacePresets';
import { isTauriEnvironment } from './useMultiplayer';
import { updaterService } from '../services/updaterService';
import { useUpdaterStore } from '../stores/useUpdaterStore';
+import { useI18n } from '../i18n';
export interface UseAppMenuSectionsParams {
hasOpenDocument: boolean;
@@ -206,6 +207,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
showToast,
} = params;
+ const { t, td } = useI18n();
const activePreset = useWorkspaceStore((s) => s.activePreset);
const activeSavedWorkspaceId = useWorkspaceStore((s) => s.activeSavedWorkspaceId);
const savedWorkspaces = useWorkspaceStore((s) => s.savedWorkspaces);
@@ -227,23 +229,23 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
() => [
{
id: 'file',
- label: 'File',
+ label: t('File'),
items: [
{
id: 'file-new',
- label: 'New...',
+ label: t('New...'),
shortcut: 'Ctrl+N',
onClick: () => uiStoreActions.setNewCanvasModalOpen(true),
},
{
id: 'file-open',
- label: 'Open...',
+ label: t('Open...'),
shortcut: 'Ctrl+O',
onClick: handleTriggerOpenFile,
},
{
id: 'file-import-brush',
- label: 'Import Brush (.inkb, .sut)...',
+ label: t('Import Brush (.inkb, .sut)...'),
onClick: () => {
const input = document.createElement('input');
input.type = 'file';
@@ -252,12 +254,12 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
const file = input.files?.[0];
if (file) {
try {
- uiStoreActions.setLoading(true, `Importing Brush: ${file.name}...`);
+ uiStoreActions.setLoading(true, t('Importing Brush: {name}...', { name: file.name }));
const parsedBrush = await importBrushFile(file);
- showToast(`Imported brush "${parsedBrush.name}"`);
+ showToast(t('Imported brush "{name}"', { name: parsedBrush.name }));
} catch (err: unknown) {
const msg =
- err instanceof Error ? err.message : 'Failed to import brush file.';
+ err instanceof Error ? err.message : t('Failed to import brush file.');
showToast(msg);
} finally {
uiStoreActions.setLoading(false, '');
@@ -269,7 +271,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'file-export-brush',
- label: 'Export Active Brush (.inkb)...',
+ label: t('Export Active Brush (.inkb)...'),
onClick: async () => {
try {
const toolState = useToolStore.getState();
@@ -281,62 +283,62 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
);
const result = await exportBrushToInkbFile(exportable);
if (result.exported) {
- showToast(`Exported brush "${result.fileName}"`);
+ showToast(t('Exported brush "{name}"', { name: result.fileName }));
}
} catch (err: unknown) {
const msg =
- err instanceof Error ? err.message : 'Failed to export brush.';
+ err instanceof Error ? err.message : t('Failed to export brush.');
showToast(msg);
}
},
},
{
id: 'file-import-3d',
- label: 'Import 3D Model (.glb, .obj)...',
+ label: t('Import 3D Model (.glb, .obj)...'),
disabled: !hasOpenDocument,
onClick: handleTriggerImport3DFile,
},
{ id: 'file-div-1', label: '', divider: true },
{
id: 'file-save',
- label: 'Save',
+ label: t('Save'),
shortcut: 'Ctrl+S',
disabled: !hasOpenDocument,
onClick: handleSave,
},
{
id: 'file-save-as',
- label: 'Save As...',
+ label: t('Save As...'),
shortcut: 'Ctrl+Shift+S',
disabled: !hasOpenDocument,
onClick: handleSaveAs,
},
{
id: 'file-export-image',
- label: 'Export Image...',
+ label: t('Export Image...'),
disabled: !hasOpenDocument,
onClick: handleExportImage,
},
{
id: 'file-export-webtoon',
- label: 'Export Webtoon Chapter Slices (.zip)...',
+ label: t('Export Webtoon Chapter Slices (.zip)...'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.setWebtoonExportModalOpen(true),
},
{
id: 'file-timelapse-submenu',
- label: 'Time-lapse',
+ label: t('Time-lapse'),
disabled: !hasOpenDocument,
submenu: [
{
id: 'file-timelapse-record',
- label: isTimelapseRecording ? 'Pause Time-lapse Recording' : 'Record Time-lapse',
+ label: isTimelapseRecording ? t('Pause Time-lapse Recording') : t('Record Time-lapse'),
checked: isTimelapseRecording,
onClick: () => handleToggleTimelapseRecording?.(),
},
{
id: 'file-timelapse-export',
- label: 'Preview & Export Time-lapse...',
+ label: t('Preview & Export Time-lapse...'),
onClick: () => uiStoreActions.setTimelapseExportModalOpen(true),
},
],
@@ -344,7 +346,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'file-div-2', label: '', divider: true },
{
id: 'file-clear',
- label: 'Clear Canvas',
+ label: t('Clear Canvas'),
danger: true,
disabled: !hasOpenDocument,
onClick: clearCanvas,
@@ -353,18 +355,18 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit',
- label: 'Edit',
+ label: t('Edit'),
items: [
{
id: 'edit-undo',
- label: 'Undo',
+ label: t('Undo'),
shortcut: 'Ctrl+Z',
disabled: !hasOpenDocument || !canUndo,
onClick: handleUndo,
},
{
id: 'edit-redo',
- label: 'Redo',
+ label: t('Redo'),
shortcut: 'Ctrl+Y',
disabled: !hasOpenDocument || !canRedo,
onClick: redo,
@@ -372,47 +374,47 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'edit-div-1', label: '', divider: true },
{
id: 'edit-cut',
- label: 'Cut',
+ label: t('Cut'),
shortcut: 'Ctrl+X',
disabled: !hasOpenDocument || !activeLayer || !selection,
onClick: handleCutSelection,
},
{
id: 'edit-copy',
- label: 'Copy',
+ label: t('Copy'),
shortcut: 'Ctrl+C',
disabled: !hasOpenDocument || !activeLayer,
onClick: selection ? handleCopySelection : handleCopySelectedLayer,
},
{
id: 'edit-paste',
- label: 'Paste',
+ label: t('Paste'),
shortcut: 'Ctrl+V',
disabled: !hasOpenDocument,
onClick: handlePasteSelectedLayer,
},
{
id: 'edit-move-selection-layer',
- label: 'Move Selection to New Layer',
+ label: t('Move Selection to New Layer'),
shortcut: 'Ctrl+Shift+J',
disabled: !hasOpenDocument || !activeLayer || !selection,
onClick: handleMoveSelectionToNewLayer,
},
{
id: 'edit-paste-file',
- label: 'Paste from file...',
+ label: t('Paste from file...'),
disabled: !hasOpenDocument,
onClick: handleTriggerPasteFromFile,
},
{
id: 'edit-import-3d',
- label: 'Import 3D File (.glb, .obj)...',
+ label: t('Import 3D File (.glb, .obj)...'),
disabled: !hasOpenDocument,
onClick: handleTriggerImport3DFile,
},
{
id: 'edit-delete',
- label: 'Delete',
+ label: t('Delete'),
shortcut: 'Del',
danger: true,
disabled: !hasOpenDocument || layers.filter((l) => l.type === 'raster').length <= 1,
@@ -420,52 +422,52 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-clear-layer',
- label: 'Clear Active Layer',
+ label: t('Clear Active Layer'),
disabled: !hasOpenDocument || !activeLayer,
onClick: handleClearActiveLayer,
},
{
id: 'edit-transform',
- label: 'Free Transform',
+ label: t('Free Transform'),
shortcut: 'Ctrl+T',
disabled: !hasOpenDocument,
onClick: () => handleStartTransform('affine'),
},
{
id: 'edit-puppet-warp',
- label: 'Puppet Warp',
+ label: t('Puppet Warp'),
shortcut: 'Ctrl+Shift+T',
disabled: !hasOpenDocument,
onClick: () => handleStartTransform('puppet'),
},
{
id: 'edit-cage-transform',
- label: 'Cage Transform',
+ label: t('Cage Transform'),
disabled: !hasOpenDocument,
onClick: () => handleStartTransform('cage'),
},
{
id: 'edit-deselect',
- label: 'Deselect',
+ label: t('Deselect'),
shortcut: 'Ctrl+D',
disabled: !hasOpenDocument || !selection,
onClick: handleDeselect,
},
{
id: 'edit-fill-sel',
- label: 'Fill Selection',
+ label: t('Fill Selection'),
disabled: !hasOpenDocument || !selection,
onClick: handleFillSelectionColor,
},
{
id: 'edit-tonal-correction',
- label: 'Tonal Correction',
+ label: t('Tonal Correction'),
disabled:
!hasOpenDocument || !activeLayer || activeLayer.locked || activeLayer.type !== 'raster',
submenu: [
{
id: 'edit-tonal-brightness-contrast',
- label: 'Brightness/Contrast...',
+ label: t('Brightness/Contrast...'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -475,7 +477,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-tonal-hue-saturation',
- label: 'Hue/Saturation/Luminosity...',
+ label: t('Hue/Saturation/Luminosity...'),
shortcut: 'Ctrl+U',
disabled:
!hasOpenDocument ||
@@ -486,7 +488,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-tonal-posterization',
- label: 'Posterization...',
+ label: t('Posterization...'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -496,7 +498,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-tonal-reverse-gradient',
- label: 'Reverse Gradient',
+ label: t('Reverse Gradient'),
shortcut: 'Ctrl+I',
disabled:
!hasOpenDocument ||
@@ -507,7 +509,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-tonal-level-correction',
- label: 'Level Correction...',
+ label: t('Level Correction...'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -517,7 +519,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'edit-tonal-binarization',
- label: 'Binarization...',
+ label: t('Binarization...'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -530,14 +532,14 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'edit-div-2', label: '', divider: true },
{
id: 'edit-resize-canvas',
- label: 'Resize Canvas...',
+ label: t('Resize Canvas...'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.setResizeCanvasModalOpen(true),
},
{ id: 'edit-div-3', label: '', divider: true },
{
id: 'edit-settings',
- label: 'Settings...',
+ label: t('Settings...'),
shortcut: 'Ctrl+,',
onClick: () => uiStoreActions.setSettingsModalOpen(true),
},
@@ -545,25 +547,25 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'select',
- label: 'Select',
+ label: t('Select'),
items: [
{
id: 'select-all',
- label: 'Select All',
+ label: t('Select All'),
shortcut: 'Ctrl+A',
disabled: !hasOpenDocument,
onClick: handleSelectAll,
},
{
id: 'select-deselect',
- label: 'Deselect',
+ label: t('Deselect'),
shortcut: 'Ctrl+D',
disabled: !hasOpenDocument || !selection,
onClick: handleDeselect,
},
{
id: 'select-invert',
- label: 'Invert Selection',
+ label: t('Invert Selection'),
shortcut: 'Ctrl+Shift+I',
disabled: !hasOpenDocument,
onClick: handleInvertSelection,
@@ -571,40 +573,40 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'select-div-1', label: '', divider: true },
{
id: 'select-expand',
- label: 'Expand (+5px)...',
+ label: t('Expand (+5px)...'),
disabled: !hasOpenDocument || !selection,
onClick: () => handleExpandSelection(5),
},
{
id: 'select-contract',
- label: 'Contract (-5px)...',
+ label: t('Contract (-5px)...'),
disabled: !hasOpenDocument || !selection,
onClick: () => handleContractSelection(5),
},
{
id: 'select-feather',
- label: 'Feather (5px)...',
+ label: t('Feather (5px)...'),
disabled: !hasOpenDocument || !selection,
onClick: () => handleFeatherSelection(5),
},
{ id: 'select-div-2', label: '', divider: true },
{
id: 'select-cut',
- label: 'Cut Selection',
+ label: t('Cut Selection'),
shortcut: 'Ctrl+X',
disabled: !hasOpenDocument || !selection,
onClick: handleCutSelection,
},
{
id: 'select-copy',
- label: 'Copy Selection',
+ label: t('Copy Selection'),
shortcut: 'Ctrl+C',
disabled: !hasOpenDocument || !selection,
onClick: handleCopySelection,
},
{
id: 'select-move-to-layer',
- label: 'Move Selection to New Layer',
+ label: t('Move Selection to New Layer'),
shortcut: 'Ctrl+Shift+J',
disabled: !hasOpenDocument || !selection,
onClick: handleMoveSelectionToNewLayer,
@@ -612,7 +614,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'select-div-3', label: '', divider: true },
{
id: 'select-delete',
- label: 'Delete Selection',
+ label: t('Delete Selection'),
shortcut: 'Del',
danger: true,
disabled: !hasOpenDocument || !selection,
@@ -620,7 +622,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'select-delete-outside',
- label: 'Delete Outside Selection',
+ label: t('Delete Outside Selection'),
danger: true,
disabled: !hasOpenDocument || !selection,
onClick: handleDeleteOutsideSelection,
@@ -628,7 +630,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'select-div-4', label: '', divider: true },
{
id: 'select-transform',
- label: 'Transform Selection',
+ label: t('Transform Selection'),
shortcut: 'Ctrl+T',
disabled: !hasOpenDocument || !selection,
onClick: handleStartTransform,
@@ -637,30 +639,30 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'layer',
- label: 'Layer',
+ label: t('Layer'),
items: [
{
id: 'layer-new-raster',
- label: 'New Raster Layer',
+ label: t('New Raster Layer'),
shortcut: 'Ctrl+Shift+N',
disabled: !hasOpenDocument,
onClick: () => handleAddLayer('raster'),
},
{
id: 'layer-new-folder',
- label: 'New Folder',
+ label: t('New Folder'),
disabled: !hasOpenDocument,
onClick: () => handleAddLayer('folder'),
},
{
id: 'layer-new-screentone',
- label: 'New Screentone Layer...',
+ label: t('New Screentone Layer...'),
disabled: !hasOpenDocument || !handleFillScreentone,
onClick: () => handleFillScreentone?.(),
},
{
id: 'layer-new-3d',
- label: 'New 3D Reference Layer...',
+ label: t('New 3D Reference Layer...'),
disabled: !hasOpenDocument,
onClick: () => {
toolStoreActions.selectTool('3d');
@@ -669,47 +671,47 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'layer-new-adjustment',
- label: 'New Adjustment Layer',
+ label: t('New Adjustment Layer'),
disabled: !hasOpenDocument,
submenu: [
{
id: 'layer-adj-curves',
- label: 'Tone Curves...',
+ label: t('Tone Curves...'),
onClick: () => handleOpenAdjustmentModal(undefined, 'curves'),
},
{
id: 'layer-adj-gradient-map',
- label: 'Gradient Map...',
+ label: t('Gradient Map...'),
onClick: () => handleOpenAdjustmentModal(undefined, 'gradient-map'),
},
{
id: 'layer-adj-levels',
- label: 'Levels...',
+ label: t('Levels...'),
onClick: () => handleOpenAdjustmentModal(undefined, 'levels'),
},
{
id: 'layer-adj-color-balance',
- label: 'Color Balance...',
+ label: t('Color Balance...'),
onClick: () => handleOpenAdjustmentModal(undefined, 'color-balance'),
},
],
},
{
id: 'layer-mask-submenu',
- label: 'Layer Mask',
+ label: t('Layer Mask'),
disabled: !hasOpenDocument || !activeLayer || activeLayer.type === 'folder',
submenu: [
{
id: 'layer-mask-add',
label: activeLayer?.maskCanvas
- ? 'Mask Already Present'
- : 'Add Layer Mask (Reveal All)',
+ ? t('Mask Already Present')
+ : t('Add Layer Mask (Reveal All)'),
disabled: Boolean(activeLayer?.maskCanvas),
onClick: () => addLayerMask(activeLayerId),
},
{
id: 'layer-mask-delete',
- label: 'Delete Layer Mask',
+ label: t('Delete Layer Mask'),
danger: true,
disabled: !activeLayer?.maskCanvas,
onClick: () => removeLayerMask(activeLayerId),
@@ -717,7 +719,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'layer-mask-toggle',
label:
- activeLayer?.maskEnabled === false ? 'Enable Layer Mask' : 'Disable Layer Mask',
+ activeLayer?.maskEnabled === false ? t('Enable Layer Mask') : t('Disable Layer Mask'),
disabled: !activeLayer?.maskCanvas,
onClick: () => toggleLayerMask(activeLayerId),
},
@@ -725,8 +727,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
id: 'layer-mask-link',
label:
activeLayer?.maskLinked === false
- ? 'Link Mask to Layer'
- : 'Unlink Mask from Layer',
+ ? t('Link Mask to Layer')
+ : t('Unlink Mask from Layer'),
disabled: !activeLayer?.maskCanvas,
onClick: () => toggleMaskLinked(activeLayerId),
},
@@ -734,13 +736,13 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'layer-new-frame-folder',
- label: 'New Frame Border Folder',
+ label: t('New Frame Border Folder'),
disabled: !hasOpenDocument || !handleAddDefaultFrameFolder,
onClick: () => handleAddDefaultFrameFolder?.(),
},
{
id: 'layer-rasterize',
- label: 'Rasterize Layer',
+ label: t('Rasterize Layer'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -751,20 +753,20 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'layer-duplicate',
- label: 'Duplicate Layer',
+ label: t('Duplicate Layer'),
shortcut: 'Ctrl+J',
disabled: !hasOpenDocument || !activeLayer,
onClick: () => duplicateLayer(activeLayerId),
},
{
id: 'layer-merge-down',
- label: 'Merge with Layer Below',
+ label: t('Merge with Layer Below'),
disabled: !hasOpenDocument || !activeLayer || activeLayer.type !== 'raster' || layers.length <= 1,
onClick: handleMergeDown,
},
{
id: 'layer-merge-folder',
- label: 'Merge Folder',
+ label: t('Merge Folder'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -776,7 +778,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'layer-div-effects', label: '', divider: true },
{
id: 'layer-styles',
- label: 'Layer Style (Stroke, Shadow, Glow)...',
+ label: t('Layer Style (Stroke, Shadow, Glow)...'),
disabled:
!hasOpenDocument ||
!activeLayer ||
@@ -787,37 +789,37 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'layer-toggle-tone',
label: activeLayer?.toneEnabled
- ? 'Disable Screentone'
- : 'Enable Screentone',
+ ? t('Disable Screentone')
+ : t('Enable Screentone'),
disabled: !hasOpenDocument || !activeLayer || isFolderLikeLayer(activeLayer) || !toggleTone,
onClick: () => toggleTone?.(activeLayerId),
},
{
id: 'layer-toggle-tint',
label: activeLayer?.layerColorEnabled
- ? 'Disable Layer Color (Tint)'
- : 'Enable Layer Color (Tint)',
+ ? t('Disable Layer Color (Tint)')
+ : t('Enable Layer Color (Tint)'),
disabled: !hasOpenDocument || !activeLayer || isFolderLikeLayer(activeLayer),
onClick: () => toggleLayerColor(activeLayerId),
},
{
id: 'layer-convert-submenu',
- label: 'Convert Expression Color',
+ label: t('Convert Expression Color'),
disabled: !hasOpenDocument || !activeLayer || isFolderLikeLayer(activeLayer),
submenu: [
{
id: 'layer-convert-color',
- label: 'Color (RGB)',
+ label: t('Color (RGB)'),
onClick: () => handleConvertLayer(activeLayerId, 'color'),
},
{
id: 'layer-convert-gray',
- label: 'Gray (Grayscale)',
+ label: t('Gray (Grayscale)'),
onClick: () => handleConvertLayer(activeLayerId, 'gray'),
},
{
id: 'layer-convert-monochrome',
- label: 'Monochrome (1-bit B&W)',
+ label: t('Monochrome (1-bit B&W)'),
onClick: () => handleConvertLayer(activeLayerId, 'monochrome'),
},
],
@@ -825,60 +827,60 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'layer-div-ruler', label: '', divider: true },
{
id: 'layer-perspective-ruler',
- label: 'Perspective Ruler',
+ label: t('Perspective Ruler'),
disabled: !hasOpenDocument,
submenu: !perspectiveRuler
? [
{
id: 'layer-add-ruler-1p',
- label: 'Add 1-Point Perspective Ruler',
+ label: t('Add 1-Point Perspective Ruler'),
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('1-point', dimensions)
);
- showToast('1-Point Perspective Ruler added to canvas');
+ showToast(t('1-Point Perspective Ruler added to canvas'));
},
},
{
id: 'layer-add-ruler-2p',
- label: 'Add 2-Point Perspective Ruler',
+ label: t('Add 2-Point Perspective Ruler'),
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('2-point', dimensions)
);
- showToast('2-Point Perspective Ruler added to canvas');
+ showToast(t('2-Point Perspective Ruler added to canvas'));
},
},
{
id: 'layer-add-ruler-3p-birds',
- label: "Add 3-Point Perspective Ruler (Bird's-Eye)",
+ label: t("Add 3-Point Perspective Ruler (Bird's-Eye)"),
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('3-point', dimensions)
);
- showToast("3-Point Perspective Ruler (Bird's-Eye) added to canvas");
+ showToast(t("3-Point Perspective Ruler (Bird's-Eye) added to canvas"));
},
},
{
id: 'layer-add-ruler-3p-worms',
- label: "Add 3-Point Perspective Ruler (Worm's-Eye)",
+ label: t("Add 3-Point Perspective Ruler (Worm's-Eye)"),
onClick: () => {
const base = createDefaultPerspectiveRuler('3-point', dimensions);
documentStoreActions.setPerspectiveRuler(
applyWormsEyePreset(base, dimensions)
);
- showToast("3-Point Perspective Ruler (Worm's-Eye) added to canvas");
+ showToast(t("3-Point Perspective Ruler (Worm's-Eye) added to canvas"));
},
},
]
: [
{
id: 'layer-remove-ruler',
- label: 'Remove Perspective Ruler from Canvas',
+ label: t('Remove Perspective Ruler from Canvas'),
danger: true,
onClick: () => {
documentStoreActions.setPerspectiveRuler(null);
- showToast('Removed perspective ruler from canvas');
+ showToast(t('Removed perspective ruler from canvas'));
},
},
],
@@ -886,7 +888,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'layer-div-delete', label: '', divider: true },
{
id: 'layer-delete',
- label: 'Delete Layer',
+ label: t('Delete Layer'),
danger: true,
disabled: !hasOpenDocument || layers.length <= 1,
onClick: () => deleteLayer(activeLayerId),
@@ -895,32 +897,32 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'filter',
- label: 'Filter',
+ label: t('Filter'),
items: [
{
id: 'filter-gaussian-blur',
- label: 'Gaussian Blur...',
+ label: t('Gaussian Blur...'),
disabled:
!hasOpenDocument || !activeLayer || activeLayer.type !== 'raster' || activeLayer.locked,
onClick: () => uiStoreActions.openFilterModal('gaussian-blur'),
},
{
id: 'filter-motion-blur',
- label: 'Motion Blur...',
+ label: t('Motion Blur...'),
disabled:
!hasOpenDocument || !activeLayer || activeLayer.type !== 'raster' || activeLayer.locked,
onClick: () => uiStoreActions.openFilterModal('motion-blur'),
},
{
id: 'filter-unsharp-mask',
- label: 'Unsharp Mask...',
+ label: t('Unsharp Mask...'),
disabled:
!hasOpenDocument || !activeLayer || activeLayer.type !== 'raster' || activeLayer.locked,
onClick: () => uiStoreActions.openFilterModal('unsharp-mask'),
},
{
id: 'filter-film-grain',
- label: 'Film Grain...',
+ label: t('Film Grain...'),
disabled:
!hasOpenDocument || !activeLayer || activeLayer.type !== 'raster' || activeLayer.locked,
onClick: () => uiStoreActions.openFilterModal('film-grain'),
@@ -929,52 +931,52 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler',
- label: 'Ruler',
+ label: t('Ruler'),
items: !perspectiveRuler
? [
{
id: 'ruler-add-1p',
- label: 'Add 1-Point Perspective Ruler',
+ label: t('Add 1-Point Perspective Ruler'),
disabled: !hasOpenDocument,
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('1-point', dimensions)
);
- showToast('1-Point Perspective Ruler added to canvas');
+ showToast(t('1-Point Perspective Ruler added to canvas'));
},
},
{
id: 'ruler-add-2p',
- label: 'Add 2-Point Perspective Ruler',
+ label: t('Add 2-Point Perspective Ruler'),
disabled: !hasOpenDocument,
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('2-point', dimensions)
);
- showToast('2-Point Perspective Ruler added to canvas');
+ showToast(t('2-Point Perspective Ruler added to canvas'));
},
},
{
id: 'ruler-add-3p-birds',
- label: "Add 3-Point Perspective Ruler (Bird's-Eye)",
+ label: t("Add 3-Point Perspective Ruler (Bird's-Eye)"),
disabled: !hasOpenDocument,
onClick: () => {
documentStoreActions.setPerspectiveRuler(
createDefaultPerspectiveRuler('3-point', dimensions)
);
- showToast("3-Point Perspective Ruler (Bird's-Eye) added to canvas");
+ showToast(t("3-Point Perspective Ruler (Bird's-Eye) added to canvas"));
},
},
{
id: 'ruler-add-3p-worms',
- label: "Add 3-Point Perspective Ruler (Worm's-Eye)",
+ label: t("Add 3-Point Perspective Ruler (Worm's-Eye)"),
disabled: !hasOpenDocument,
onClick: () => {
const base = createDefaultPerspectiveRuler('3-point', dimensions);
documentStoreActions.setPerspectiveRuler(
applyWormsEyePreset(base, dimensions)
);
- showToast("3-Point Perspective Ruler (Worm's-Eye) added to canvas");
+ showToast(t("3-Point Perspective Ruler (Worm's-Eye) added to canvas"));
},
},
]
@@ -982,8 +984,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'ruler-toggle-visibility',
label: perspectiveRuler.enabled
- ? 'Hide Perspective Ruler'
- : 'Show Perspective Ruler',
+ ? t('Hide Perspective Ruler')
+ : t('Show Perspective Ruler'),
shortcut: 'Ctrl+Shift+R',
disabled: !hasOpenDocument,
onClick: () =>
@@ -993,7 +995,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-toggle-snap',
- label: perspectiveRuler.snapEnabled ? 'Disable Snapping' : 'Enable Snapping',
+ label: perspectiveRuler.snapEnabled ? t('Disable Snapping') : t('Enable Snapping'),
shortcut: 'Ctrl+Shift+P',
disabled: !hasOpenDocument,
onClick: () =>
@@ -1004,8 +1006,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'ruler-toggle-lock',
label: perspectiveRuler.locked
- ? 'Unlock Handles (Edit Mode)'
- : 'Lock Handles (Freeze for Inking)',
+ ? t('Unlock Handles (Edit Mode)')
+ : t('Lock Handles (Freeze for Inking)'),
disabled: !hasOpenDocument,
onClick: () =>
documentStoreActions.setPerspectiveRuler((prev) =>
@@ -1014,11 +1016,11 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-line-count',
- label: `Guide Rays (${perspectiveRuler.guideRayCount || 6} lines)`,
+ label: t('Guide Rays ({count} lines)', { count: perspectiveRuler.guideRayCount || 6 }),
disabled: !hasOpenDocument,
submenu: [2, 4, 6, 8, 12, 16].map((count) => ({
id: `ruler-rays-${count}`,
- label: `${count} Rays per VP`,
+ label: t('{count} Rays per VP', { count }),
checked: (perspectiveRuler.guideRayCount || 6) === count,
onClick: () =>
documentStoreActions.setPerspectiveRuler((prev) =>
@@ -1028,12 +1030,12 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-presets',
- label: 'Change Perspective Preset',
+ label: t('Change Perspective Preset'),
disabled: !hasOpenDocument,
submenu: [
{
id: 'ruler-preset-1p',
- label: '1-Point Perspective (Center)',
+ label: t('1-Point Perspective (Center)'),
onClick: () => {
const next = createDefaultPerspectiveRuler('1-point', dimensions);
next.snapEnabled = perspectiveRuler.snapEnabled;
@@ -1044,7 +1046,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-preset-2p',
- label: '2-Point Perspective (Wide Street)',
+ label: t('2-Point Perspective (Wide Street)'),
onClick: () => {
const next = createDefaultPerspectiveRuler('2-point', dimensions);
next.snapEnabled = perspectiveRuler.snapEnabled;
@@ -1055,7 +1057,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-preset-3p-birds',
- label: "3-Point Perspective (Bird's-Eye)",
+ label: t("3-Point Perspective (Bird's-Eye)"),
onClick: () => {
const next = createDefaultPerspectiveRuler('3-point', dimensions);
next.snapEnabled = perspectiveRuler.snapEnabled;
@@ -1066,7 +1068,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'ruler-preset-3p-worms',
- label: "3-Point Perspective (Worm's-Eye)",
+ label: t("3-Point Perspective (Worm's-Eye)"),
onClick: () => {
const base = createDefaultPerspectiveRuler('3-point', dimensions);
base.guideRayCount = perspectiveRuler.guideRayCount;
@@ -1080,51 +1082,51 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'ruler-div-remove', label: '', divider: true },
{
id: 'ruler-remove',
- label: 'Remove Perspective Ruler from Canvas',
+ label: t('Remove Perspective Ruler from Canvas'),
danger: true,
disabled: !hasOpenDocument,
onClick: () => {
documentStoreActions.setPerspectiveRuler(null);
- showToast('Removed perspective ruler from canvas');
+ showToast(t('Removed perspective ruler from canvas'));
},
},
],
},
{
id: 'view',
- label: 'View',
+ label: t('View'),
items: [
{
id: 'view-zoom-in',
- label: 'Zoom In',
+ label: t('Zoom In'),
shortcut: 'Ctrl++',
disabled: !hasOpenDocument,
onClick: zoomIn,
},
{
id: 'view-zoom-out',
- label: 'Zoom Out',
+ label: t('Zoom Out'),
shortcut: 'Ctrl+-',
disabled: !hasOpenDocument,
onClick: zoomOut,
},
{
id: 'view-reset-zoom',
- label: 'Reset Zoom & Center',
+ label: t('Reset Zoom & Center'),
shortcut: 'Ctrl+0',
disabled: !hasOpenDocument,
onClick: resetZoomAndCenter,
},
{
id: 'view-zoom-100',
- label: 'Reset Zoom to 100%',
+ label: t('Reset Zoom to 100%'),
shortcut: 'Ctrl+1',
disabled: !hasOpenDocument,
onClick: resetZoomTo100,
},
{
id: 'view-reset-rotation',
- label: 'Reset Rotation',
+ label: t('Reset Rotation'),
shortcut: 'Ctrl+Alt+0',
disabled: !hasOpenDocument,
onClick: resetRotation,
@@ -1132,7 +1134,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'view-div-flip', label: '', divider: true },
{
id: 'view-flip-horizontal',
- label: 'Flip View Horizontal',
+ label: t('Flip View Horizontal'),
shortcut: 'Shift+H',
checked: flipX,
disabled: !hasOpenDocument,
@@ -1140,7 +1142,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'view-flip-vertical',
- label: 'Flip View Vertical',
+ label: t('Flip View Vertical'),
shortcut: 'Shift+V',
checked: flipY,
disabled: !hasOpenDocument,
@@ -1148,53 +1150,53 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'view-reset-flip',
- label: 'Reset View Flip',
+ label: t('Reset View Flip'),
disabled: !hasOpenDocument || (!flipX && !flipY),
onClick: resetViewFlip,
},
{ id: 'view-div-value-check', label: '', divider: true },
{
id: 'view-value-check',
- label: 'Value Check (Live B/W)',
+ label: t('Value Check (Live B/W)'),
shortcut: 'Shift+Y',
checked: valueCheckEnabled,
disabled: !hasOpenDocument,
onClick: () => {
const enabled = documentStoreActions.toggleValueCheck();
- showToast(enabled ? 'Value Check (Live B/W): ON' : 'Value Check (Live B/W): OFF');
+ showToast(enabled ? t('Value Check (Live B/W): ON') : t('Value Check (Live B/W): OFF'));
},
},
{
id: 'view-navigator-preview-mode',
- label: 'Navigator Preview Mode',
+ label: t('Navigator Preview Mode'),
disabled: !hasOpenDocument,
submenu: [
{
id: 'view-nav-mode-color',
- label: 'Color',
+ label: t('Color'),
checked: navigatorPreviewMode === 'color',
onClick: () => {
workspaceStoreActions.setNavigatorPreviewMode('color');
- showToast('Navigator Preview: Color');
+ showToast(t('Navigator Preview: Color'));
},
},
{
id: 'view-nav-mode-bw',
- label: 'Live B/W Tone Preview',
+ label: t('Live B/W Tone Preview'),
checked: navigatorPreviewMode === 'bw',
onClick: () => {
workspaceStoreActions.setNavigatorPreviewMode('bw');
- showToast('Navigator Preview: Live B/W Tone');
+ showToast(t('Navigator Preview: Live B/W Tone'));
},
},
{
id: 'view-nav-mode-split',
- label: 'Split View (Color | B/W)',
+ label: t('Split View (Color | B/W)'),
shortcut: 'Alt+Shift+Y',
checked: navigatorPreviewMode === 'split',
onClick: () => {
workspaceStoreActions.setNavigatorPreviewMode('split');
- showToast('Navigator Preview: Split View (Color | B/W)');
+ showToast(t('Navigator Preview: Split View (Color | B/W)'));
},
},
],
@@ -1202,18 +1204,18 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'view-div-ruler', label: '', divider: true },
{
id: 'view-straight-ruler',
- label: straightRuler?.enabled ? 'Hide Straight Ruler' : 'Straight Ruler',
+ label: straightRuler?.enabled ? t('Hide Straight Ruler') : t('Straight Ruler'),
shortcut: 'R',
checked: Boolean(straightRuler?.enabled),
disabled: !hasOpenDocument,
onClick: () => {
const next = documentStoreActions.toggleStraightRuler();
- showToast(next.enabled ? 'Straight Ruler: ON' : 'Straight Ruler: OFF');
+ showToast(next.enabled ? t('Straight Ruler: ON') : t('Straight Ruler: OFF'));
},
},
{
id: 'view-lock-straight-ruler',
- label: straightRuler?.locked ? 'Unlock Straight Ruler' : 'Lock Straight Ruler',
+ label: straightRuler?.locked ? t('Unlock Straight Ruler') : t('Lock Straight Ruler'),
checked: Boolean(straightRuler?.locked),
disabled: !hasOpenDocument || !straightRuler?.enabled,
onClick: () =>
@@ -1224,8 +1226,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'view-toggle-ruler',
label: perspectiveRuler?.enabled
- ? 'Hide Perspective Ruler'
- : 'Show Perspective Ruler',
+ ? t('Hide Perspective Ruler')
+ : t('Show Perspective Ruler'),
shortcut: 'Ctrl+Shift+R',
disabled: !hasOpenDocument || !perspectiveRuler,
onClick: () =>
@@ -1236,8 +1238,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'view-toggle-snap',
label: perspectiveRuler?.snapEnabled
- ? 'Disable Perspective Snapping'
- : 'Enable Perspective Snapping',
+ ? t('Disable Perspective Snapping')
+ : t('Enable Perspective Snapping'),
shortcut: 'Ctrl+Shift+P',
disabled: !hasOpenDocument || !perspectiveRuler,
onClick: () =>
@@ -1249,15 +1251,15 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'view-webtoon-mode',
label: isWebtoonMode
- ? 'Exit Webtoon Studio Mode'
- : 'Webtoon Studio Mode (9:16 Mockup)',
+ ? t('Exit Webtoon Studio Mode')
+ : t('Webtoon Studio Mode (9:16 Mockup)'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.toggleWebtoonMode(),
},
{ id: 'view-div-soft-proof', label: '', divider: true },
{
id: 'view-proof-setup',
- label: 'Proof Setup',
+ label: t('Proof Setup'),
disabled: !hasOpenDocument,
submenu: (
[
@@ -1279,14 +1281,14 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
] as const
).map((opt) => ({
id: opt.id,
- label: opt.label,
+ label: t(opt.label),
checked: softProofSettings.standard === opt.standard,
onClick: () => documentStoreActions.setProofStandard(opt.standard),
})),
},
{
id: 'view-proof-colors',
- label: 'Proof Colors',
+ label: t('Proof Colors'),
shortcut: 'Ctrl+Alt+Y',
checked: softProofSettings.enabled,
disabled: !hasOpenDocument,
@@ -1294,7 +1296,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'view-gamut-warning',
- label: 'Gamut Warning',
+ label: t('Gamut Warning'),
shortcut: 'Ctrl+Shift+Y',
checked: softProofSettings.gamutWarning,
disabled: !hasOpenDocument,
@@ -1304,23 +1306,23 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'manga',
- label: 'Manga',
+ label: t('Manga'),
items: [
{
id: 'manga-effects-generator',
- label: 'Manga Effect Lines Generator...',
+ label: t('Manga Effect Lines Generator...'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.setMangaEffectsModalOpen(true),
},
{
id: 'manga-balloon-tool',
- label: 'Parametric Speech Balloon Tool',
+ label: t('Parametric Speech Balloon Tool'),
disabled: !hasOpenDocument,
onClick: () => toolStoreActions.selectTool('balloon'),
},
{
id: 'manga-correct-line',
- label: 'Correct Line (Vector Pinch/Width/Simplify)',
+ label: t('Correct Line (Vector Pinch/Width/Simplify)'),
disabled: !hasOpenDocument,
onClick: () => toolStoreActions.selectTool('vector-edit'),
},
@@ -1328,14 +1330,14 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'manga-webtoon-toggle',
label: isWebtoonMode
- ? 'Exit Webtoon Studio Mode'
- : 'Webtoon Studio Mode (9:16 Simulator)',
+ ? t('Exit Webtoon Studio Mode')
+ : t('Webtoon Studio Mode (9:16 Simulator)'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.toggleWebtoonMode(),
},
{
id: 'manga-webtoon-export',
- label: 'Export Webtoon Chapter Slices (.zip)...',
+ label: t('Export Webtoon Chapter Slices (.zip)...'),
disabled: !hasOpenDocument,
onClick: () => uiStoreActions.setWebtoonExportModalOpen(true),
},
@@ -1343,13 +1345,13 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'animation',
- label: 'Animation',
+ label: t('Animation'),
items: [
{
id: 'anim-toggle-timeline',
label: activeAnimationTimeline
- ? 'Hide Animation Timeline'
- : 'Show Animation Timeline',
+ ? t('Hide Animation Timeline')
+ : t('Show Animation Timeline'),
shortcut: 'Ctrl+Alt+A',
disabled: !hasOpenDocument,
onClick: () => {
@@ -1362,7 +1364,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'anim-new-cel',
- label: 'Add Cel to Current Frame',
+ label: t('Add Cel to Current Frame'),
shortcut: 'Alt+C',
disabled: !hasOpenDocument || !activeAnimationTimeline,
onClick: () => {
@@ -1374,8 +1376,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{
id: 'anim-toggle-onion',
label: activeAnimationTimeline?.onionSkin.enabled
- ? 'Disable Onion Skinning'
- : 'Enable Onion Skinning',
+ ? t('Disable Onion Skinning')
+ : t('Enable Onion Skinning'),
disabled: !hasOpenDocument || !activeAnimationTimeline,
onClick: () => {
if (activeAnimationTimeline) {
@@ -1393,15 +1395,15 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'window',
- label: 'Window',
+ label: t('Window'),
items: [
{
id: 'window-workspace',
- label: 'Workspace',
+ label: t('Workspace'),
submenu: [
...BUILT_IN_WORKSPACE_PRESET_IDS.map((preset) => ({
id: `window-preset-${preset}`,
- label: WORKSPACE_PRESET_LABELS[preset],
+ label: td(WORKSPACE_PRESET_LABELS[preset]),
checked: activePreset === preset && !activeSavedWorkspaceId,
onClick: () => workspaceStoreActions.applyPreset(preset),
})),
@@ -1414,7 +1416,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
checked: activeSavedWorkspaceId === ws.id,
onClick: () => {
workspaceStoreActions.loadCustomWorkspace(ws.id);
- showToast(`Loaded workspace "${ws.name}"`);
+ showToast(t('Loaded workspace "{name}"', { name: ws.name }));
},
})),
]
@@ -1422,66 +1424,66 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'window-ws-div-1', label: '', divider: true },
{
id: 'window-ws-left-handed',
- label: 'Left-Handed Workspace Mirror',
+ label: t('Left-Handed Workspace Mirror'),
checked: leftHandedMode,
onClick: () => {
const next = workspaceStoreActions.toggleLeftHandedMode();
showToast(
- next ? 'Left-Handed Workspace Mirror: ON' : 'Left-Handed Workspace Mirror: OFF'
+ next ? t('Left-Handed Workspace Mirror: ON') : t('Left-Handed Workspace Mirror: OFF')
);
},
},
{
id: 'window-ws-save-custom',
- label: 'Register Current Layout as Custom',
+ label: t('Register Current Layout as Custom'),
onClick: () => {
workspaceStoreActions.saveAsCustomPreset();
- showToast('Workspace saved to Custom preset');
+ showToast(t('Workspace saved to Custom preset'));
},
},
{
id: 'window-ws-reset',
- label: 'Reset Workspace',
+ label: t('Reset Workspace'),
onClick: () => {
workspaceStoreActions.resetWorkspace();
- showToast('Workspace reset to preset defaults');
+ showToast(t('Workspace reset to preset defaults'));
},
},
],
},
{
id: 'window-palette-locks',
- label: 'Palette Locks',
+ label: t('Palette Locks'),
submenu: [
{
id: 'window-lock-all',
label:
workspaceLocks.lockWidth && workspaceLocks.lockHeight && workspaceLocks.lockMove
- ? 'Unlock All Palettes'
- : 'Lock All Palettes',
+ ? t('Unlock All Palettes')
+ : t('Lock All Palettes'),
checked:
workspaceLocks.lockWidth && workspaceLocks.lockHeight && workspaceLocks.lockMove,
onClick: () => {
const locked = workspaceStoreActions.toggleLockAllWorkspace();
- showToast(locked ? 'All palette locks: ON' : 'All palette locks: OFF');
+ showToast(locked ? t('All palette locks: ON') : t('All palette locks: OFF'));
},
},
{ id: 'window-lock-div', label: '', divider: true },
{
id: 'window-lock-width',
- label: 'Lock Width',
+ label: t('Lock Width'),
checked: workspaceLocks.lockWidth,
onClick: () => workspaceStoreActions.toggleWorkspaceLock('lockWidth'),
},
{
id: 'window-lock-height',
- label: 'Lock Height',
+ label: t('Lock Height'),
checked: workspaceLocks.lockHeight,
onClick: () => workspaceStoreActions.toggleWorkspaceLock('lockHeight'),
},
{
id: 'window-lock-move',
- label: 'Lock Position / Move',
+ label: t('Lock Position / Move'),
checked: workspaceLocks.lockMove,
onClick: () => workspaceStoreActions.toggleWorkspaceLock('lockMove'),
},
@@ -1489,14 +1491,14 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'window-toggle-palettes',
- label: palettesHidden ? 'Show Palettes' : 'Hide Palettes',
+ label: palettesHidden ? t('Show Palettes') : t('Hide Palettes'),
shortcut: 'Tab',
checked: !palettesHidden,
onClick: () => workspaceStoreActions.togglePalettesHidden(),
},
{
id: 'window-toggle-quick-brushes',
- label: 'Quick-Access Brush Panel',
+ label: t('Quick-Access Brush Panel'),
shortcut: 'Shift+B',
checked: quickBrushPanelVisible,
onClick: () => workspaceStoreActions.toggleQuickBrushPanelVisible(),
@@ -1504,39 +1506,39 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'window-div-palettes', label: '', divider: true },
...ALL_DOCK_PANEL_IDS.map((pid) => ({
id: `window-panel-${pid}`,
- label: DOCK_PANEL_META[pid].title,
+ label: td(DOCK_PANEL_META[pid].title),
checked: visiblePanels.has(pid),
onClick: () => workspaceStoreActions.togglePanelVisibility(pid),
})),
{ id: 'window-div-bars', label: '', divider: true },
{
id: 'window-toggle-tool-options-bar',
- label: 'Contextual Tool Options Bar',
+ label: t('Contextual Tool Options Bar'),
checked: showToolOptionsBar,
onClick: () => workspaceStoreActions.setShowToolOptionsBar(!showToolOptionsBar),
},
{
id: 'window-toggle-command-bar',
- label: 'Command Bar',
+ label: t('Command Bar'),
checked: showCommandBar,
onClick: () => workspaceStoreActions.setShowCommandBar(!showCommandBar),
},
{
id: 'window-toggle-doc-tabs',
- label: 'Document Tab Bar',
+ label: t('Document Tab Bar'),
checked: showDocumentTabs,
onClick: () => workspaceStoreActions.setShowDocumentTabs(!showDocumentTabs),
},
{
id: 'window-toggle-status-bar',
- label: 'Status Bar',
+ label: t('Status Bar'),
checked: showStatusBar,
onClick: () => workspaceStoreActions.setShowStatusBar(!showStatusBar),
},
{ id: 'window-div-appearance', label: '', divider: true },
{
id: 'window-appearance-studio',
- label: 'Appearance Studio...',
+ label: t('Appearance Studio...'),
checked: isAppearanceStudioOpen,
onClick: () => uiStoreActions.toggleAppearanceStudio(),
},
@@ -1544,13 +1546,13 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
},
{
id: 'help',
- label: 'Help',
+ label: t('Help'),
items: [
...(isTauriEnvironment()
? [
{
id: 'help-check-updates',
- label: 'Check for Updates...',
+ label: t('Check for Updates...'),
onClick: () => {
updaterService.openUpdateModal();
const st = useUpdaterStore.getState().status;
@@ -1564,7 +1566,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
: []),
...COMMUNITY_LINKS.map((link) => ({
id: `help-${link.id}`,
- label: link.menuLabel,
+ label: td(link.menuLabel),
icon: link.renderIcon(
'w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors'
),
@@ -1575,7 +1577,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
})),
{
id: 'help-issues',
- label: 'Report an Issue',
+ label: t('Report an Issue'),
icon: (
<Bug className="w-3.5 h-3.5 text-ui-icon-muted group-hover:text-ui-primary transition-colors" />
),
@@ -1587,7 +1589,7 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
{ id: 'help-div-discord', label: '', divider: true },
{
id: 'help-about',
- label: 'About Ink Studio',
+ label: t('About Ink Studio'),
onClick: () => {
uiStoreActions.setAboutModalOpen(true);
},
@@ -1675,6 +1677,8 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
softProofSettings.enabled,
softProofSettings.gamutWarning,
softProofSettings.standard,
+ t,
+ td,
toggleFlipHorizontal,
toggleFlipVertical,
toggleLayerColor,
diff --git a/src/hooks/useCanvasDrawing.ts b/src/hooks/useCanvasDrawing.ts
index 660b619..cf119d6 100644
--- a/src/hooks/useCanvasDrawing.ts
+++ b/src/hooks/useCanvasDrawing.ts
@@ -1,4 +1,4 @@
-import { useRef, useEffect, useCallback, useState } from 'react';
+import { useRef, useCallback, useState } from 'react';
import {
LastStrokeEndState,
UseCanvasDrawingProps,
@@ -33,6 +33,7 @@ export function useCanvasDrawing({
layers,
onUpdateLayerThumbnail,
onApplyLayerTreeDelta,
+ onApplyDocumentStateDelta,
isMaskMode = false,
onUpdateMaskThumbnail,
draftCanvasRef,
@@ -79,10 +80,10 @@ export function useCanvasDrawing({
const activeLayerVisibleRef = useRef(activeLayerVisible);
const dimensionsRef = useRef(dimensions);
const selectionRef = useRef(selection);
- selectionRef.current = selection;
const isMaskModeRef = useRef(isMaskMode);
const layersRef = useRef(layers);
const onApplyLayerTreeDeltaRef = useRef(onApplyLayerTreeDelta);
+ const onApplyDocumentStateDeltaRef = useRef(onApplyDocumentStateDelta);
const onUpdateMaskThumbnailRef = useRef(onUpdateMaskThumbnail);
const onCollabStrokeStartRef = useRef(onCollabStrokeStart);
const onCollabStrokeChunkRef = useRef(onCollabStrokeChunk);
@@ -92,60 +93,35 @@ export function useCanvasDrawing({
const straightRulerRef = useRef(straightRuler);
const onActiveConstraintAxisChangeRef = useRef(onActiveConstraintAxisChange);
- useEffect(() => {
- if (!navigation) {
- fallbackPanRef.current = pan;
- fallbackZoomRef.current = zoom;
- fallbackRotationRef.current = rotation;
- fallbackFlipXRef.current = flipX;
- fallbackFlipYRef.current = flipY;
- }
- toolOverrideRef.current = tool;
- brushSettingsOverrideRef.current = brushSettings;
- colorModeRef.current = colorMode;
- activeLayerIdRef.current = activeLayerId;
- activeLayerLockedRef.current = activeLayerLocked;
- activeLayerVisibleRef.current = activeLayerVisible;
- dimensionsRef.current = dimensions;
- selectionRef.current = selection;
- isMaskModeRef.current = isMaskMode;
- layersRef.current = layers;
- onApplyLayerTreeDeltaRef.current = onApplyLayerTreeDelta;
- onUpdateMaskThumbnailRef.current = onUpdateMaskThumbnail;
- onCollabStrokeStartRef.current = onCollabStrokeStart;
- onCollabStrokeChunkRef.current = onCollabStrokeChunk;
- onCollabStrokeFinishRef.current = onCollabStrokeFinish;
- onCollabCursorMoveRef.current = onCollabCursorMove;
- rulerRef.current = perspectiveRuler;
- straightRulerRef.current = straightRuler;
- onActiveConstraintAxisChangeRef.current = onActiveConstraintAxisChange;
- }, [
- navigation,
- pan,
- zoom,
- rotation,
- flipX,
- flipY,
- tool,
- brushSettings,
- colorMode,
- activeLayerId,
- activeLayerLocked,
- activeLayerVisible,
- dimensions,
- selection,
- isMaskMode,
- layers,
- onApplyLayerTreeDelta,
- onUpdateMaskThumbnail,
- onCollabStrokeStart,
- onCollabStrokeChunk,
- onCollabStrokeFinish,
- onCollabCursorMove,
- perspectiveRuler,
- straightRuler,
- onActiveConstraintAxisChange,
- ]);
+ // Sync imperatively-read refs synchronously during render so native tablet channels and
+ // immediate pointerdown events after layer create/delete/switch never observe stale values.
+ if (!navigation) {
+ fallbackPanRef.current = pan;
+ fallbackZoomRef.current = zoom;
+ fallbackRotationRef.current = rotation;
+ fallbackFlipXRef.current = flipX;
+ fallbackFlipYRef.current = flipY;
+ }
+ toolOverrideRef.current = tool;
+ brushSettingsOverrideRef.current = brushSettings;
+ colorModeRef.current = colorMode;
+ activeLayerIdRef.current = activeLayerId;
+ activeLayerLockedRef.current = activeLayerLocked;
+ activeLayerVisibleRef.current = activeLayerVisible;
+ dimensionsRef.current = dimensions;
+ selectionRef.current = selection;
+ isMaskModeRef.current = isMaskMode;
+ layersRef.current = layers;
+ onApplyLayerTreeDeltaRef.current = onApplyLayerTreeDelta;
+ onApplyDocumentStateDeltaRef.current = onApplyDocumentStateDelta;
+ onUpdateMaskThumbnailRef.current = onUpdateMaskThumbnail;
+ onCollabStrokeStartRef.current = onCollabStrokeStart;
+ onCollabStrokeChunkRef.current = onCollabStrokeChunk;
+ onCollabStrokeFinishRef.current = onCollabStrokeFinish;
+ onCollabCursorMoveRef.current = onCollabCursorMove;
+ rulerRef.current = perspectiveRuler;
+ straightRulerRef.current = straightRuler;
+ onActiveConstraintAxisChangeRef.current = onActiveConstraintAxisChange;
const getActiveMaskCanvas = useCallback(
(layerId?: string): HTMLCanvasElement | null => {
@@ -169,6 +145,7 @@ export function useCanvasDrawing({
layersRef,
onUpdateLayerThumbnail,
onApplyLayerTreeDeltaRef,
+ onApplyDocumentStateDeltaRef,
onUpdateMaskThumbnailRef,
isDrawingRef,
lastStrokeEndRef,
@@ -221,6 +198,7 @@ export function useCanvasDrawing({
return {
interactionRef,
isDrawingRef,
+ abortActiveStroke: brushSession.abortActiveStroke,
pushHistoryStep: history.pushHistoryStep,
flushPendingHistoryTasks: history.flushPendingHistoryTasks,
handlePointerDown: brushSession.handlePointerDown,
diff --git a/src/hooks/useCollabSync.ts b/src/hooks/useCollabSync.ts
index 7cde104..5046b3e 100644
--- a/src/hooks/useCollabSync.ts
+++ b/src/hooks/useCollabSync.ts
@@ -79,6 +79,7 @@ import {
} from '../stores';
import { PushHistoryStepFn } from './drawing/types';
import type { CanvasNavigationHandle } from './useCanvasNavigation';
+import { t, td } from '../i18n';
function normalizeAnimForSync(
tl: AnimationTimeline | null,
@@ -524,7 +525,12 @@ export function useCollabSync({
settings: trySettings,
});
setGrabbingPeerId(null);
- showToast(`Trying ${snapshot.peerName}'s "${snapshot.brushName}" brush`);
+ showToast(
+ t('Trying {peerName}\'s "{brushName}" brush', {
+ peerName: snapshot.peerName,
+ brushName: td(snapshot.brushName),
+ })
+ );
};
const { missingHashes, pendingHashes } = hydrateBrushSettingsForLocalUse(
@@ -757,7 +763,7 @@ export function useCollabSync({
pushHistoryStepRef.current?.(
'brush',
- 'Remote Vector Stroke',
+ t('Remote Vector Stroke'),
null,
null,
targetLayerId,
@@ -835,7 +841,7 @@ export function useCollabSync({
syncLayers[0]?.id ||
'layer-1';
- const tabName = (roomName || '').trim() || 'Collab Session';
+ const tabName = (roomName || '').trim() || t('Collab Session');
// Bind documentStore session BEFORE LZ4 BINARY_TILE / BINARY_MASK packets arrive
syncRemoteDocument(
@@ -868,8 +874,8 @@ export function useCollabSync({
documentStoreActions.setDocuments([newDoc]);
documentStoreActions.setActiveDocumentId(newDocId);
documentStoreActions.setDocumentName(tabName);
- documentStoreActions.setPerspectiveRuler(syncPerspectiveRuler);
- documentStoreActions.setStraightRuler(syncStraightRuler);
+ documentStoreActions.setPerspectiveRuler(syncPerspectiveRuler, { recordHistory: false });
+ documentStoreActions.setStraightRuler(syncStraightRuler, { recordHistory: false });
documentStoreActions.setAnimationTimeline(normalizedAnim);
uiStoreActions.setAppView('workspace');
@@ -1026,12 +1032,12 @@ export function useCollabSync({
const handleRemotePerspectiveRuler = useCallback((ruler: PerspectiveRuler | null) => {
lastSyncedPerspectiveRef.current = ruler;
- documentStoreActions.setPerspectiveRuler(ruler);
+ documentStoreActions.setPerspectiveRuler(ruler, { recordHistory: false });
}, []);
const handleRemoteStraightRuler = useCallback((ruler: StraightRuler | null) => {
lastSyncedStraightRef.current = ruler;
- documentStoreActions.setStraightRuler(ruler);
+ documentStoreActions.setStraightRuler(ruler, { recordHistory: false });
}, []);
const handleRemoteAnimationSync = useCallback((timeline: AnimationTimeline | null) => {
@@ -1049,12 +1055,17 @@ export function useCollabSync({
const handleRemoteCanvasResize = useCallback(
(newDims: CanvasDimensions, options: ResizeCanvasOptions) => {
resizeCanvas?.(newDims, options);
- documentStoreActions.setDimensions(newDims);
+ documentStoreActions.setDimensions(newDims, useDocumentStore.getState().activeDocumentId);
resetZoomAndCenter(newDims);
resetHistory?.();
lastSyncedSourceLayersRef.current = layersRef.current;
lastSyncedWireLayersRef.current = layersRef.current.map(serializeLayerForWire);
- showToast(`Canvas resized remotely to ${newDims.width} × ${newDims.height} px`);
+ showToast(
+ t('Canvas resized remotely to {width} × {height} px', {
+ width: newDims.width,
+ height: newDims.height,
+ })
+ );
},
[resizeCanvas, resetZoomAndCenter, resetHistory, showToast]
);
@@ -1137,7 +1148,7 @@ export function useCollabSync({
followingPeerIdRef.current = null;
setFollowingPeerId(null);
if (!silent) {
- showToast(`Stopped following ${prevPeer?.name || 'participant'}`);
+ showToast(t('Stopped following {name}', { name: prevPeer?.name || t('participant') }));
}
},
[clearFollowRaf, mp.peers, showToast]
@@ -1157,7 +1168,7 @@ export function useCollabSync({
ensureFollowGlideLoop();
}
multiplayerService.sendCameraSyncRequest(peerId);
- showToast(`Following ${targetPeer?.name || 'participant'}'s camera`);
+ showToast(t("Following {name}'s camera", { name: targetPeer?.name || t('participant') }));
},
[
mp.isConnected,
@@ -1205,7 +1216,7 @@ export function useCollabSync({
} else {
clearPendingBrushTimers();
setGrabbingPeerId(null);
- showToast("Couldn't fetch that participant's brush yet — try again in a moment");
+ showToast(t("Couldn't fetch that participant's brush yet — try again in a moment"));
}
}
}, 2800);
@@ -1246,7 +1257,7 @@ export function useCollabSync({
brushSettings: sent.brushSettings,
brushAssetRefs: sent.brushAssetRefs,
});
- showToast(`Shared "${brushName}" brush with the room`);
+ showToast(t('Shared "{name}" brush with the room', { name: td(brushName) }));
}
}, [mp.isConnected, mp.appendLocalSharedBrushChat, getLocalShareableBrush, showToast]);
@@ -1257,7 +1268,7 @@ export function useCollabSync({
activeGrabbedBrush.settings.brushName || activeGrabbedBrush.brushName
);
await saveCustomBrush(cspBrush);
- showToast(`Saved "${cspBrush.name}" to Custom Brushes`);
+ showToast(t('Saved "{name}" to Custom Brushes', { name: cspBrush.name }));
setActiveGrabbedBrush(null);
}, [activeGrabbedBrush, showToast]);
@@ -1576,7 +1587,7 @@ export function useCollabSync({
onStatus?: (status: string) => void
) => {
if (!hasOpenDocument) {
- showToast('Please create or open a canvas before hosting a session.');
+ showToast(t('Please create or open a canvas before hosting a session.'));
return false;
}
const finalHostName = (hostNickname || mp.myPeer.name || 'Artist').trim();
@@ -1593,7 +1604,7 @@ export function useCollabSync({
onStatus?: (status: string) => void
) => {
if (!hasOpenDocument) {
- showToast('Please create or open a canvas before hosting a session.');
+ showToast(t('Please create or open a canvas before hosting a session.'));
return false;
}
const finalHostName = (hostNickname || mp.myPeer.name || 'Artist').trim();
@@ -1606,7 +1617,7 @@ export function useCollabSync({
const handleAddLayer = useCallback(
(type: 'raster' | 'folder' | 'vector' = 'raster') => {
if (isSessionActive && !canMutateCanvas(mp.myRole)) {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
const created =
@@ -1633,7 +1644,9 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canDeleteLayer(id, layersRef.current, mp.myPeer.id, mp.myRole);
if (!perm.allowed) {
- showToast(perm.reason || 'You do not have permission to delete this layer');
+ showToast(
+ perm.reason ? td(perm.reason) : t('You do not have permission to delete this layer')
+ );
return;
}
}
@@ -1652,7 +1665,9 @@ export function useCollabSync({
mp.myRole
);
if (allowedIds.length === 0) {
- showToast(blockedReasons[0] || 'Selected layers cannot be deleted');
+ showToast(
+ blockedReasons[0] ? td(blockedReasons[0]) : t('Selected layers cannot be deleted')
+ );
return;
}
if (blockedReasons.length > 0) {
@@ -1660,13 +1675,16 @@ export function useCollabSync({
deleteLayer(allowedId);
}
showToast(
- `Deleted ${allowedIds.length} layer(s); protected ${blockedReasons.length} other user layer(s)`
+ t('Deleted {deleted} layer(s); protected {protected} other user layer(s)', {
+ deleted: allowedIds.length,
+ protected: blockedReasons.length,
+ })
);
return;
}
}
deleteSelectedLayers();
- showToast(`Deleted ${selectedLayerIds.length} layers`);
+ showToast(t('Deleted {count} layers', { count: selectedLayerIds.length }));
} else {
handleDeleteLayer(activeLayerId);
}
@@ -1684,11 +1702,11 @@ export function useCollabSync({
const handleGroupSelectedLayers = useCallback(() => {
if (isSessionActive && !canMutateCanvas(mp.myRole)) {
- showToast('Viewers have read-only access');
+ showToast(t('Viewers have read-only access'));
return;
}
groupSelectedLayers();
- showToast('Grouped layers into folder');
+ showToast(t('Grouped layers into folder'));
}, [isSessionActive, mp.myRole, groupSelectedLayers, showToast]);
const handleToggleVisibility = useCallback(
@@ -1696,7 +1714,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canEditLayerById(id);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot modify this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot modify this layer'));
return;
}
}
@@ -1710,7 +1728,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canEditLayerById(id);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot modify this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot modify this layer'));
return;
}
}
@@ -1724,7 +1742,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canEditLayerById(id);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot rename this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot rename this layer'));
return;
}
}
@@ -1738,7 +1756,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canEditLayerById(id);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot modify lock on this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot modify lock on this layer'));
return;
}
}
@@ -1754,7 +1772,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canToggleLayerOwnerLock(target, mp.myPeer.id, mp.myRole);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot toggle owner lock on this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot toggle owner lock on this layer'));
return;
}
}
@@ -1769,7 +1787,7 @@ export function useCollabSync({
return rest;
})
);
- showToast(`Unlocked "${target.name}" for collaboration`);
+ showToast(t('Unlocked "{name}" for collaboration', { name: target.name }));
} else {
const lockPeerId =
mp.myRole === 'host' && target.ownerPeerId && !peerIdEquals(target.ownerPeerId, mp.myPeer.id)
@@ -1777,7 +1795,7 @@ export function useCollabSync({
: mp.myPeer.id;
const lockPeerName =
mp.myRole === 'host' && target.ownerPeerId && !peerIdEquals(target.ownerPeerId, mp.myPeer.id)
- ? target.ownerPeerName || 'Owner'
+ ? target.ownerPeerName || t('Owner')
: mp.myPeer.name;
setLayers((prev) =>
prev.map((l) =>
@@ -1792,7 +1810,7 @@ export function useCollabSync({
: l
)
);
- showToast(`Locked "${target.name}" to ${lockPeerName}`);
+ showToast(t('Locked "{name}" to {owner}', { name: target.name, owner: lockPeerName }));
}
},
[isSessionActive, mp.myPeer.id, mp.myPeer.name, mp.myRole, setLayers, showToast]
@@ -1802,7 +1820,7 @@ export function useCollabSync({
if (isSessionActive) {
const perm = canEditLayerById(activeLayerId);
if (!perm.allowed) {
- showToast(perm.reason || 'Cannot clear this layer');
+ showToast(perm.reason ? td(perm.reason) : t('Cannot clear this layer'));
return;
}
}
diff --git a/src/hooks/useExternalFileDrop.ts b/src/hooks/useExternalFileDrop.ts
index f4845ed..8a190b0 100644
--- a/src/hooks/useExternalFileDrop.ts
+++ b/src/hooks/useExternalFileDrop.ts
@@ -19,6 +19,28 @@ import {
resolveDropZoneAtPoint,
resolveDropZoneFromElement,
} from '../utils/fileDropImport';
+import { t } from '../i18n';
+
+function formatDroppedImportSummary(
+ importedCount: number,
+ skippedTotal: number,
+ truncatedCount: number
+): string {
+ const notes: string[] = [];
+ if (skippedTotal > 0) notes.push(t('{count} skipped', { count: skippedTotal }));
+ if (truncatedCount > 0) {
+ notes.push(t('max {max} per drop', { max: MAX_DROPPED_IMAGE_FILES }));
+ }
+ if (notes.length > 0) {
+ const noteText = notes.join(t(', '));
+ return importedCount === 1
+ ? t('Imported {count} image as layer ({notes})', { count: importedCount, notes: noteText })
+ : t('Imported {count} images as layers ({notes})', { count: importedCount, notes: noteText });
+ }
+ return importedCount === 1
+ ? t('Imported {count} image as layer', { count: importedCount })
+ : t('Imported {count} images as layers', { count: importedCount });
+}
interface TauriWindow extends Window {
__TAURI_INTERNALS__?: unknown;
@@ -100,19 +122,19 @@ export function useExternalFileDrop({
return 1;
} catch (err) {
console.warn('Dropped 3D model import failed:', err);
- showToast('Failed to import dropped 3D model.');
+ showToast(t('Failed to import dropped 3D model.'));
return 0;
}
}
if (model3D.oversizedCount > 0) {
- showToast('3D model exceeds 250 MB limit.');
+ showToast(t('3D model exceeds 250 MB limit.'));
return 0;
}
}
if (dropZone === '3d-stage') {
if (fileList.length > 0) {
- showToast('Unsupported file type. Drop a .glb, .gltf, or .obj 3D model.');
+ showToast(t('Unsupported file type. Drop a .glb, .gltf, or .obj 3D model.'));
}
return 0;
}
@@ -122,12 +144,14 @@ export function useExternalFileDrop({
if (accepted.length === 0) {
if (oversizedCount > 0) {
- showToast('Image exceeds 100 MB limit.');
+ showToast(t('Image exceeds 100 MB limit.'));
} else if (rejectedCount > 0) {
showToast(
is3DModeActiveRef.current
- ? 'Unsupported file type. Drop .glb, .gltf, .obj 3D models or PNG, JPG, WebP, GIF, BMP, SVG images.'
- : 'Unsupported file type. Drop PNG, JPG, WebP, GIF, BMP, or SVG images.'
+ ? t(
+ 'Unsupported file type. Drop .glb, .gltf, .obj 3D models or PNG, JPG, WebP, GIF, BMP, SVG images.'
+ )
+ : t('Unsupported file type. Drop PNG, JPG, WebP, GIF, BMP, or SVG images.')
);
}
return 0;
@@ -156,19 +180,11 @@ export function useExternalFileDrop({
const skippedTotal = rejectedCount + oversizedCount + failedCount;
if (importedNames.length === 1 && skippedTotal === 0 && truncatedCount === 0) {
- showToast(`Imported "${importedNames[0]}" as layer`);
+ showToast(t('Imported "{name}" as layer', { name: importedNames[0] }));
} else if (importedNames.length > 0) {
- const notes: string[] = [];
- if (skippedTotal > 0) notes.push(`${skippedTotal} skipped`);
- if (truncatedCount > 0) notes.push(`max ${MAX_DROPPED_IMAGE_FILES} per drop`);
- const suffix = notes.length > 0 ? ` (${notes.join(', ')})` : '';
- showToast(
- `Imported ${importedNames.length} image${importedNames.length === 1 ? '' : 's'} as layer${
- importedNames.length === 1 ? '' : 's'
- }${suffix}`
- );
+ showToast(formatDroppedImportSummary(importedNames.length, skippedTotal, truncatedCount));
} else {
- showToast('Failed to import dropped image.');
+ showToast(t('Failed to import dropped image.'));
}
return importedNames.length;
@@ -191,7 +207,7 @@ export function useExternalFileDrop({
return 1;
} catch (err) {
console.warn('Failed to read or load dropped 3D model file:', err);
- showToast('Failed to read dropped 3D model file.');
+ showToast(t('Failed to read dropped 3D model file.'));
return 0;
}
}
@@ -199,7 +215,7 @@ export function useExternalFileDrop({
if (dropZone === '3d-stage') {
if (paths.length > 0) {
- showToast('Unsupported file type. Drop a .glb, .gltf, or .obj 3D model.');
+ showToast(t('Unsupported file type. Drop a .glb, .gltf, or .obj 3D model.'));
}
return 0;
}
@@ -209,8 +225,10 @@ export function useExternalFileDrop({
if (rejectedCount > 0) {
showToast(
is3DModeActiveRef.current
- ? 'Unsupported file type. Drop .glb, .gltf, .obj 3D models or PNG, JPG, WebP, GIF, BMP, SVG images.'
- : 'Unsupported file type. Drop PNG, JPG, WebP, GIF, BMP, or SVG images.'
+ ? t(
+ 'Unsupported file type. Drop .glb, .gltf, .obj 3D models or PNG, JPG, WebP, GIF, BMP, SVG images.'
+ )
+ : t('Unsupported file type. Drop PNG, JPG, WebP, GIF, BMP, or SVG images.')
);
}
return 0;
@@ -232,7 +250,7 @@ export function useExternalFileDrop({
}
if (files.length === 0) {
- showToast('Failed to read dropped image file.');
+ showToast(t('Failed to read dropped image file.'));
return 0;
}
@@ -256,19 +274,11 @@ export function useExternalFileDrop({
const skippedTotal = rejectedCount + readFailedCount + decodeFailedCount;
if (importedNames.length === 1 && skippedTotal === 0 && truncatedCount === 0) {
- showToast(`Imported "${importedNames[0]}" as layer`);
+ showToast(t('Imported "{name}" as layer', { name: importedNames[0] }));
} else if (importedNames.length > 0) {
- const notes: string[] = [];
- if (skippedTotal > 0) notes.push(`${skippedTotal} skipped`);
- if (truncatedCount > 0) notes.push(`max ${MAX_DROPPED_IMAGE_FILES} per drop`);
- const suffix = notes.length > 0 ? ` (${notes.join(', ')})` : '';
- showToast(
- `Imported ${importedNames.length} image${importedNames.length === 1 ? '' : 's'} as layer${
- importedNames.length === 1 ? '' : 's'
- }${suffix}`
- );
+ showToast(formatDroppedImportSummary(importedNames.length, skippedTotal, truncatedCount));
} else {
- showToast('Failed to import dropped image.');
+ showToast(t('Failed to import dropped image.'));
}
return importedNames.length;
diff --git a/src/hooks/useLayerManager.ts b/src/hooks/useLayerManager.ts
index 50ca98e..07be8f6 100644
--- a/src/hooks/useLayerManager.ts
+++ b/src/hooks/useLayerManager.ts
@@ -9,7 +9,7 @@ import {
computeRestoreSolo,
computeSoloToggle,
} from '../utils/layerOrganization';
-import { computeLayerSelection } from './layerManager/layerTreeOps';
+import { computeLayerSelection, createLayerTreeSnapshotDelta } from './layerManager/layerTreeOps';
import { LayerManagerContext, UseLayerManagerProps } from './layerManager/types';
import { useLayerCanvasRegistry } from './layerManager/useLayerCanvasRegistry';
import { useLayerCrud } from './layerManager/useLayerCrud';
@@ -248,7 +248,8 @@ export function useLayerManager({
(id: string) => {
const key = activeSessionIdRef.current || '__default__';
const currentSolo = soloStatesBySessionRef.current.get(key) ?? null;
- const result = computeSoloToggle(layersRef.current, id, currentSolo);
+ const prevLayers = layersRef.current;
+ const result = computeSoloToggle(prevLayers, id, currentSolo);
if (result.action === 'noop') return;
if (result.nextSolo) {
@@ -260,23 +261,60 @@ export function useLayerManager({
layersRef.current = result.nextLayers;
setLayers(result.nextLayers);
activeTileGridRef.current.notifyChange(true);
+ recordLayerHistory(
+ result.nextSolo ? 'Solo Layer' : 'Exit Solo Layer',
+ id,
+ createLayerTreeSnapshotDelta(
+ prevLayers,
+ result.nextLayers,
+ activeLayerIdRef.current,
+ activeLayerIdRef.current
+ ),
+ undefined,
+ 'layer'
+ );
},
- [activeSessionIdRef, activeTileGridRef, layersRef, setLayers]
+ [activeLayerIdRef, activeSessionIdRef, activeTileGridRef, layersRef, recordLayerHistory, setLayers]
);
const exitSoloLayer = useCallback(() => {
const key = activeSessionIdRef.current || '__default__';
const currentSolo = soloStatesBySessionRef.current.get(key) ?? null;
if (!currentSolo) return;
- const result = computeRestoreSolo(layersRef.current, currentSolo);
+ const prevLayers = layersRef.current;
+ const result = computeRestoreSolo(prevLayers, currentSolo);
soloStatesBySessionRef.current.delete(key);
setSoloLayerId(null);
- if (result.nextLayers !== layersRef.current) {
+ if (result.nextLayers !== prevLayers) {
layersRef.current = result.nextLayers;
setLayers(result.nextLayers);
activeTileGridRef.current.notifyChange(true);
+ recordLayerHistory(
+ 'Exit Solo Layer',
+ currentSolo.layerId,
+ createLayerTreeSnapshotDelta(
+ prevLayers,
+ result.nextLayers,
+ activeLayerIdRef.current,
+ activeLayerIdRef.current
+ ),
+ undefined,
+ 'layer'
+ );
}
- }, [activeSessionIdRef, activeTileGridRef, layersRef, setLayers]);
+ }, [activeLayerIdRef, activeSessionIdRef, activeTileGridRef, layersRef, recordLayerHistory, setLayers]);
+
+ const applyLayerTreeDeltaWithSoloSync = useCallback<typeof specialLayers.applyLayerTreeDelta>(
+ (delta, direction) => {
+ const key = activeSessionIdRef.current || '__default__';
+ if (soloStatesBySessionRef.current.has(key)) {
+ soloStatesBySessionRef.current.delete(key);
+ setSoloLayerId(null);
+ }
+ return specialLayers.applyLayerTreeDelta(delta, direction);
+ },
+ [activeSessionIdRef, specialLayers]
+ );
// Get active layer object
const activeLayer = layers.find((l) => l.id === activeLayerId) || layers[0];
@@ -367,7 +405,7 @@ export function useLayerManager({
upsertBalloonLayer: specialLayers.upsertBalloonLayer,
createFrameFolder: specialLayers.createFrameFolder,
divideFrameFolder: specialLayers.divideFrameFolder,
- applyLayerTreeDelta: specialLayers.applyLayerTreeDelta,
+ applyLayerTreeDelta: applyLayerTreeDeltaWithSoloSync,
rasterizeLayer: specialLayers.rasterizeLayer,
};
}
diff --git a/src/hooks/useMultiplayer.ts b/src/hooks/useMultiplayer.ts
index 92a63c0..a76fac5 100644
--- a/src/hooks/useMultiplayer.ts
+++ b/src/hooks/useMultiplayer.ts
@@ -91,6 +91,7 @@ import {
NICKNAME_STORAGE_KEY as NICKNAME_KEY,
} from '../types/settings';
import { createPeerCursorStore, PeerCursorStore } from '../utils/peerCursorStore';
+import { t, td } from '../i18n';
const PEER_COLORS = [
'#f43f5e', // Rose
@@ -871,8 +872,8 @@ export function useMultiplayer({
resetSessionState();
showToastRef.current(
wasWebRtcGuest
- ? 'Host disconnected — the P2P room has ended. Your canvas remains open locally.'
- : 'Unable to reconnect to collaborative session'
+ ? t('Host disconnected — the P2P room has ended. Your canvas remains open locally.')
+ : t('Unable to reconnect to collaborative session')
);
return;
}
@@ -940,7 +941,7 @@ export function useMultiplayer({
setConnectionStatus('connected');
// Refresh tile version dedupe on reconnect while keeping room brush asset cache intact
multiplayerService.clearSentTileVersions();
- showToastRef.current('Reconnected to collaborative session');
+ showToastRef.current(t('Reconnected to collaborative session'));
})
.catch(() => {
isReconnectingInFlightRef.current = false;
@@ -1115,7 +1116,7 @@ export function useMultiplayer({
multiplayerService.disconnect();
resetSessionState();
}
- showToastRef.current(denied.reason || 'Access denied');
+ showToastRef.current(denied.reason ? td(denied.reason) : t('Access denied'));
break;
}
@@ -1131,8 +1132,8 @@ export function useMultiplayer({
applyLocalRole(nextRole);
showToastRef.current(
nextRole === 'viewer'
- ? 'Your role was changed to Viewer (read-only)'
- : 'Your role was changed to Editor'
+ ? t('Your role was changed to Viewer (read-only)')
+ : t('Your role was changed to Editor')
);
}
} else {
@@ -1157,10 +1158,11 @@ export function useMultiplayer({
multiplayerService.disconnect();
resetSessionState();
showToastRef.current(
- modMsg.reason ||
- (isBan
- ? 'You have been banned from this room by the host'
- : 'You were removed from this room by the host')
+ modMsg.reason
+ ? td(modMsg.reason)
+ : isBan
+ ? t('You have been banned from this room by the host')
+ : t('You were removed from this room by the host')
);
break;
}
@@ -1186,7 +1188,9 @@ export function useMultiplayer({
const target = prev.find((p) => peerIdEquals(p.id, modMsg.targetPeerId));
if (target) {
showToastRef.current(
- isBan ? `${target.name} was banned` : `${target.name} was kicked`
+ isBan
+ ? t('{name} was banned', { name: target.name })
+ : t('{name} was kicked', { name: target.name })
);
}
const next = prev.filter((p) => !peerIdEquals(p.id, modMsg.targetPeerId));
@@ -1214,7 +1218,7 @@ export function useMultiplayer({
if (bannedPeerIdsRef.current.has(guestIdKey)) {
multiplayerService.sendAccessDenied(
'BANNED',
- 'You are banned from this room',
+ t('You are banned from this room'),
rawGuest.id
);
break;
@@ -1238,7 +1242,7 @@ export function useMultiplayer({
});
if (!msg.isReconnect) {
- showToastRef.current(`${guestPeer.name} joined the canvas`);
+ showToastRef.current(t('{name} joined the canvas', { name: guestPeer.name }));
}
let assignedLayerId: string | undefined;
@@ -1369,7 +1373,7 @@ export function useMultiplayer({
}
if (!wasReconnect) {
- showToastRef.current(`Connected to room "${accMsg.roomName}"`);
+ showToastRef.current(t('Connected to room "{name}"', { name: accMsg.roomName }));
}
// Share our initial camera snapshot so peers can immediately follow us
onCameraSyncRequestRef.current?.();
@@ -1392,7 +1396,7 @@ export function useMultiplayer({
];
peersRef.current = next;
if (!existed) {
- showToastRef.current(`${normalizedPeer.name} joined the canvas`);
+ showToastRef.current(t('{name} joined the canvas', { name: normalizedPeer.name }));
}
return next;
});
@@ -1417,7 +1421,7 @@ export function useMultiplayer({
setPeers((prev) => {
const leaving = prev.find((p) => peerIdEquals(p.id, id));
if (leaving) {
- showToastRef.current(`${leaving.name} left the canvas`);
+ showToastRef.current(t('{name} left the canvas', { name: leaving.name }));
}
const next = prev.filter((p) => !peerIdEquals(p.id, id));
peersRef.current = next;
@@ -1643,7 +1647,7 @@ export function useMultiplayer({
senderId: shareMsg.peerId,
senderName: resolvedPeerName,
senderColor: matchingPeer?.color || '#38bdf8',
- text: `Shared brush "${resolvedBrushName}"`,
+ text: t('Shared brush "{name}"', { name: td(resolvedBrushName) }),
timestamp: Date.now(),
isLocal: false,
sharedBrush: {
@@ -1659,7 +1663,12 @@ export function useMultiplayer({
if (!isChatVisibleRef.current) {
setUnreadChatCount((c) => c + 1);
}
- showToastRef.current(`${resolvedPeerName} shared "${resolvedBrushName}" brush`);
+ showToastRef.current(
+ t('{peerName} shared "{brushName}" brush', {
+ peerName: resolvedPeerName,
+ brushName: td(resolvedBrushName),
+ })
+ );
}
onRemoteBrushShareRef.current?.(snapshot, shareMsg.explicit);
@@ -2018,7 +2027,7 @@ export function useMultiplayer({
) {
intentionalDisconnectRef.current = true;
resetSessionState();
- showToastRef.current('Host ended the P2P room. Your canvas remains open locally.');
+ showToastRef.current(t('Host ended the P2P room. Your canvas remains open locally.'));
return;
}
@@ -2027,8 +2036,8 @@ export function useMultiplayer({
if (reconnectAttemptRef.current === 0) {
showToastRef.current(
sessionParamsRef.current.kind === 'webrtc-guest'
- ? 'Host connection interrupted. Reconnecting to P2P room...'
- : 'Connection lost. Reconnecting...'
+ ? t('Host connection interrupted. Reconnecting to P2P room...')
+ : t('Connection lost. Reconnecting...')
);
}
scheduleReconnectRef.current(false);
@@ -2109,12 +2118,12 @@ export function useMultiplayer({
if (isGlobal) {
const installed = await invoke<boolean>('is_cloudflared_installed').catch(() => true);
if (!installed) {
- onStatus?.('Downloading Cloudflare Tunnel (first time)...');
+ onStatus?.(t('Downloading Cloudflare Tunnel (first time)...'));
} else {
- onStatus?.('Starting Worldwide Tunnel...');
+ onStatus?.(t('Starting Worldwide Tunnel...'));
}
} else {
- onStatus?.('Starting Local Server...');
+ onStatus?.(t('Starting Local Server...'));
}
serverInfo = await invoke<SessionHostInfo>('start_collab_server', {
port,
@@ -2234,19 +2243,19 @@ export function useMultiplayer({
lastProcessedClipboardUrlRef.current = normalizedServerInfo.inviteUrl;
showToast(
isGlobalServer
- ? 'Worldwide invite link copied to clipboard.'
- : 'Local Wi-Fi invite link copied to clipboard.'
+ ? t('Worldwide invite link copied to clipboard.')
+ : t('Local Wi-Fi invite link copied to clipboard.')
);
} catch {
- showToast(`Room created: ${normalizedServerInfo.inviteUrl}`);
+ showToast(t('Room created: {url}', { url: normalizedServerInfo.inviteUrl }));
}
return normalizedServerInfo;
} catch (err: any) {
console.error('Failed to start host session:', err);
resetSessionState();
- const errMsg = err?.message || (typeof err === 'string' ? err : 'Connection error');
- showToast(`Failed to start host: ${errMsg}`);
+ const errMsg = err?.message || (typeof err === 'string' ? err : t('Connection error'));
+ showToast(t('Failed to start host: {error}', { error: errMsg }));
throw err;
}
},
@@ -2276,7 +2285,7 @@ export function useMultiplayer({
const creds = generateP2pRoomCredentials();
const { customSignalingUrl, turnConfig } = getWebRtcNetworkConfigFromSettings();
- onStatus?.('Connecting to P2P signaling...');
+ onStatus?.(t('Connecting to P2P signaling...'));
const hostPeer: CollabPeer = {
...myPeerRef.current,
@@ -2347,20 +2356,20 @@ export function useMultiplayer({
if (navigator.clipboard && navigator.clipboard.writeText) {
await navigator.clipboard.writeText(creds.joinCode);
lastProcessedClipboardUrlRef.current = creds.joinCode;
- showToast(`Quick P2P room ready! Code ${creds.joinCode} copied.`);
+ showToast(t('Quick P2P room ready! Code {code} copied.', { code: creds.joinCode }));
} else {
- showToast(`Quick P2P room ready: ${creds.joinCode}`);
+ showToast(t('Quick P2P room ready: {code}', { code: creds.joinCode }));
}
} catch {
- showToast(`Quick P2P room ready: ${creds.joinCode}`);
+ showToast(t('Quick P2P room ready: {code}', { code: creds.joinCode }));
}
return normalizedServerInfo;
} catch (err: any) {
console.error('Failed to start WebRTC P2P host session:', err);
resetSessionState();
- const errMsg = err?.message || (typeof err === 'string' ? err : 'P2P connection error');
- showToast(`Failed to start P2P room: ${errMsg}`);
+ const errMsg = err?.message || (typeof err === 'string' ? err : t('P2P connection error'));
+ showToast(t('Failed to start P2P room: {error}', { error: errMsg }));
throw err;
}
},
@@ -2379,7 +2388,7 @@ export function useMultiplayer({
await invoke('stop_collab_server');
}
resetSessionState();
- showToast('Collaborative session stopped');
+ showToast(t('Collaborative session stopped'));
} catch (err) {
console.error('Failed to stop collab server:', err);
}
@@ -2478,7 +2487,7 @@ export function useMultiplayer({
return true;
} catch (err: any) {
resetSessionState();
- showToast(`Failed to connect: ${err?.message || err}`);
+ showToast(t('Failed to connect: {error}', { error: err?.message || String(err) }));
return false;
}
},
@@ -2586,7 +2595,7 @@ export function useMultiplayer({
return true;
} catch (err: any) {
resetSessionState();
- showToast(`Failed to join P2P room: ${err?.message || err}`);
+ showToast(t('Failed to join P2P room: {error}', { error: err?.message || String(err) }));
return false;
}
},
@@ -2603,7 +2612,7 @@ export function useMultiplayer({
const target = parseCollabTarget(rawUrl);
if (!target) {
showToast(
- 'Invalid room code or link. Enter an INK-XXXX code, P2P link, or wss:// / ws:// URL.'
+ t('Invalid room code or link. Enter an INK-XXXX code, P2P link, or wss:// / ws:// URL.')
);
return false;
}
@@ -2640,14 +2649,14 @@ export function useMultiplayer({
clearReconnectTimer();
multiplayerService.disconnect();
resetSessionState();
- showToast('Left the collaborative session');
+ showToast(t('Left the collaborative session'));
}, [clearReconnectTimer, resetSessionState, showToast]);
// HOST MODERATION: ROLE CHANGE, KICK, BAN, UNBAN
const setPeerRole = useCallback(
(peerId: string | number, role: Exclude<CollabRole, 'host'>) => {
if (!isHostRef.current) {
- showToast('Only the Host can change participant roles');
+ showToast(t('Only the Host can change participant roles'));
return;
}
if (peerIdEquals(peerId, myPeerRef.current.id)) return;
@@ -2666,7 +2675,7 @@ export function useMultiplayer({
const kickPeer = useCallback(
(peerId: string | number, reason?: string) => {
if (!isHostRef.current) {
- showToast('Only the Host can kick participants');
+ showToast(t('Only the Host can kick participants'));
return;
}
if (peerIdEquals(peerId, myPeerRef.current.id)) return;
@@ -2678,7 +2687,7 @@ export function useMultiplayer({
setPeers((prev) => {
const target = prev.find((p) => peerIdEquals(p.id, peerId));
if (target) {
- showToast(`Kicked ${target.name} from the room`);
+ showToast(t('Kicked {name} from the room', { name: target.name }));
}
const next = prev.filter((p) => !peerIdEquals(p.id, peerId));
peersRef.current = next;
@@ -2691,7 +2700,7 @@ export function useMultiplayer({
const banPeer = useCallback(
(peerId: string | number, reason?: string) => {
if (!isHostRef.current) {
- showToast('Only the Host can ban participants');
+ showToast(t('Only the Host can ban participants'));
return;
}
if (peerIdEquals(peerId, myPeerRef.current.id)) return;
@@ -2707,7 +2716,7 @@ export function useMultiplayer({
setPeers((prev) => {
const target = prev.find((p) => peerIdEquals(p.id, peerId));
if (target) {
- showToast(`Banned ${target.name} from the room`);
+ showToast(t('Banned {name} from the room', { name: target.name }));
}
const next = prev.filter((p) => !peerIdEquals(p.id, peerId));
peersRef.current = next;
@@ -2720,14 +2729,14 @@ export function useMultiplayer({
const unbanPeer = useCallback(
(peerId: string | number) => {
if (!isHostRef.current) {
- showToast('Only the Host can unban participants');
+ showToast(t('Only the Host can unban participants'));
return;
}
const key = String(peerId);
if (bannedPeerIdsRef.current.delete(key)) {
setBannedPeerIds(Array.from(bannedPeerIdsRef.current));
multiplayerService.sendPeerUnban(peerId);
- showToast(`Unbanned ${key}`);
+ showToast(t('Unbanned {id}', { id: key }));
}
},
[showToast]
@@ -2789,7 +2798,7 @@ export function useMultiplayer({
senderId: myPeerRef.current.id,
senderName: myPeerRef.current.name,
senderColor: myPeerRef.current.color,
- text: `Shared brush "${snapshot.brushName}"`,
+ text: t('Shared brush "{name}"', { name: td(snapshot.brushName) }),
timestamp: Date.now(),
isLocal: true,
sharedBrush: snapshot,
diff --git a/src/hooks/useTonalAndFilterActions.ts b/src/hooks/useTonalAndFilterActions.ts
index 70b23f9..a6010d0 100644
--- a/src/hooks/useTonalAndFilterActions.ts
+++ b/src/hooks/useTonalAndFilterActions.ts
@@ -60,6 +60,7 @@ import {
} from '../utils/mangaEffectsEngine';
import { SimpleToneSettings } from '../components/SimpleToneModal';
import { useUiStore, uiStoreActions } from '../stores';
+import { t, tc } from '../i18n';
import { PushHistoryStepFn } from './drawing';
export interface UseTonalAndFilterActionsParams {
@@ -169,12 +170,13 @@ export function useTonalAndFilterActions({
const handleApplyAdjustment = useCallback(
(type: 'curves' | 'gradient-map' | 'levels' | 'color-balance', data: AdjustmentLayerData) => {
const targetId = useUiStore.getState().adjustmentModalState.layerId;
+ const adjTypeLabel = tc('adjustmentType', data.type);
if (targetId) {
updateAdjustmentData(targetId, data);
- showToast(`Updated ${data.type} adjustment layer`);
+ showToast(t('Updated {type} adjustment layer', { type: adjTypeLabel }));
} else {
addAdjustmentLayer(type, data);
- showToast(`Created new ${data.type} adjustment layer`);
+ showToast(t('Created new {type} adjustment layer', { type: adjTypeLabel }));
}
uiStoreActions.setAdjustmentModalState({ isOpen: false });
},
@@ -199,7 +201,7 @@ export function useTonalAndFilterActions({
const targetId = useUiStore.getState().layerStylesModalState.layerId;
if (targetId) {
updateLayerStyles(targetId, styles);
- showToast('Updated Layer Styles');
+ showToast(t('Updated Layer Styles'));
}
uiStoreActions.setLayerStylesModalState({ isOpen: false });
},
@@ -214,7 +216,7 @@ export function useTonalAndFilterActions({
activeLayer.type !== 'raster' ||
activeLayer.locked
) {
- showToast('Select an unlocked raster layer to apply filter');
+ showToast(t('Select an unlocked raster layer to apply filter'));
return;
}
if (dimensions.width <= 0 || dimensions.height <= 0) return;
@@ -232,10 +234,11 @@ export function useTonalAndFilterActions({
targetFormat,
selection,
}).then(({ dirtyRect, tileDeltas }) => {
+ const filterName = tc('filterName', type.replace('-', ' '));
if (tileDeltas.length > 0) {
pushHistoryStepRef.current?.(
'filter',
- `Filter: ${type.replace('-', ' ')}`,
+ t('Filter: {name}', { name: filterName }),
null,
null,
targetLayerId,
@@ -244,7 +247,7 @@ export function useTonalAndFilterActions({
);
}
updateLayerThumbnail(targetLayerId, true);
- showToast(`Filter applied: ${type.replace('-', ' ')}`);
+ showToast(t('Filter applied: {name}', { name: filterName }));
});
},
[
@@ -263,19 +266,19 @@ export function useTonalAndFilterActions({
const getTonalLabel = useCallback((type: TonalCorrectionType) => {
switch (type) {
case 'brightness-contrast':
- return 'Brightness/Contrast';
+ return t('Brightness/Contrast');
case 'binarization':
- return 'Binarization';
+ return t('Binarization');
case 'hue-saturation':
- return 'Hue/Saturation/Luminosity';
+ return t('Hue/Saturation/Luminosity');
case 'posterization':
- return 'Posterization';
+ return t('Posterization');
case 'level-correction':
- return 'Level Correction';
+ return t('Level Correction');
case 'reverse-gradient':
- return 'Reverse Gradient';
+ return t('Reverse Gradient');
default:
- return 'Tonal Correction';
+ return t('Tonal Correction');
}
}, []);
@@ -308,9 +311,9 @@ export function useTonalAndFilterActions({
if (candidate) {
targetLayerId = candidate.id;
setActiveLayerId(candidate.id);
- showToast(`Switched to "${candidate.name}" (active layer had no pixels)`);
+ showToast(t('Switched to "{name}" (active layer had no pixels)', { name: candidate.name }));
} else {
- showToast('Selected layer is empty. Draw or open an image first.');
+ showToast(t('Selected layer is empty. Draw or open an image first.'));
return;
}
}
@@ -414,7 +417,7 @@ export function useTonalAndFilterActions({
selectionMask: null,
bounds: { x0: 0, y0: 0, x1: 0, y1: 0 },
});
- showToast(`Applied ${label}`);
+ showToast(t('Applied {label}', { label }));
},
[
dimensions,
@@ -473,9 +476,9 @@ export function useTonalAndFilterActions({
if (candidate) {
targetLayerId = candidate.id;
setActiveLayerId(candidate.id);
- showToast(`Switched to "${candidate.name}" (active layer had no pixels)`);
+ showToast(t('Switched to "{name}" (active layer had no pixels)', { name: candidate.name }));
} else {
- showToast('Selected layer is empty. Draw or open an image first.');
+ showToast(t('Selected layer is empty. Draw or open an image first.'));
return;
}
}
@@ -499,7 +502,7 @@ export function useTonalAndFilterActions({
if (tileDeltas.length > 0) {
pushHistoryStepRef.current?.(
'tonal-correction',
- 'Reverse Gradient',
+ t('Reverse Gradient'),
null,
null,
targetLayerId,
@@ -508,7 +511,7 @@ export function useTonalAndFilterActions({
);
}
updateLayerThumbnail(targetLayerId, true);
- showToast('Inverted colors (Reverse Gradient)');
+ showToast(t('Inverted colors (Reverse Gradient)'));
}, [
hasOpenDocument,
activeLayer,
@@ -593,10 +596,11 @@ export function useTonalAndFilterActions({
const tileDeltas = grid.computeDeltasFromSnapshot(beforeSnapshot, activeLayerId);
grid.notifyChange(true);
updateLayerThumbnail(activeLayerId, true);
+ const effectTypeLabel = tc('mangaEffect', type);
if (tileDeltas.length > 0) {
pushHistoryStepRef.current?.(
'brush',
- `Manga Effect (${type})`,
+ t('Manga Effect ({type})', { type: effectTypeLabel }),
null,
null,
activeLayerId,
@@ -604,7 +608,7 @@ export function useTonalAndFilterActions({
tileDeltas
);
}
- showToast(`Applied manga ${type} lines`);
+ showToast(t('Applied manga {type} lines', { type: effectTypeLabel }));
},
[
activeLayerId,
@@ -625,7 +629,7 @@ export function useTonalAndFilterActions({
} else {
pasteLayerFromCanvas(canvas, layer.name, layer.blendMode, layer.opacity, layer.id, layer);
}
- showToast(`Added 3D layer "${layer.name}".`);
+ showToast(t('Added 3D layer "{name}".', { name: layer.name }));
},
[addLayer, pasteLayerFromCanvas, showToast]
);
@@ -651,7 +655,7 @@ export function useTonalAndFilterActions({
if (tileDeltas.length > 0 || layerTreeDelta) {
pushHistoryStepRef.current?.(
'screentone',
- `Screentone (${settings.density}%)`,
+ t('Screentone ({density}%)', { density: settings.density }),
null,
null,
id,
@@ -664,7 +668,7 @@ export function useTonalAndFilterActions({
layerTreeDelta
);
}
- showToast(`Created Screentone Layer (${settings.density}%)`);
+ showToast(t('Created Screentone Layer ({density}%)', { density: settings.density }));
},
[selection, handleCommitFloatingSelection, fillScreentoneSelection, pushHistoryStepRef, showToast]
);
@@ -675,14 +679,14 @@ export function useTonalAndFilterActions({
if (result && result.tileDeltas.length > 0) {
pushHistoryStepRef.current?.(
'expression-color',
- 'Apply Expression Color',
+ t('Apply Expression Color'),
null,
null,
layerId,
undefined,
result.tileDeltas
);
- showToast('Applied expression color to layer');
+ showToast(t('Applied expression color to layer'));
}
},
[applyExpressionColorOfPreview, pushHistoryStepRef, showToast]
@@ -694,7 +698,7 @@ export function useTonalAndFilterActions({
if (result && (result.tileDeltas.length > 0 || result.layerTreeDelta)) {
pushHistoryStepRef.current?.(
'layer-color',
- 'Apply Layer Color Tint',
+ t('Apply Layer Color Tint'),
null,
null,
layerId,
@@ -706,7 +710,7 @@ export function useTonalAndFilterActions({
false,
result.layerTreeDelta
);
- showToast('Applied tint to layer permanently');
+ showToast(t('Applied tint to layer permanently'));
}
},
[applyLayerColorPermanently, pushHistoryStepRef, showToast]
@@ -722,7 +726,7 @@ export function useTonalAndFilterActions({
if (result && (result.tileDeltas.length > 0 || result.layerTreeDelta)) {
pushHistoryStepRef.current?.(
'layer-convert',
- `Convert to ${targetMode.toUpperCase()}`,
+ t('Convert to {mode}', { mode: tc('expressionColorUpper', targetMode.toUpperCase()) }),
null,
null,
layerId,
@@ -734,7 +738,7 @@ export function useTonalAndFilterActions({
false,
result.layerTreeDelta
);
- showToast(`Converted layer to ${targetMode}`);
+ showToast(t('Converted layer to {mode}', { mode: tc('expressionColor', targetMode) }));
}
},
[convertLayer, pushHistoryStepRef, showToast]
diff --git a/src/i18n/__tests__/i18n.test.tsx b/src/i18n/__tests__/i18n.test.tsx
new file mode 100644
index 0000000..b371a52
--- /dev/null
+++ b/src/i18n/__tests__/i18n.test.tsx
@@ -0,0 +1,554 @@
+import { act } from 'react';
+import { createRoot, Root } from 'react-dom/client';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import {
+ DEFAULT_APP_LANGUAGE,
+ detectSystemLanguage,
+ formatLocaleDate,
+ formatRelativeTime,
+ getLanguagePreference,
+ getResolvedLanguage,
+ isImeComposing,
+ resolveLanguage,
+ sanitizeAppLanguage,
+ setLanguagePreference,
+ t,
+ tc,
+ td,
+} from '../index';
+import { JA_DICTIONARY, JA_DICTIONARY_DOMAINS } from '../ja';
+import { DEFAULT_APP_SETTINGS, loadAppSettings, saveAppSettings } from '../../types/settings';
+import { DEFAULT_APPEARANCE_CONFIG } from '../../types/appearance';
+import { resolveAppearanceTokens } from '../../utils/themeEngine';
+import { computeMangaTextLayout } from '../../utils/mangaTextEngine';
+import { TEXT_FONT_PRESETS } from '../../utils/textSettings';
+import { uiStoreActions } from '../../stores';
+import { SettingsModal } from '../../components/SettingsModal';
+import { WelcomeScreen } from '../../components/WelcomeScreen';
+
+// Minimal DOM harness matching existing component tests in this repository
+class MiniText {
+ nodeType = 3;
+ nodeName = '#text';
+ parentNode: MiniEl | null = null;
+ constructor(
+ public nodeValue: string,
+ public ownerDocument: MiniDoc
+ ) {}
+}
+
+class MiniComment {
+ nodeType = 8;
+ nodeName = '#comment';
+ parentNode: MiniEl | null = null;
+ constructor(
+ public nodeValue: string,
+ public ownerDocument: MiniDoc
+ ) {}
+}
+
+class MiniStyle {
+ private map = new Map<string, string>();
+ [key: string]: unknown;
+ setProperty(k: string, v: string) {
+ this.map.set(k, String(v));
+ this[k] = String(v);
+ }
+ getPropertyValue(k: string): string {
+ return this.map.get(k) ?? '';
+ }
+ removeProperty(k: string) {
+ this.map.delete(k);
+ delete this[k];
+ }
+}
+
+class MiniEl extends EventTarget {
+ nodeType = 1;
+ nodeName: string;
+ tagName: string;
+ namespaceURI = 'http://www.w3.org/1999/xhtml';
+ parentNode: MiniEl | null = null;
+ childNodes: Array<MiniEl | MiniText | MiniComment> = [];
+ style = new MiniStyle();
+ className = '';
+ disabled = false;
+ type = '';
+ checked = false;
+ lang = '';
+ dataset: Record<string, string> = {};
+ attrs = new Map<string, string>();
+ private _value = '';
+
+ constructor(
+ tag: string,
+ public ownerDocument: MiniDoc
+ ) {
+ super();
+ this.nodeName = tag.toUpperCase();
+ this.tagName = tag.toUpperCase();
+ }
+
+ get value(): string {
+ return this._value;
+ }
+ set value(v: string) {
+ this._value = String(v);
+ }
+ get firstChild() {
+ return this.childNodes[0] ?? null;
+ }
+ get textContent(): string {
+ return this.childNodes
+ .map((c) =>
+ c instanceof MiniText ? c.nodeValue : c instanceof MiniEl ? c.textContent : ''
+ )
+ .join('');
+ }
+ set textContent(val: string) {
+ this.childNodes = val ? [new MiniText(val, this.ownerDocument)] : [];
+ }
+ setAttribute(k: string, v: string) {
+ this.attrs.set(k, String(v));
+ if (k === 'class') this.className = String(v);
+ if (k === 'lang') this.lang = String(v);
+ }
+ getAttribute(k: string): string | null {
+ return this.attrs.get(k) ?? null;
+ }
+ removeAttribute(k: string) {
+ this.attrs.delete(k);
+ }
+ appendChild<T extends MiniEl | MiniText | MiniComment>(child: T): T {
+ if (child.parentNode) child.parentNode.removeChild(child);
+ child.parentNode = this;
+ this.childNodes.push(child);
+ return child;
+ }
+ insertBefore<T extends MiniEl | MiniText | MiniComment>(
+ child: T,
+ ref: MiniEl | MiniText | MiniComment | null
+ ): T {
+ if (child.parentNode) child.parentNode.removeChild(child);
+ child.parentNode = this;
+ const idx = ref ? this.childNodes.indexOf(ref) : -1;
+ if (idx === -1) this.childNodes.push(child);
+ else this.childNodes.splice(idx, 0, child);
+ return child;
+ }
+ removeChild<T extends MiniEl | MiniText | MiniComment>(child: T): T {
+ const idx = this.childNodes.indexOf(child);
+ if (idx !== -1) this.childNodes.splice(idx, 1);
+ child.parentNode = null;
+ return child;
+ }
+ contains(node: unknown): boolean {
+ if (node === this) return true;
+ for (const c of this.childNodes) {
+ if (c === node) return true;
+ if (c instanceof MiniEl && c.contains(node)) return true;
+ }
+ return false;
+ }
+ findAll(predicate: (el: MiniEl) => boolean): MiniEl[] {
+ const out: MiniEl[] = [];
+ if (predicate(this)) out.push(this);
+ for (const c of this.childNodes) {
+ if (c instanceof MiniEl) out.push(...c.findAll(predicate));
+ }
+ return out;
+ }
+ getByTestId(id: string): MiniEl | null {
+ return this.findAll((el) => el.getAttribute('data-testid') === id)[0] ?? null;
+ }
+ focus() {
+ this.ownerDocument.activeElement = this;
+ }
+ blur() {
+ if (this.ownerDocument.activeElement === this) this.ownerDocument.activeElement = null;
+ }
+ override dispatchEvent(event: Event): boolean {
+ if (!event.target) {
+ Object.defineProperty(event, 'target', { value: this, configurable: true });
+ }
+ let cur: MiniEl | null = this;
+ while (cur) {
+ Object.defineProperty(event, 'currentTarget', { value: cur, configurable: true });
+ EventTarget.prototype.dispatchEvent.call(cur, event);
+ if (!event.bubbles || event.cancelBubble) break;
+ cur = cur.parentNode;
+ }
+ return !event.defaultPrevented;
+ }
+ click() {
+ this.dispatchEvent(new Event('click', { bubbles: true, cancelable: true }));
+ }
+}
+
+class MiniDoc extends EventTarget {
+ nodeType = 9;
+ documentElement: MiniEl;
+ body: MiniEl;
+ head: MiniEl;
+ activeElement: MiniEl | null = null;
+ defaultView: unknown;
+
+ constructor() {
+ super();
+ this.documentElement = new MiniEl('html', this);
+ this.head = new MiniEl('head', this);
+ this.body = new MiniEl('body', this);
+ this.documentElement.appendChild(this.head);
+ this.documentElement.appendChild(this.body);
+ }
+ createElement(tag: string) {
+ return new MiniEl(tag, this);
+ }
+ createElementNS(_ns: string, tag: string) {
+ return new MiniEl(tag, this);
+ }
+ createTextNode(text: string) {
+ return new MiniText(text, this);
+ }
+ createComment(text: string) {
+ return new MiniComment(text, this);
+ }
+}
+
+describe('Native Japanese Language Support (i18n)', () => {
+ const prevLang = getLanguagePreference();
+
+ afterEach(() => {
+ setLanguagePreference(prevLang);
+ });
+
+ describe('Language resolution, sanitization & persistence', () => {
+ it('sanitizes language codes safely', () => {
+ expect(sanitizeAppLanguage('auto')).toBe('auto');
+ expect(sanitizeAppLanguage('en')).toBe('en');
+ expect(sanitizeAppLanguage('ja')).toBe('ja');
+ expect(sanitizeAppLanguage('ja-JP')).toBe('ja');
+ expect(sanitizeAppLanguage('Japanese')).toBe('ja');
+ expect(sanitizeAppLanguage('en-US')).toBe('en');
+ expect(sanitizeAppLanguage('invalid')).toBe(DEFAULT_APP_LANGUAGE);
+ expect(sanitizeAppLanguage(null)).toBe(DEFAULT_APP_LANGUAGE);
+ });
+
+ it('detects Japanese system locales when navigator languages start with ja', () => {
+ expect(detectSystemLanguage(['ja-JP', 'en-US'])).toBe('ja');
+ expect(detectSystemLanguage(['ja'])).toBe('ja');
+ expect(detectSystemLanguage(['fr-FR', 'ja-JP'])).toBe('ja');
+ expect(detectSystemLanguage(['en-US', 'ja-JP'])).toBe('en');
+ expect(detectSystemLanguage(['de-DE'])).toBe('en');
+ expect(resolveLanguage('ja', ['en-US'])).toBe('ja');
+ expect(resolveLanguage('en', ['ja-JP'])).toBe('en');
+ expect(resolveLanguage('auto', ['ja-JP'])).toBe('ja');
+ });
+
+ it('persists language preference cleanly in AppSettings', () => {
+ const store = new Map<string, string>();
+ const prevStorage = globalThis.localStorage;
+ (globalThis as unknown as { localStorage: Storage }).localStorage = {
+ getItem: (k: string) => store.get(k) ?? null,
+ setItem: (k: string, v: string) => {
+ store.set(k, v);
+ },
+ removeItem: (k: string) => {
+ store.delete(k);
+ },
+ clear: () => store.clear(),
+ key: (i: number) => Array.from(store.keys())[i] ?? null,
+ get length() {
+ return store.size;
+ },
+ };
+ try {
+ saveAppSettings({ ...DEFAULT_APP_SETTINGS, language: 'ja' });
+ const loaded = loadAppSettings();
+ expect(loaded.language).toBe('ja');
+ } finally {
+ (globalThis as unknown as { localStorage: Storage }).localStorage = prevStorage;
+ }
+ });
+ });
+
+ describe('Dictionary integrity, native terminology & homonym disambiguation', () => {
+ it('has zero cross-domain conflicting Japanese values across all domain files', () => {
+ const seen = new Map<string, { domain: string; value: string }>();
+ const conflicts: string[] = [];
+
+ for (const [domain, dict] of Object.entries(JA_DICTIONARY_DOMAINS)) {
+ for (const [key, value] of Object.entries(dict)) {
+ expect(value.trim().length, `Empty JA value in ${domain} for "${key}"`).toBeGreaterThan(0);
+ const prev = seen.get(key);
+ if (prev && prev.value !== value) {
+ conflicts.push(
+ `"${key}": [${prev.domain}]="${prev.value}" vs [${domain}]="${value}"`
+ );
+ } else {
+ seen.set(key, { domain, value });
+ }
+ }
+ }
+
+ expect(conflicts).toEqual([]);
+ expect(Object.keys(JA_DICTIONARY).length).toBeGreaterThan(4000);
+ });
+
+ it('maintains 100% {placeholder} parity between English keys and Japanese translations', () => {
+ const re = /\{([a-zA-Z0-9_]+)\}/g;
+ const getVars = (s: string) =>
+ Array.from(new Set(Array.from(s.matchAll(re), (m) => m[1]))).sort();
+
+ const mismatches: string[] = [];
+ for (const [key, value] of Object.entries(JA_DICTIONARY)) {
+ const cleanKey = key.includes('::') ? key.split('::').slice(1).join('::') : key;
+ const expected = getVars(cleanKey);
+ const actual = getVars(value);
+ if (expected.join(',') !== actual.join(',')) {
+ mismatches.push(`"${key}" => "${value}" (expected [${expected}], got [${actual}])`);
+ }
+ }
+ expect(mismatches).toEqual([]);
+ });
+
+ it('uses authentic CLIP STUDIO PAINT / Photoshop JP terminology and disambiguates homonyms', () => {
+ setLanguagePreference('ja');
+ expect(getResolvedLanguage()).toBe('ja');
+
+ // Blend modes
+ expect(tc('blendMode', 'Normal')).toBe('通常');
+ expect(tc('blendMode', 'Multiply')).toBe('乗算');
+ expect(tc('blendMode', 'Screen')).toBe('スクリーン');
+ expect(tc('blendMode', 'Color Dodge')).toBe('覆い焼きカラー');
+ expect(tc('blendMode', 'Hard Light')).toBe('ハードライト');
+
+ // Homonym disambiguations
+ expect(t('Feather')).toBe('ぼかし');
+ expect(td('Feather', 'brushName')).toBe('羽根');
+ expect(td('Chrome', 'gradientPreset')).toBe('クローム');
+ expect(tc('appearanceTab', 'Chrome')).toBe('UIスタイル');
+ expect(tc('bristleTip', 'Flat')).toBe('平筆');
+ expect(tc('chromeStyle', 'Flat')).toBe('フラット');
+ expect(tc('dpiPreset', 'Screen')).toBe('画面用');
+ expect(tc('menu', 'Empty')).toBe('項目なし');
+ expect(tc('fillOption', 'Empty')).toBe('塗りなし');
+ expect(tc('window', 'Restore')).toBe('元に戻す(縮小)');
+ expect(t('Restore')).toBe('復元');
+ expect(tc('shortcut', 'Replace')).toBe('上書き');
+ expect(t('Replace')).toBe('置き換え');
+ expect(tc('subView', 'Reference')).toBe('資料');
+ expect(t('Reference')).toBe('参照');
+ expect(tc('expressionColor', 'Mono')).toBe('モノクロ');
+ expect(t('Mono')).toBe('等幅');
+ expect(tc('transformMode', 'Free')).toBe('自由変形');
+ expect(tc('aspectRatio', 'Free')).toBe('フリー');
+ expect(tc('subView', 'Full')).toBe('全体');
+ expect(tc('timelapse', 'Full')).toBe('フル');
+ expect(t('Full')).toBe('全画面');
+
+ // Natural SOV interpolation
+ expect(t('Imported brush "{name}"', { name: 'リアルGペン' })).toBe(
+ 'ブラシ「リアルGペン」を読み込みました'
+ );
+
+ // English parity
+ setLanguagePreference('en');
+ expect(t('Feather')).toBe('Feather');
+ expect(td('Feather', 'brushName')).toBe('Feather');
+ expect(t('Imported brush "{name}"', { name: 'Real G-Pen' })).toBe(
+ 'Imported brush "Real G-Pen"'
+ );
+ });
+ });
+
+ describe('Locale formatting, Japanese typography, vertical lettering & IME safety', () => {
+ it('formats relative times and dates in Japanese and English', () => {
+ const now = Date.now();
+ expect(formatRelativeTime(now - 5_000, 'ja')).toBe('たった今');
+ expect(formatRelativeTime(now - 5 * 60_000, 'ja')).toBe('5分前');
+ expect(formatRelativeTime(now - 2 * 3_600_000, 'ja')).toBe('2時間前');
+ expect(formatRelativeTime(now - 25 * 3_600_000, 'ja')).toBe('昨日');
+ expect(formatRelativeTime(now - 5_000, 'en')).toBe('Just now');
+ expect(formatLocaleDate('2026-04-01T00:00:00Z', { year: 'numeric', month: 'numeric', day: 'numeric' }, 'ja')).toMatch(/2026/);
+ });
+
+ it('includes native Japanese Gothic fallbacks in all Appearance font profiles', () => {
+ for (const fontProfile of ['system', 'humanist', 'technical'] as const) {
+ const resolved = resolveAppearanceTokens({
+ ...DEFAULT_APPEARANCE_CONFIG,
+ fontProfile,
+ });
+ expect(resolved.tokens['--ui-font-sans']).toContain('Yu Gothic');
+ expect(resolved.tokens['--ui-font-sans']).toContain('Hiragino');
+ expect(resolved.tokens['--ui-font-sans']).toContain('Noto Sans JP');
+ }
+ });
+
+ it('rotates Japanese prolonged sound mark (ー) & wave dash (〜) and shifts small kana in vertical-rl manga text', () => {
+ const layout = computeMangaTextLayout('ドーン〜ちょっと', {
+ fontSize: 24,
+ fontFamily: 'sans-serif',
+ writingMode: 'vertical-rl',
+ });
+ const choonpu = layout.glyphs.find((g) => g.char === 'ー');
+ const wave = layout.glyphs.find((g) => g.char === '〜');
+ const regular = layout.glyphs.find((g) => g.char === 'ド');
+ const smallTsu = layout.glyphs.find((g) => g.char === 'っ');
+
+ expect(choonpu?.rotateDeg).toBe(90);
+ expect(wave?.rotateDeg).toBe(90);
+ expect(regular?.rotateDeg).toBe(0);
+ expect(smallTsu).toBeDefined();
+ expect(smallTsu!.x).toBeGreaterThan(regular!.x);
+ });
+
+ it('includes curated Japanese Gothic, Mincho, and Manga presets in TEXT_FONT_PRESETS', () => {
+ const labels = TEXT_FONT_PRESETS.map((p) => p.label);
+ expect(labels.some((l) => l.includes('游ゴシック'))).toBe(true);
+ expect(labels.some((l) => l.includes('游明朝'))).toBe(true);
+ });
+
+ it('accurately detects active IME composition events', () => {
+ expect(isImeComposing({ isComposing: true, key: 'Enter' })).toBe(true);
+ expect(isImeComposing({ keyCode: 229, key: 'Enter' })).toBe(true);
+ expect(isImeComposing({ key: 'Process' })).toBe(true);
+ expect(isImeComposing({ nativeEvent: { isComposing: true } })).toBe(true);
+ expect(isImeComposing({ isComposing: false, keyCode: 13, key: 'Enter' })).toBe(false);
+ });
+ });
+
+ describe('Live React component switching (SettingsModal & WelcomeScreen)', () => {
+ let miniDoc: MiniDoc;
+ let host: MiniEl;
+ let root: Root | null = null;
+ const prevDoc = globalThis.document;
+ const prevWin = globalThis.window;
+ const prevHTMLEl = (globalThis as unknown as Record<string, unknown>).HTMLElement;
+ const prevEl = (globalThis as unknown as Record<string, unknown>).Element;
+ const prevNode = (globalThis as unknown as Record<string, unknown>).Node;
+ const prevReactAct = (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT?: boolean })
+ .IS_REACT_ACT_ENVIRONMENT;
+
+ beforeEach(() => {
+ (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT =
+ true;
+ miniDoc = new MiniDoc();
+ class MockIFrame extends MiniEl {}
+ const fakeWin = Object.assign(new EventTarget(), {
+ document: miniDoc,
+ HTMLElement: MiniEl,
+ HTMLIFrameElement: MockIFrame,
+ Element: MiniEl,
+ Node: MiniEl,
+ localStorage: {
+ getItem: () => null,
+ setItem: () => {},
+ removeItem: () => {},
+ },
+ navigator: { userAgent: 'Mozilla/5.0', platform: 'Win32', language: 'en-US' },
+ matchMedia: () => ({ matches: false, addEventListener: () => {}, removeEventListener: () => {} }),
+ requestAnimationFrame: (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 0),
+ cancelAnimationFrame: (id: number) => clearTimeout(id),
+ });
+ miniDoc.defaultView = fakeWin;
+ (globalThis as unknown as { document: unknown }).document = miniDoc;
+ (globalThis as unknown as { window: unknown }).window = fakeWin;
+ (globalThis as unknown as Record<string, unknown>).HTMLElement = MiniEl;
+ (globalThis as unknown as Record<string, unknown>).Element = MiniEl;
+ (globalThis as unknown as Record<string, unknown>).Node = MiniEl;
+ host = miniDoc.createElement('div');
+ miniDoc.body.appendChild(host);
+ setLanguagePreference('en');
+ });
+
+ afterEach(() => {
+ if (root) {
+ act(() => {
+ root?.unmount();
+ });
+ root = null;
+ }
+ setLanguagePreference('en');
+ (globalThis as unknown as { document: unknown }).document = prevDoc;
+ (globalThis as unknown as { window: unknown }).window = prevWin;
+ (globalThis as unknown as Record<string, unknown>).HTMLElement = prevHTMLEl;
+ (globalThis as unknown as Record<string, unknown>).Element = prevEl;
+ (globalThis as unknown as Record<string, unknown>).Node = prevNode;
+ (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT =
+ prevReactAct;
+ });
+
+ it('switches SettingsModal and WelcomeScreen live between English and Japanese', async () => {
+ const onUpdateSettings = vi.fn((next) => {
+ uiStoreActions.updateAppSettings(next);
+ });
+ const onShowToast = vi.fn();
+
+ await act(async () => {
+ root = createRoot(host as unknown as Element);
+ root.render(
+ <SettingsModal
+ isOpen
+ onClose={() => {}}
+ settings={{ ...DEFAULT_APP_SETTINGS, language: 'en' }}
+ onUpdateSettings={onUpdateSettings}
+ onShowToast={onShowToast}
+ />
+ );
+ await Promise.resolve();
+ });
+
+ expect(host.textContent).toContain('Preferences');
+ expect(host.textContent).toContain('Language / 言語');
+ expect(miniDoc.documentElement.lang).toBe('en');
+
+ const jaBtn = host.getByTestId('settings-lang-ja');
+ expect(jaBtn).not.toBeNull();
+
+ await act(async () => {
+ jaBtn!.click();
+ await Promise.resolve();
+ });
+
+ expect(getResolvedLanguage()).toBe('ja');
+ expect(miniDoc.documentElement.lang).toBe('ja');
+ expect(host.textContent).toContain('環境設定');
+ expect(host.textContent).toContain('言語 (Language)');
+ expect(host.textContent).toContain('ブラシ・筆圧');
+ expect(host.textContent).toContain('ショートカット');
+ expect(host.textContent).toContain('修飾キー');
+ expect(onShowToast).toHaveBeenCalledWith('表示言語を日本語に変更しました');
+
+ // Render WelcomeScreen in Japanese and toggle back to English
+ await act(async () => {
+ root!.render(
+ <WelcomeScreen
+ userName="Sora"
+ onNewDocument={() => {}}
+ onOpenFile={() => {}}
+ showToast={onShowToast}
+ />
+ );
+ await new Promise((r) => setTimeout(r, 0));
+ });
+
+ expect(host.textContent).toContain('新規キャンバス');
+ expect(host.textContent).toContain('ファイルを開く');
+
+ const toggleBtn = host.getByTestId('welcome-language-toggle');
+ expect(toggleBtn).not.toBeNull();
+ expect(toggleBtn!.textContent).toContain('EN');
+
+ await act(async () => {
+ toggleBtn!.click();
+ await Promise.resolve();
+ });
+
+ expect(getResolvedLanguage()).toBe('en');
+ expect(miniDoc.documentElement.lang).toBe('en');
+ expect(host.textContent).toContain('New Canvas');
+ expect(host.textContent).toContain('Open File');
+ });
+ });
+});
diff --git a/src/i18n/index.ts b/src/i18n/index.ts
new file mode 100644
index 0000000..84a1aac
--- /dev/null
+++ b/src/i18n/index.ts
@@ -0,0 +1,408 @@
+import { useCallback, useSyncExternalStore } from 'react';
+import {
+ AppLanguage,
+ ImeKeyboardEventLike,
+ ResolvedLanguage,
+ TranslationParams,
+} from './types';
+import { JA_DICTIONARY } from './ja';
+
+export type { AppLanguage, ImeKeyboardEventLike, ResolvedLanguage, TranslationParams };
+
+export const VALID_APP_LANGUAGES: ReadonlySet<AppLanguage> = new Set<AppLanguage>([
+ 'auto',
+ 'en',
+ 'ja',
+]);
+
+export const DEFAULT_APP_LANGUAGE: AppLanguage = 'auto';
+
+const SETTINGS_STORAGE_KEY = 'ink_studio_app_settings';
+
+function isTestRuntime(): boolean {
+ try {
+ if (
+ typeof import.meta !== 'undefined' &&
+ (import.meta as unknown as { env?: { MODE?: string; VITEST?: boolean } }).env
+ ) {
+ const env = (import.meta as unknown as { env: { MODE?: string; VITEST?: boolean } }).env;
+ if (env.MODE === 'test' || env.VITEST) return true;
+ }
+ } catch {
+ // ignore
+ }
+ try {
+ const g = globalThis as unknown as { process?: { env?: Record<string, string | undefined> } };
+ if (g.process?.env?.VITEST || g.process?.env?.NODE_ENV === 'test') {
+ return true;
+ }
+ } catch {
+ // ignore
+ }
+ return false;
+}
+
+export function sanitizeAppLanguage(raw: unknown): AppLanguage {
+ if (raw === 'auto' || raw === 'en' || raw === 'ja') {
+ return raw;
+ }
+ if (typeof raw === 'string') {
+ const lower = raw.trim().toLowerCase();
+ if (lower === 'ja' || lower.startsWith('ja-') || lower === 'jp' || lower === 'japanese') {
+ return 'ja';
+ }
+ if (lower === 'en' || lower.startsWith('en-') || lower === 'english') {
+ return 'en';
+ }
+ if (lower === 'auto' || lower === 'system') {
+ return 'auto';
+ }
+ }
+ return DEFAULT_APP_LANGUAGE;
+}
+
+/**
+ * Detects the user's system/browser UI language.
+ * In Vitest test runs, defaults to `'en'` unless explicit `overrideLanguages` are provided
+ * so existing tests remain deterministic regardless of the host OS locale.
+ */
+export function detectSystemLanguage(
+ overrideLanguages?: readonly string[]
+): ResolvedLanguage {
+ if (!overrideLanguages && isTestRuntime()) {
+ return 'en';
+ }
+ const candidates: string[] = [];
+ if (overrideLanguages) {
+ candidates.push(...overrideLanguages);
+ } else if (typeof navigator !== 'undefined') {
+ if (Array.isArray(navigator.languages)) {
+ candidates.push(...navigator.languages);
+ }
+ if (typeof navigator.language === 'string') {
+ candidates.push(navigator.language);
+ }
+ }
+ for (const tag of candidates) {
+ const normalized = String(tag || '').trim().toLowerCase();
+ if (!normalized) continue;
+ if (normalized === 'ja' || normalized.startsWith('ja-') || normalized.startsWith('ja_')) {
+ return 'ja';
+ }
+ if (normalized === 'en' || normalized.startsWith('en-') || normalized.startsWith('en_')) {
+ return 'en';
+ }
+ }
+ return 'en';
+}
+
+export function resolveLanguage(
+ preference: AppLanguage,
+ overrideNavigatorLanguages?: readonly string[]
+): ResolvedLanguage {
+ if (preference === 'ja') return 'ja';
+ if (preference === 'en') return 'en';
+ return detectSystemLanguage(overrideNavigatorLanguages);
+}
+
+function readStoredLanguagePreference(): AppLanguage {
+ try {
+ if (typeof localStorage === 'undefined' || typeof localStorage.getItem !== 'function') {
+ return DEFAULT_APP_LANGUAGE;
+ }
+ const raw = localStorage.getItem(SETTINGS_STORAGE_KEY);
+ if (!raw) return DEFAULT_APP_LANGUAGE;
+ const parsed = JSON.parse(raw) as { language?: unknown };
+ return sanitizeAppLanguage(parsed?.language);
+ } catch {
+ return DEFAULT_APP_LANGUAGE;
+ }
+}
+
+export function applyLanguageToDocument(lang: ResolvedLanguage): void {
+ if (typeof document === 'undefined' || !document.documentElement) return;
+ try {
+ document.documentElement.lang = lang;
+ document.documentElement.dataset.lang = lang;
+ } catch {
+ // Ignore read-only document mocks in unit tests
+ }
+}
+
+interface I18nState {
+ preference: AppLanguage;
+ resolved: ResolvedLanguage;
+}
+
+const initialPref = readStoredLanguagePreference();
+let currentState: I18nState = {
+ preference: initialPref,
+ resolved: resolveLanguage(initialPref),
+};
+
+applyLanguageToDocument(currentState.resolved);
+
+const listeners = new Set<() => void>();
+
+function notifyListeners(): void {
+ listeners.forEach((fn) => fn());
+}
+
+export function subscribeLanguage(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => {
+ listeners.delete(listener);
+ };
+}
+
+export function getLanguagePreference(): AppLanguage {
+ return currentState.preference;
+}
+
+export function getResolvedLanguage(): ResolvedLanguage {
+ return currentState.resolved;
+}
+
+export function setLanguagePreference(preference: AppLanguage): ResolvedLanguage {
+ const sanitized = sanitizeAppLanguage(preference);
+ const resolved = resolveLanguage(sanitized);
+ const changed =
+ currentState.preference !== sanitized || currentState.resolved !== resolved;
+ currentState = { preference: sanitized, resolved };
+ applyLanguageToDocument(resolved);
+ if (changed) {
+ notifyListeners();
+ }
+ return resolved;
+}
+
+export function interpolate(template: string, params?: TranslationParams): string {
+ if (!params) return template;
+ return template.replace(/\{([a-zA-Z0-9_]+)\}/g, (match, key: string) => {
+ if (!Object.prototype.hasOwnProperty.call(params, key)) return match;
+ const val = params[key];
+ return val === null || val === undefined ? '' : String(val);
+ });
+}
+
+function lookupJa(key: string, context?: string): string {
+ if (context) {
+ const ctxKey = `${context}::${key}`;
+ const ctxHit = JA_DICTIONARY[ctxKey];
+ if (ctxHit !== undefined) return ctxHit;
+ }
+ const hit = JA_DICTIONARY[key];
+ if (hit !== undefined) return hit;
+ return key;
+}
+
+/**
+ * Translate a UI string into the active language.
+ * In English mode, returns the source key with `{var}` interpolation applied.
+ * In Japanese mode, looks up the native Japanese translation in `JA_DICTIONARY`.
+ */
+export function t(
+ key: string,
+ params?: TranslationParams,
+ langOverride?: ResolvedLanguage
+): string {
+ const lang = langOverride ?? currentState.resolved;
+ if (lang === 'en') {
+ return interpolate(key, params);
+ }
+ return interpolate(lookupJa(key), params);
+}
+
+/**
+ * Context-disambiguated translation for graphics/UI homonyms (e.g.
+ * `tc('blendMode', 'Normal')` -> `'通常'`, `tc('layerStyle', 'Stroke')` -> `'境界線'`).
+ */
+export function tc(
+ context: string,
+ key: string,
+ params?: TranslationParams,
+ langOverride?: ResolvedLanguage
+): string {
+ const lang = langOverride ?? currentState.resolved;
+ if (lang === 'en') {
+ return interpolate(key, params);
+ }
+ return interpolate(lookupJa(key, context), params);
+}
+
+/**
+ * Translates built-in dynamic data labels (such as built-in brush names, color sets,
+ * swatch names, auto actions, or look presets) while leaving unknown user-created names untouched.
+ */
+export function td(value: string, context?: string, langOverride?: ResolvedLanguage): string {
+ if (!value) return value;
+ const lang = langOverride ?? currentState.resolved;
+ if (lang === 'en') return value;
+ return lookupJa(value, context);
+}
+
+export function getLocaleTag(lang: ResolvedLanguage = currentState.resolved): string {
+ return lang === 'ja' ? 'ja-JP' : 'en-US';
+}
+
+export function formatLocaleDate(
+ date: Date | number | string,
+ options?: Intl.DateTimeFormatOptions,
+ lang: ResolvedLanguage = currentState.resolved
+): string {
+ const parsed = date instanceof Date ? date : new Date(date);
+ if (Number.isNaN(parsed.getTime())) return typeof date === 'string' ? date : '';
+ try {
+ return parsed.toLocaleDateString(
+ getLocaleTag(lang),
+ options ?? { year: 'numeric', month: 'short', day: 'numeric' }
+ );
+ } catch {
+ return parsed.toISOString().slice(0, 10);
+ }
+}
+
+export function formatLocaleDateTime(
+ date: Date | number | string,
+ options?: Intl.DateTimeFormatOptions,
+ lang: ResolvedLanguage = currentState.resolved
+): string {
+ const parsed = date instanceof Date ? date : new Date(date);
+ if (Number.isNaN(parsed.getTime())) return typeof date === 'string' ? date : '';
+ try {
+ return parsed.toLocaleString(getLocaleTag(lang), options);
+ } catch {
+ return parsed.toISOString();
+ }
+}
+
+export function formatLocaleNumber(
+ value: number,
+ options?: Intl.NumberFormatOptions,
+ lang: ResolvedLanguage = currentState.resolved
+): string {
+ if (!Number.isFinite(value)) return String(value);
+ try {
+ return value.toLocaleString(getLocaleTag(lang), options);
+ } catch {
+ return String(value);
+ }
+}
+
+export function formatRelativeTime(
+ timestamp?: number,
+ lang: ResolvedLanguage = currentState.resolved
+): string {
+ if (!timestamp || !Number.isFinite(timestamp)) return '';
+ const diffMs = Date.now() - timestamp;
+ if (diffMs < 60_000) return t('Just now', undefined, lang);
+ if (diffMs < 3_600_000) {
+ return t('{n}m ago', { n: Math.floor(diffMs / 60_000) }, lang);
+ }
+ if (diffMs < 86_400_000) {
+ return t('{n}h ago', { n: Math.floor(diffMs / 3_600_000) }, lang);
+ }
+ const days = Math.floor(diffMs / 86_400_000);
+ if (days === 1) return t('Yesterday', undefined, lang);
+ if (days < 7) return t('{n}d ago', { n: days }, lang);
+ return formatLocaleDate(timestamp, { month: 'short', day: 'numeric' }, lang);
+}
+
+/**
+ * Returns true if the keyboard event occurred during active IME composition
+ * (e.g. Japanese Kana-Kanji conversion on Windows/macOS/Linux).
+ * Prevents Enter/Escape/shortcut keys from misfiring while composing Japanese text.
+ */
+export function isImeComposing(e: ImeKeyboardEventLike | null | undefined): boolean {
+ if (!e) return false;
+ return Boolean(
+ e.isComposing ||
+ e.nativeEvent?.isComposing ||
+ e.keyCode === 229 ||
+ e.nativeEvent?.keyCode === 229 ||
+ e.key === 'Process'
+ );
+}
+
+/**
+ * Reactive React hook returning the active resolved language (`'en' | 'ja'`).
+ */
+export function useLanguage(): ResolvedLanguage {
+ return useSyncExternalStore(
+ subscribeLanguage,
+ getResolvedLanguage,
+ getResolvedLanguage
+ );
+}
+
+/**
+ * Reactive React hook returning the user's language setting (`'auto' | 'en' | 'ja'`).
+ */
+export function useLanguagePreference(): AppLanguage {
+ return useSyncExternalStore(
+ subscribeLanguage,
+ getLanguagePreference,
+ getLanguagePreference
+ );
+}
+
+/**
+ * Main reactive React hook for components. Subscribes to language changes so
+ * switching between English and Japanese updates the entire UI immediately.
+ */
+export function useI18n() {
+ const lang = useLanguage();
+ const languagePreference = useLanguagePreference();
+
+ const boundT = useCallback(
+ (key: string, params?: TranslationParams) => t(key, params, lang),
+ [lang]
+ );
+
+ const boundTc = useCallback(
+ (context: string, key: string, params?: TranslationParams) =>
+ tc(context, key, params, lang),
+ [lang]
+ );
+
+ const boundTd = useCallback(
+ (value: string, context?: string) => td(value, context, lang),
+ [lang]
+ );
+
+ const boundFormatDate = useCallback(
+ (date: Date | number | string, options?: Intl.DateTimeFormatOptions) =>
+ formatLocaleDate(date, options, lang),
+ [lang]
+ );
+
+ const boundFormatDateTime = useCallback(
+ (date: Date | number | string, options?: Intl.DateTimeFormatOptions) =>
+ formatLocaleDateTime(date, options, lang),
+ [lang]
+ );
+
+ const boundFormatNumber = useCallback(
+ (value: number, options?: Intl.NumberFormatOptions) =>
+ formatLocaleNumber(value, options, lang),
+ [lang]
+ );
+
+ const boundFormatRelativeTime = useCallback(
+ (timestamp?: number) => formatRelativeTime(timestamp, lang),
+ [lang]
+ );
+
+ return {
+ lang,
+ languagePreference,
+ isJapanese: lang === 'ja',
+ t: boundT,
+ tc: boundTc,
+ td: boundTd,
+ formatDate: boundFormatDate,
+ formatDateTime: boundFormatDateTime,
+ formatNumber: boundFormatNumber,
+ formatRelativeTime: boundFormatRelativeTime,
+ };
+}
diff --git a/src/i18n/ja/brushes.ts b/src/i18n/ja/brushes.ts
new file mode 100644
index 0000000..78694e9
--- /dev/null
+++ b/src/i18n/ja/brushes.ts
@@ -0,0 +1,1539 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_BRUSHES: TranslationDictionary = {
+ // ===========================================================================
+ // 1. Contextual Disambiguation Keys
+ // ===========================================================================
+ 'pressure::linear': 'リニア',
+ 'pressure::soft': '柔らかめ',
+ 'pressure::hard': '硬め',
+
+ 'pressureShort::Lin': '直線',
+ 'pressureShort::G': 'G',
+ 'pressureShort::Soft': '弱',
+ 'pressureShort::Firm': '硬',
+ 'pressureShort::Hard': '強',
+
+ 'renderMode::stamp': 'スタンプ',
+ 'renderMode::bristle-ribbon': '剛毛リボン',
+ 'renderMode::bristle-hybrid': '剛毛ハイブリッド',
+
+ 'bristleProfile::round': '丸筆',
+ 'bristleProfile::flat': '平筆',
+ 'bristleProfile::filbert': 'フィルバート',
+ 'bristleProfile::fan': '扇筆',
+ 'bristleProfile::rake': 'レーキ',
+ 'bristleProfile::knife': 'ナイフ',
+ 'bristleProfile::custom': 'カスタム',
+
+ 'angleDynamics::Stroke': '線の向き',
+ 'flip::Alt': '交互',
+ 'flip::Rand': 'ランダム',
+ 'grainMap::Flow': 'ストローク追従',
+ 'textureMode::Compare': '濃度比較',
+ 'textureMode::Height': '高さ',
+ 'textureMode::Outline': '輪郭',
+ 'dualBlend::Lin Burn': 'リニア焼込',
+ 'dualBlend::Col Burn': '焼込カラー',
+
+ 'mixingMode::Blend': '混色',
+ 'mixingMode::Running': '色延び',
+ 'mixingMode::Smear': 'にじみ',
+ 'mixingMode::Impasto': '厚塗り',
+
+ 'brushCategory::pen': 'ペン',
+ 'brushCategory::sketch': '鉛筆・スケッチ',
+ 'brushCategory::brush': '筆・ブラシ',
+ 'brushCategory::blend': '色混ぜ・ぼかし',
+ 'brushCategory::natural-paint': '厚塗り・リアル画材',
+ 'brushCategory::texture-fx': '質感・エフェクト',
+ 'brushCategory::deco-background': '背景',
+ 'brushCategory::deco-clothing': '衣装・レース',
+ 'brushCategory::deco-effect': '効果',
+ 'brushCategory::custom': '読み込み・カスタム',
+ 'brushCategory::eraser': '消しゴム',
+
+ 'blendMode::Behind': '背景',
+ 'blendMode::Clear': '消去',
+ 'blendMode::Compare Density': '濃度比較',
+
+ 'fill::Scale': '拡縮',
+ 'gradientType::linear': '直線',
+ 'gradientType::radial': '円形',
+ 'gradientType::mesh': 'メッシュ',
+
+ 'shapeDrawMode::stroke': '線',
+ 'shapeDrawMode::fill': '塗り',
+ 'shapeDrawMode::both': '線と塗り',
+ 'shapeDrawMode::Stroke': '線',
+
+ 'penMode::draw': '描画',
+ 'penMode::edit': '制御点編集',
+
+ 'lineCap::Round': '丸型',
+ 'lineCap::Flat': 'フラット',
+ 'lineCap::Square': '突出',
+
+ 'lineJoin::Sharp': 'マイター(鋭角)',
+ 'lineJoin::Round': 'ラウンド(丸)',
+ 'lineJoin::Bevel': 'ベベル(面取り)',
+
+ 'balloonShape::ellipse': '楕円',
+ 'balloonShape::rounded rect': '角丸長方形',
+ 'balloonShape::jagged flash': 'ギザギザ(フラッシュ)',
+ 'balloonShape::thought': '心の声(もくもく)',
+
+ 'vectorEditMode::pinch': '線つまみ',
+ 'vectorEditMode::width': '線幅修正',
+ 'vectorEditMode::simplify': '線の単純化',
+
+ 'tool::brush': 'ブラシ',
+ 'tool::eraser': '消しゴム',
+ 'tool::decoration': 'デコレーション',
+ 'tool::eyedropper': 'スポイト',
+ 'tool::hand': '手のひら',
+ 'tool::zoom': 'ズーム',
+ 'tool::rotate': '回転',
+ 'tool::move': 'レイヤー移動',
+ 'tool::fill': '塗りつぶし',
+ 'tool::gradient': 'グラデーション',
+ 'tool::retouch': 'レタッチ',
+ 'tool::pen': 'ベクターペン',
+ 'tool::shape': '図形',
+ 'tool::liquify': 'ゆがみ',
+ 'tool::select-rect': '長方形選択',
+ 'tool::select-lasso': '投げなわ選択',
+ 'tool::select-wand': '自動選択',
+ 'tool::select-pen': '選択ペン',
+ 'tool::select-eraser': '選択範囲消し',
+ 'tool::text': 'テキスト',
+ 'tool::transform': '変形',
+ 'tool::object': 'オブジェクト',
+ 'tool::frame': 'コマ枠',
+ 'tool::balloon': 'フキダシ',
+ 'tool::vector-edit': '線修正',
+ 'tool::3d': '3D',
+ 'tool::ruler': '定規',
+ 'tool::perspective-ruler': 'パース定規',
+ 'tool::symmetry': '対称定規',
+ 'tool::crop': '切り抜き',
+
+ // ===========================================================================
+ // 2. Built-in Brush Sections, Categories, Badges & Group Tag Swatches
+ // ===========================================================================
+ Pen: 'ペン',
+ Sketch: '鉛筆・スケッチ',
+ Brush: 'ブラシ',
+ Blend: '色混ぜ',
+ 'Natural Paint': '厚塗り・リアル画材',
+ Natural: 'リアル画材',
+ Paint: '厚塗り',
+ 'Texture & FX': '質感・エフェクト',
+ FX: '効果',
+ Background: '背景',
+ Clothing: '衣装・レース',
+ Effect: '効果',
+ Imported: '読み込み',
+ 'Imported / Custom': '読み込み・カスタム',
+ Favorites: 'お気に入り',
+ Eraser: '消しゴム',
+ 'Standard Eraser Tool': '標準の消しゴムツール',
+
+ // Badges
+ Oil: '油彩',
+ Dry: 'ドライ',
+ Acrylic: 'アクリル',
+ Knife: 'ナイフ',
+ Matte: 'マット',
+ Water: '水彩',
+ Pastel: 'パステル',
+ Ribbon: 'リボン',
+ Fan: '扇筆',
+ Ink: 'インク',
+ Foliage: '植物',
+ Portrait: '人物',
+ Texture: 'テクスチャ',
+ Sky: 'スカイブルー',
+ Glow: '発光',
+
+ // Group Tag Swatches & Quick Colors
+ Default: '標準',
+ Indigo: 'インディゴ',
+ Emerald: 'エメラルド',
+ Amber: 'アンバー',
+ Rose: 'ローズ',
+ Violet: 'バイオレット',
+ White: '白',
+ Black: '黒',
+ 'Soft White': 'オフホワイト',
+ Red: '赤',
+
+ // ===========================================================================
+ // 3. Built-in Preset Brushes (presetBrushes.ts — 34 Presets)
+ // ===========================================================================
+ 'G-Pen': 'Gペン',
+ 'Classic CSP G-Pen — Razor-Sharp Pressure Taper & Pen Tilt Swell':
+ '王道のGペン。筆圧によるシャープな入り抜きとペンの傾きによる強弱を再現します。',
+
+ 'Real G-Pen': 'リアルGペン',
+ 'Authentic CSP Dip-Pen Nib — Jagged Porous Mask, Concave J-Curve & Pressure Nib Spread':
+ 'つけペン風のリアルGペン。わずかなにじみとエッジのざらつき、筆圧によるペン先の開きを再現します。',
+
+ 'Textured Pen': 'ざらつきペン',
+ 'Authentic CSP Textured Pen — Random-Rotated Elliptical Nib with Compare-Density Edge Tooth':
+ '楕円先端のランダム回転と濃度比較による紙の引っかかりを持つ、味わい深いざらつきペンです。',
+
+ 'Rough Pen': '荒ペン',
+ 'CSP Ribbon Rough Ink Pen — Organic Tiling Ink Strand with Pressure, Tilt & Velocity Dynamics':
+ '有機的なリボン質感を備えた荒ペン。筆圧・傾き・速度に応じて表情豊かなインク線を描けます。',
+
+ 'Dot Pen': 'ドットペン',
+ '1-Bit Pixel Crisp Binary Pen (Zero Anti-Aliasing)':
+ 'アンチエイリアスなしのくっきりとした1ピクセル二値ペンです。',
+
+ Calligraphy: 'カリグラフィ',
+ 'Broad-Edge Angled Chisel Nib with Thick/Thin Directional Contrast':
+ '斜めカットの平ペン先。ストローク方向に応じた美しい太細のコントラストを生み出します。',
+
+ 'Mechanical Pencil': 'シャープペンシル',
+ 'Firm 0.5mm Lead — Thin, Tilt-Independent, Crisp Edge & Minimal Grain':
+ '0.5mm芯のような硬めの描き味。傾きの影響を抑えたシャープな輪郭と繊細な粒状感です。',
+
+ 'HB / 2B Pencil': 'HB / 2B 鉛筆',
+ 'Classic Graphite — Moderate Tooth, Smooth Pressure Flow & Gentle Tilt Shading':
+ '標準的な黒鉛鉛筆。程よい紙の凹凸感となめらかな筆圧変化、自然な傾きシェーディングに対応します。',
+
+ '6B / 8B Pencil': '6B / 8B 鉛筆',
+ 'Rich Soft Graphite — Strong Paper Tooth, Heavy-Pressure Clog & Broad Tilt Edge':
+ '濃く柔らかい黒鉛鉛筆。強い紙目と筆圧による塗り込み、寝かせ描きによる広い陰影表現に最適です。',
+
+ 'Charcoal Pencil': '木炭鉛筆',
+ 'Deep Matte Dry Carbon — Jagged Edge, Aggressive Tooth, Edge Crumbs & Tilt Shading':
+ '深くマットなドライカーボン質感。荒いエッジと強い紙目、粉の飛び散りや傾き塗りに対応します。',
+
+ 'Standard Chalk': 'チョーク',
+ 'Powdery Dry Chalk Stick — Heavy Mineral Tooth & Tilt Shading':
+ '粉っぽいドライチョーク。粗めの紙質感とペンの傾きによる面塗りに適しています。',
+
+ 'Alla-Prima Oil Flat': 'アラプリマ平筆(油彩)',
+ 'Asymmetric Flat Hog-Bristle — Crisp Architectural Edge & Feathered Tail for Lost-and-Found Planes':
+ '非対称の豚毛平筆。シャープなエッジと柔らかな抜けを両立し、メリハリのある面塗りに最適です。',
+
+ 'Loaded Impasto Oil': '厚塗り油彩',
+ 'Chiseled Multi-Tuft Hog-Bristle Filbert — Bold Impasto Ridges & Rich Directional Color Drag':
+ 'たっぷり絵具を含ませた剛毛フィルバート。力強い盛り上がり(マチエール)と豊かな色引きを再現します。',
+
+ 'Dry Bristle Rake': 'ドライ剛毛レーキ',
+ 'Separated Organic Bristle Clusters — Expressive Dry Highlights, Cheek Scratches, Hair & Fabric Tooth':
+ '毛先が割れたドライ剛毛ブラシ。ハイライトのかすれ、髪の流れ、布地の質感表現に活躍します。',
+
+ 'Concept Matte Chalk / Gouache': 'コンセプトマットチョーク/ガッシュ',
+ 'Sculptural Chipped Square Chalk + Mineral Dual Brush — Crisp Concept-Art Planes & Velvety Matte Tooth':
+ '欠けた角型チョークと質感デュアルブラシの組み合わせ。コンセプトアートの立体面とマットな肌理に最適です。',
+
+ 'Silky Portrait Round': 'シルキーポートレート丸筆',
+ 'Creamy Organic Portrait Round — Luminous Skin Glazing, Rose Petals & Velvety Pigment Blend':
+ 'なめらかな人物画向け丸筆。透明感のある肌のグレーズや柔らかな顔料混色に適しています。',
+
+ 'Canvas Scumble / Old Master': 'キャンバス・スカンブル(古典油彩)',
+ 'Multi-Tip Dry-Oil Scumble — Broken-Color Tweed, Umber Grounds & Linen Peak Patina':
+ '複数先端によるドライ油彩の擦り塗り。麻布の凹凸に色を乗せる古典技法を再現します。',
+
+ 'Soft Glaze Airbrush': 'ソフトグレーズエアブラシ',
+ 'Silky Zero-Banding Airbrush — Atmospheric Halation, Soft Shadow Glazes & Luminous Glow':
+ '滑らかな階調のエアブラシ。空気感の演出、柔らかい影のグレーズ、自然な発光表現に最適です。',
+
+ 'Atmospheric Grain Shader': '粒子グレインシェーダー',
+ 'Organic Mineral-Cloud Stipple — Dusty Skies, Painterly Film Grain & Textured Mist':
+ '有機的な点描粒状ブラシ。霞んだ空や絵画的なフィルム粒子、表情のある霧の描写に向いています。',
+
+ 'Detail & Specular Liner': 'ディテール&ハイライト細筆',
+ 'Springy Tapered Sable Detail Filbert — Crisp Gold Filigree, Eyelashes & Glowing Specular Glints':
+ 'コシのあるセーブル細筆。金属装飾、まつ毛、瞳のキャッチライトなど精密な描き込みに最適です。',
+
+ 'Velvet Skin Blend': 'ベルベット肌なじませ',
+ 'Silky Optical Skin Blender — Soft CSP Blur Diffusion & Kubelka-Munk Tonal Harmony':
+ '滑らかな肌用ブレンダー。柔らかな光学ぼかしと自然な顔料調色により、濁りの少ない階調を作ります。',
+
+ 'Oil Bristle Smudge': '油彩剛毛スマッジ',
+ 'Directional Flat Bristle Smudger — Pulls & Blends Wet Oil While Keeping Brushwork Alive':
+ '筆跡を生かしたまま濡れた油絵具を伸ばして混ぜる、方向性のある平筆スマッジです。',
+
+ 'Matte Chalk Blender': 'マットチョークブレンダー',
+ 'Velvety Concept-Art Chalk Blender — Melts Hard Planes into Soft Matte Gradients with Tooth Intact':
+ '紙目を残しながら面の境界を滑らかなマット階調へ溶け込ませるチョーク系ブレンダーです。',
+
+ 'Rake Hair & Fur Smear': 'レーキ髪・毛並み延ばし',
+ 'Fine Multi-Strand Rake Blender — Pulls Wispy Hair, Mane, Fur & Feather Threads Across Edges':
+ '細かな多毛レーキ型ブレンダー。髪の毛先や動物の毛並み、羽根の繊維を自然に引き延ばします。',
+
+ 'Canvas Scumble Melter': 'キャンバス質感なじませ',
+ 'Porous Dry-Bristle Scumble Blender — Dissolves Hard Edges Directly into Authentic Canvas Grain':
+ '多孔質のドライ剛毛で、硬い境界をキャンバス地に溶け込ませるようになじませます。',
+
+ 'Wet Finger Tip': '濡れ指先',
+ 'CSP Finger Tip Smudger — Firm Directional Paint Pulling for Flowing Hair, Mist & Long Trails':
+ 'しっかりと絵具を引き延ばす指先ツール。流れる髪や霧、長い色引きの表現に適しています。',
+
+ 'Impasto Bristle Oil': '厚塗り剛毛油彩',
+ 'Thick Tactile Oil Paint with Pronounced 3D Bristle Ridges, Specular Sheen & Linen Weave Fringes':
+ '立体的な筆跡の凹凸と油彩特有の光沢、麻布のカスレを備えた本格厚塗り油彩ブラシです。',
+
+ 'Creamy Oil Filbert': 'クリーミー油彩フィルバート',
+ 'Buttery Oil Filbert with Per-Bristle Spatial Color Pickup & Vibrant Multi-Color Curved Streaks':
+ '毛束ごとの色拾いに対応した滑らかなフィルバート筆。鮮やかな多色混色ストロークを描けます。',
+
+ 'Stiff Separated Bristles with Crisp Parallel Tracks, Paint Exhaustion & Linen Weave Breakup':
+ '硬く分かれた毛先が描くシャープな平行スジと、絵具切れ・麻布のかすれを再現します。',
+
+ 'Heavy Body Acrylic': 'ヘビーボディアクリル',
+ 'Opaque Springy Flat Bristle Acrylic with Crisp Edges, Satin Relief & Controlled Wet Blending':
+ '不透明でコシのあるアクリル平筆。シャープなエッジ、サテン調の凹凸、コントロールしやすい混色を備えます。',
+
+ 'Palette Knife': 'ペインティングナイフ',
+ 'Sharp-Edged Painting Knife with Heavy Border Paint Ridges & Bold Spatial Scraping':
+ '鋭いエッジと縁の厚塗り盛り上がり、大胆な削り・引き延ばしを再現するペインティングナイフです。',
+
+ 'Velvet Gouache': 'ベルベットガッシュ',
+ 'Smooth Matte Opaque Gouache with Gentle Wet Reactivation & Fine Gesso Tooth':
+ '不透明でマットなベルベット調ガッシュ。柔らかな再溶解と繊細なジェッソ地の質感を備えます。',
+
+ 'Granulating Watercolor': '分離水彩',
+ 'Translucent Watercolor Glaze with Wet Edge Rim & Pigment Settling into Cold-Press Valleys':
+ '水彩境界と紙の凹みへの顔料沈殿(グラニュレーション)を再現する透明水彩ブラシです。',
+
+ 'Dry Bristle Blender': 'ドライ剛毛ブレンダー',
+ 'Zero-Load Physical Fan Bristle Blender — Pulls & Harmonizes Paint with Relief Grooves Intact':
+ '絵具量ゼロの物理扇筆ブレンダー。厚塗りの筆跡溝を残したまま絵具を引き延ばして調和させます。',
+
+ 'Soft Oil Pastel': 'ソフトオイルパステル',
+ 'Creamy Oil Pastel with Broad Stylus Tilt Shading & Crisp Coverage Across Rough Paper Peaks':
+ 'クリーミーなオイルパステル。傾きによる広い面塗りと粗い紙の凹凸への鮮やかな乗りが特徴です。',
+
+ // ===========================================================================
+ // 4. Built-in Pro Preset Brushes (proPresetBrushes.ts — 36 Presets)
+ // ===========================================================================
+ 'Soft Tapered Liner': 'ソフト入り抜きライナー',
+ 'Silky Painted-Ink Sable Nib — Razor Start/End Taper for Hair Wisps, Glasses & Painterly Lineart':
+ '滑らかなセーブル調ライナー。シャープな入り抜きで髪のほつれや絵画調の線画に最適です。',
+
+ 'Sumi Brush Pen': '墨筆ペン',
+ 'Expressive Wolf-Hair Fude Brush — Juicy Ink Pools with Organic Dry-Paper Bristle Breakup':
+ '表情豊かな狼毛風筆ペン。墨だまりの潤みと紙面での自然なカスレ(掠れ)を再現します。',
+
+ 'Silk Thread Multi-Line': '絹糸マルチライン',
+ 'Flowing 5-Filament Embroidery Ribbon — Curved Gold Veil Patterns, Filigree & Hair Ribbons':
+ '5本糸が流れるリボンブラシ。刺繍模様や金細工の装飾、髪のハイライト線に活躍します。',
+
+ 'Hair Strand & Lash': '毛束・まつ毛ペン',
+ 'Gossamer 3-Filament Hair Liner — Natural Flyaway Strands, Wispy Bangs, Brows & Eyelashes':
+ '極細の3本毛先ライナー。自然なアホ毛や前髪、眉・まつ毛の繊細な描き込みに最適です。',
+
+ 'Vine Charcoal Wash': '柳木炭ウォッシュ',
+ 'Velvety Soft Willow Charcoal — Sweeping Chiaroscuro Value Washes & Smoky Portrait Grounds':
+ '柔らかな柳木炭ブラシ。大胆な明暗の調子づけやスモーキーな下地作りに適しています。',
+
+ 'Flat Charcoal Block': '平木炭ブロック',
+ 'Snapped Square Carbon Stick — Razor Chisel Corner for Planes & Broad Matte Tilt Shading':
+ '角型チャコールスティック。鋭い角での面取りと、寝かせた広いマット陰影を自在に切り替えられます。',
+
+ 'Conté Crayon': 'コンテクレヨン',
+ 'Old Master Wax-Mineral Crayon — Creamy Life-Drawing Buildup & Crisp Gesso Tooth':
+ '古典デッサン風のコンテクレヨン。クリーミーな重ね塗りと心地よい下地のかすれを再現します。',
+
+ 'Animation Sketch Pencil': 'アニメーター鉛筆',
+ 'Smooth Waxy Col-Erase Rough Pencil — Effortless Gesture Lines, Character Roughs & Clean Tooth':
+ '描き心地の軽いラフ用色鉛筆。ジェスチャードローイングやキャラクターのラフ線に最適です。',
+
+ 'Hard Square Block-In': 'ハード角筆ブロックイン',
+ 'Architectural Chisel Square — Crisp Facial Planes, Cast Shadows & Faceted Metallic Reflections':
+ 'エッジの効いた角筆ブラシ。顔の面構成、落ち影、硬質な金属反射のブロックインに最適です。',
+
+ 'Painterly Gouache Flat': '絵画風ガッシュ平筆',
+ 'Layered Opaque-Watercolor Flat — Overlapping Translucent Cloth Folds with Subtle Wet-Edge Pooling':
+ '半透明の重ね塗りに適したガッシュ平筆。布のシワやわずかな水彩境界の重なりを自然に描けます。',
+
+ 'Hard Round Pressure Painter': '硬質丸筆(筆圧塗り)',
+ 'Pro Digital Painting Workhorse — Crisp Tapered Oval with Smooth Pressure Opacity & Perceptual Glazing':
+ 'デジタルペイントの定番丸筆。滑らかな筆圧不透明度と顔料グレーズで幅広い塗りに対応します。',
+
+ 'Silky Hair & Fur Locks': 'シルキー毛束ブラシ',
+ 'Tapered Multi-Strand Sable Hair Brush — Glossy Layered Bangs, Flowing Locks & Soft Fur':
+ '先端がすぼまる多毛セーブルブラシ。艶やかな前髪や流れる毛束、柔らかなファー描写に最適です。',
+
+ 'Dry-Brush Hair Sheen': 'ドライブラシ天使の輪',
+ 'Textured Flat Highlight Bristle + Mineral Dual Brush — Luminous Crown Hair Sheen & Silk Shimmer':
+ '質感平筆とデュアルブラシによるハイライト専用筆。髪の艶(天使の輪)や絹の光沢を自然に描けます。',
+
+ 'Expressive Concept Bristle': 'エクスプレッシブ剛毛',
+ '4-Tip Fractured Hog-Bristle + Dual Tooth — Sweeping Fantasy Cloaks, Moody Skies & Bold Concept Strokes':
+ '4種の割れ豚毛先端とデュアル質感による表現力豊かな剛毛。マントや空、大胆なコンセプト画に最適です。',
+
+ 'Wedge & Chisel Painter': 'くさび平筆ペインター',
+ 'Asymmetric Diagonal Bevel Wedge — Razor Architectural Leading Corner & Soft Feathered Gouache Heel':
+ '斜めカットの非対称くさび筆。鋭い先端エッジと柔らかい後端のボケを1ストロークで両立します。',
+
+ 'Soft Watercolor Wash': 'ソフト水彩ウォッシュ',
+ 'Organic Translucent Mop Glaze — Wet-Edge Pigment Pooling & Delicate Cold-Press Bloom':
+ '透明感のあるモップ筆ウォッシュ。水彩境界の縁溜まりと中目水彩紙のにじみを繊細に再現します。',
+
+ 'Silky Blush & Skin Airbrush': 'シルキーチーク&肌エアブラシ',
+ 'Perceptual Subsurface Skin Airbrush — Luminous Cheek Blush, Nose Warmth & Silky Atmospheric Halos':
+ '血色感を引き出す肌用エアブラシ。頬のチークや鼻先の赤み、柔らかな光のにじみに最適です。',
+
+ 'Metallic & Gold Impasto': 'メタリック&ゴールド厚塗り',
+ 'Crisp Hammered-Facet Lozenge — Gold Coins, Chrome Chokers, Wet Lip Highlights & Eye Catchlights':
+ '硬質なひし形ファセット筆。金装飾や金属光沢、濡れた唇のハイライト、瞳の光点に最適です。',
+
+ 'Charcoal Blending Stump': '擦筆(さっぴつ)',
+ 'Rolled-Paper Tortillon Stump — Rubs Charcoal & Graphite into Velvety Shadows While Keeping Paper Tooth':
+ '紙巻きの擦筆ブレンダー。紙の凹凸を残したまま木炭や鉛筆をベルベット状の陰影へ擦り広げます。',
+
+ 'Painterly Gouache Melter': 'ガッシュなじませ平筆',
+ 'Feathered Flat Gouache Blender — Softens Hard Folds & Hair-to-Skin Transitions Without Plastic Blur':
+ 'プラスチック的なぼやけを避けつつ、服のシワや髪と肌の境界を絵画的に柔らかくつなぐブレンダーです。',
+
+ 'Atmospheric Mist & Smoke Smudge': '霧・煙スマッジ',
+ 'Turbulent Cloud-Wisp Smudger — Pulls Paint into Curling Dark Smoke, Magic Vapor & Drifting Fog':
+ 'うねる雲状のスマッジブラシ。絵具を引き延ばして立ち昇る煙や魔法の蒸気、漂う霧を表現できます。',
+
+ 'Palette Knife Smudge': 'パレットナイフスマッジ',
+ 'Sharp-Edged Knife Scraper Blender — Pulls Crisp Architectural Paint Planes, Water & Cloth Streaks':
+ '鋭いエッジで絵具を削り伸ばすナイフブレンダー。硬質な面や水面、布のシャープな筋描きに最適です。',
+
+ 'Wide Hog-Bristle Flat': 'ワイド豚毛平筆',
+ 'Broad Chiseled Alla-Prima Hog Flat — Bold Architectural 3D Oil Planes with Crisp Paint Ridges':
+ '幅広の豚毛平筆。力強い3D油彩のマチエールとシャープな筆跡エッジで面を一気に構成できます。',
+
+ 'Splayed Bristle Fan': '広がり剛毛ファン筆',
+ 'Wide Splayed Physical Fan Brush — Organic Foliage, Pine Needles, Grass & Expressive Hair Sweeps':
+ '毛先が広がった物理ファンブラシ。木の葉、針葉、草むら、大胆な髪の動きの表現に活躍します。',
+
+ 'Sumi Ink Wash': '水墨ウォッシュ',
+ 'Fluid East Asian Sumi Bristle — Rich Wet-Edge Paper Bloom with Dry Flying-White Exhaustion':
+ '瑞々しい東洋墨筆。紙への豊かなにじみと、筆速・絵具切れによる飛白(かすれ)を再現します。',
+
+ 'Matte Casein & Tempera': 'マットカゼイン&テンペラ',
+ 'Velvety Zero-Gloss Casein Illustration Paint — Opaque Creamy Coverage & Dry Gesso Scumble':
+ '艶消しのカゼイン・テンペラ絵具。不透明でクリーミーな発色とドライなジェッソかすれが魅力です。',
+
+ 'Painterly Canopy Leaves': '絵画風木の葉ブラシ',
+ '4-Tip Hand-Painted Botanical Leaves — Scattered Forest Canopies with Subtle Sunlight Color Jitter':
+ '4種の手描き葉先端による木立ブラシ。木漏れ日を感じさせる自然な色変化で森の樹冠を描けます。',
+
+ 'Bokeh Soft Leaves': 'ボケ前景リーフ',
+ 'Out-of-Focus Depth-of-Field Leaves — Cinematic Foreground Framing & Drifting Wind-Blown Foliage':
+ '被写界深度のボケを再現した木の葉ブラシ。映画的な前景フレームや風に舞う葉の演出に最適です。',
+
+ 'Skin Freckles & Pores': 'そばかす・肌質感',
+ '4-Tip Organic Micro-Constellations — Realistic Portrait Freckles, Nose-Bridge Speckle & Skin Pores':
+ '4種の微細パターンでリアルなそばかすや鼻筋の点描、自然な肌の毛穴感を加えます。',
+
+ 'Dark Smoke & Vapor': '黒煙・ヴェイパー',
+ '4-Tip Domain-Warped Turbulent Smoke + Dual Erosion Mask — Necrotic Tendrils, Fog & Magic Mist':
+ 'うねる煙先端と浸食デュアルマスクにより、立ち込める黒煙や霧、魔法の瘴気を描けます。',
+
+ 'Craggy Rock & Weathered Bone': '岩肌・風化テクスチャ',
+ '4-Tip Fractured Mineral Shards + Dual Tooth — Jagged Mountains, Skull Pauldrons & Ancient Metal':
+ '4種の砕石先端とデュアル質感で、ごつごつした岩山や風化した骨・古金属の質感を描き出します。',
+
+ 'Ash, Embers & Ink Spatter': '灰・火の粉・飛沫',
+ '4-Tip Organic Splatter Constellations — Swirling Fire Embers, Volcanic Ash, Snow & Ink Spray':
+ '4種の有機的な飛沫パターン。舞い上がる火の粉、火山灰、雪、インクの飛び散り表現に最適です。',
+
+ 'Painterly Cumulus Clouds': '絵画風入道雲',
+ '4-Tip Sculpted Sky Puffs — Crisp Sunlit Upper Billows & Soft Atmospheric Bases for Epic Skies':
+ '光を受けるくっきりした輪郭と柔らかな雲底を併せ持つ、4先端構成の入道雲ブラシです。',
+
+ 'Woven Cloth & Brocade Grain': '織物・ブロケード質感',
+ 'Cross-Woven Textile & Twill Pad — Embroidered Sleeves, Medieval Cloaks & Tapestry Weave Highlights':
+ '綾織り・織布パターンの質感ブラシ。刺繍入りの衣装やマント、タペストリーの織り目表現に最適です。',
+
+ 'Luminous Magic & Rim Glow': '魔法発光・リムグロウ',
+ 'Optical Add-Glow Point-Spread Bloom — Glowing Magic Lanterns, Backlit Rim Light & Sunbeams':
+ '加算(発光)による光の広がりブラシ。魔法の光、ランタン、逆光のリムライトや光芒に最適です。',
+
+ 'Fine Film & Stipple Dust': 'フィルム粒子・微細ダスト',
+ '3-Tip Stochastic Micro-Stipple Dust — Tactile Portrait Film Grain, Dust Motes & Subtle Finish':
+ '3種の微細点描粒子。仕上げのフィルムグレインや宙に舞う塵、絵画的な手触りを加えます。',
+
+ // ===========================================================================
+ // 5. Built-in Decoration Brushes (decorationBrushes.ts — 26 Presets)
+ // ===========================================================================
+ Building: 'ビル群',
+ 'Multi-tip manga cityscape buildings with primary outline and secondary fill':
+ '描画色の主線と背景色の塗りで描ける、複数先端の漫画向け街並み・ビル群ブラシです。',
+
+ Cloud: '雲',
+ 'Soft scattered cloud clusters for sky backgrounds':
+ '空の背景に使える柔らかな雲の散布ブラシです。',
+
+ Grass: '草むら',
+ 'Randomized grass tuft scatter for ground and foliage':
+ '地面や茂みに使えるランダム散布の草むらブラシです。',
+
+ Trees: '木立・森林',
+ 'Multi-tip tree silhouettes for instant forest backgrounds':
+ '素早く森の背景を描ける複数先端の樹木シルエットブラシです。',
+
+ 'Star Lace': '星柄レース',
+ 'Continuous ribbon star-pattern lace trim':
+ '星模様が連なるリボン型のレースブラシです。',
+
+ 'Sakura Lace': '桜レース',
+ 'Continuous ribbon cherry-petal lace trim':
+ '桜の花びら模様が連なるリボン型レースブラシです。',
+
+ 'Cross Lace': 'クロスレース',
+ 'Continuous ribbon gothic cross lace trim':
+ 'ゴシック調の十字架模様が連なるリボン型レースブラシです。',
+
+ 'Rope Ribbon': 'ロープリボン',
+ 'Dual-tone twisted rope ribbon trim':
+ '2色対応のねじりロープ飾りリボンブラシです。',
+
+ 'Sheer Scallop': 'シアースカラップ',
+ 'Dual-tone delicate sheer scalloped lace ribbon':
+ '2色対応の繊細な透け感スカラップレースリボンです。',
+
+ 'Scallop Trim Lace': 'スカラップ縁レース',
+ 'Dual-tone scalloped trim lace ribbon':
+ '2色対応のスカラップ縁取りレースリボンです。',
+
+ 'Scallop Lace': 'スカラップレース',
+ 'Dual-tone classic scallop lace ribbon':
+ '2色対応の定番スカラップレースリボンです。',
+
+ 'Ornate Scallop': '装飾スカラップ',
+ 'Dual-tone ornate scalloped lace ribbon':
+ '2色対応の華やかな装飾スカラップレースリボンです。',
+
+ 'Simple Lace': 'シンプルレース',
+ 'Dual-tone clean simple lace trim ribbon':
+ '2色対応のすっきりしたシンプルレースリボンです。',
+
+ 'Decorative Rope': '飾りロープ',
+ 'Dual-tone braided decorative cord ribbon':
+ '2色対応の編み込み飾り紐リボンブラシです。',
+
+ 'Rose Trim': 'ローズ縁レース',
+ 'Dual-tone rose floral lace trim ribbon':
+ '2色対応のバラ模様レースリボンブラシです。',
+
+ 'Standard Lace 1': '標準レース 1',
+ 'Detailed eyelet ribbon lace trim':
+ '細かなアイレット模様のリボンレースです。',
+
+ 'Standard Lace 2': '標準レース 2',
+ 'Wide floral scallop ribbon lace':
+ '幅広の花柄スカラップリボンレースです。',
+
+ 'Standard Lace 3': '標準レース 3',
+ 'Fine scalloped border ribbon lace':
+ '繊細なスカラップ縁のリボンレースです。',
+
+ 'Standard Lace 4': '標準レース 4',
+ 'Ornate embroidery ribbon lace':
+ '華やかな刺繍調のリボンレースです。',
+
+ 'Standard Lace 5': '標準レース 5',
+ 'Delicate frill border ribbon lace':
+ '繊細なフリル縁のリボンレースです。',
+
+ 'Standard Lace 6': '標準レース 6',
+ 'Layered crochet ribbon lace':
+ '重なり合うかぎ針編み風のリボンレースです。',
+
+ 'Classic Lace': 'クラシックレース',
+ 'Classic frilled ribbon lace':
+ 'クラシックなフリル付きリボンレースです。',
+
+ Bloodstain: '血しぶき',
+ 'Multi-tip directional splatter and bloodstain spray':
+ '複数先端による方向性のある飛沫・血しぶき散布ブラシです。',
+
+ Cherry: '桜吹雪',
+ 'Dual-tone fluttering cherry blossom petals':
+ '2色対応の舞い散る桜の花びらブラシです。',
+
+ Feather: 'ぼかし',
+ 'Multi-tip floating feathers with gentle spray scatter':
+ '複数先端でふんわり舞う羽根の散布ブラシです。',
+
+ Roses: 'バラの花',
+ 'Multi-tip dual-tone blooming roses scatter':
+ '2色対応・複数先端の咲き誇るバラ散布ブラシです。',
+
+ // ===========================================================================
+ // 6. Surface Texture Library, Gradient Presets, Pressure Curve & Font Labels
+ // ===========================================================================
+ 'Linen Canvas': '麻キャンバス',
+ 'High-DPI woven primed Belgian linen with spun fibers & slubs':
+ '繊維の節と織り目を緻密に再現した下地塗りベルギー麻キャンバスです。',
+
+ 'Coarse Burlap': '粗目ジュート布',
+ 'Heavy twisted-yarn rustic canvas weave with deep valleys':
+ '太い撚り糸と深い凹みを持つ素朴な粗目キャンバスです。',
+
+ 'Fine Cotton': '細目綿キャンバス',
+ 'Smooth tight-weave primed cotton duck with gesso micro-tooth':
+ 'きめ細かく織られた綿キャンバスにジェッソの微細な肌理を加えた紙質です。',
+
+ 'Cold-Press Paper': '水彩紙(中目)',
+ 'Domed cotton fibers with granulating micro-valleys':
+ '顔料が沈殿しやすい微細な凹みを持つコットン水彩紙(中目)です。',
+
+ 'Rough Pastel': '荒目パステル紙',
+ 'Toothy laid charcoal and pastel paper with crisp ridges':
+ 'シャープな畝と強い引っかかりを持つ木炭・パステル向け荒目紙です。',
+
+ 'Gesso Board': 'ジェッソボード',
+ 'Cross-brushed primed wood panel with fine bristle striations':
+ '刷毛目を交差させて下地塗りした木製パネル(ジェッソボード)です。',
+
+ 'Stipple Grain': '点描グレイン',
+ 'Organic high-DPI mineral & fine film grain':
+ '高精細な鉱物粒子と微細なフィルムグレインの紙質です。',
+
+ // Gradient Presets
+ 'FG to BG': '描画色から背景色',
+ 'FG to Clear': '描画色から透明色',
+ Sunset: '夕焼け',
+ Chrome: 'クローム',
+ Spectrum: 'スペクトラム',
+
+ // Pressure Curve Preset Labels
+ 'G-Pen S-Curve': 'Gペン S字カーブ',
+ 'Soft Touch': 'ソフトタッチ',
+ 'Firm Nib': '硬めのペン先',
+ 'Steep Threshold': '急峻なしきい値',
+
+ // Text Font Preset Labels
+ 'Sans Clean': 'サンセリフ(標準)',
+ 'Segoe UI / System': 'Segoe UI / システム',
+ 'Arial / Helvetica': 'Arial / Helvetica',
+ 'Georgia Serif': 'Georgia セリフ',
+ 'Manga / Comic': '漫画・コミック',
+ 'Impact (SFX)': 'Impact(擬音・見出し)',
+ Monospace: '等幅フォント',
+ 'Japanese Gothic (游ゴシック)': '日本語ゴシック(游ゴシック)',
+ 'Japanese Mincho (游明朝)': '日本語明朝(游明朝)',
+ 'Japanese UI Sans (BIZ UDゴシック)': '日本語UIゴシック(BIZ UD)',
+ 'Japanese Manga (明朝・縦書き)': '日本語漫画(明朝・縦書き)',
+
+ // ===========================================================================
+ // 7. Sub-Tool List, Groups, Drag & Drop, Context Menus & Shortcuts
+ // ===========================================================================
+ 'Sub Tool': 'サブツール',
+ 'Sub Tool Group': 'サブツールグループ',
+ 'Sub Tool Shortcut': 'サブツールショートカット',
+ 'Sub Tool options for {name} (move group, shortcut, export)':
+ '「{name}」のサブツール設定(グループ移動・ショートカット・書き出し)',
+ '+ Group': '+ グループ',
+ '+ Add Sub Tools': '+ サブツールを追加',
+ '+ Create New Group': '+ 新規グループを作成',
+ 'New Group': '新規グループ',
+ 'New Group with Brush...': 'ブラシ付きで新規グループ作成...',
+ 'Custom Group {n}': 'カスタムグループ {n}',
+ 'Create Custom Sub Tool Group': 'カスタムサブツールグループを作成',
+ 'Create Custom Sub Tool Group (click or drag any brush here)':
+ 'カスタムサブツールグループを作成(クリック、またはブラシをドラッグ)',
+ 'Created Sub Tool group "{name}"': 'サブツールグループ「{name}」を作成しました',
+ 'Created "{group}" with "{brush}"': '「{brush}」を含むグループ「{group}」を作成しました',
+ 'Rename Group': 'グループ名を変更',
+ 'Delete Group': 'グループを削除',
+ 'Delete Sub Tool Group': 'サブツールグループを削除',
+ 'Delete custom group "{name}"?': 'カスタムグループ「{name}」を削除しますか?',
+ 'Deleted group "{name}"': 'グループ「{name}」を削除しました',
+ 'This removes the empty custom Sub Tool group.':
+ '空のカスタムサブツールグループを削除します。',
+ 'Its 1 sub tool will safely return to their default sections.':
+ '含まれる1個のサブツールは元のセクションに安全に戻されます。',
+ 'Its {count} sub tools will safely return to their default sections.':
+ '含まれる{count}個のサブツールは元のセクションに安全に戻されます。',
+ 'Cancel creating group': 'グループ作成をキャンセル',
+ 'Group Shortcut': 'グループショートカット',
+ 'Group Tag Color': 'グループタグカラー',
+ 'Group shortcut: {shortcut}': 'グループショートカット: {shortcut}',
+ 'Group: {name}': 'グループ: {name}',
+ 'Tag:': 'タグ:',
+ 'Color {label}': 'カラー: {label}',
+ 'Move Group Left': 'グループを左へ移動',
+ 'Move Group Right': 'グループを右へ移動',
+ 'Move to Sub Tool Group': 'サブツールグループへ移動',
+ 'Move to {group}': '「{group}」へ移動',
+ 'Moved "{name}" to "{group}"': '「{name}」を「{group}」に移動しました',
+ 'Return to Default Section': '元のセクションに戻す',
+ 'Returned "{name}" to default section': '「{name}」を元のセクションに戻しました',
+ 'Add or manage brushes in "{name}"': '「{name}」のブラシを追加・管理',
+ 'Assign brushes to “{name}”': '「{name}」にブラシを割り当て',
+ 'Drag any brush here or add sub tools':
+ 'ここにブラシをドラッグするか、サブツールを追加してください',
+ 'Drag any brush here to add to {label}':
+ 'ここにブラシをドラッグして「{label}」に追加',
+ 'Show all Sub Tool groups': 'すべてのサブツールグループを表示',
+ 'Show all Decoration sub tools': 'すべてのデコレーションサブツールを表示',
+ '{label} sub tools — Drag any brush here to move it into {label}':
+ '{label}のサブツール — ブラシをドラッグして「{label}」に移動',
+ '{label} decoration brushes — Drag any brush here to move it into {label}':
+ '{label}のデコレーションブラシ — ブラシをドラッグして「{label}」に移動',
+ 'Imported & custom brushes — Drag any brush here to move it into Imported':
+ '読み込み・カスタムブラシ — ブラシをドラッグして「読み込み」に移動',
+ '{name} (double-click to rename, right-click for options)':
+ '{name}(ダブルクリックで名前変更・右クリックでオプション)',
+ '{name}{shortcut} — Drag brushes here or right-click for options':
+ '{name}{shortcut} — ブラシをドラッグ、または右クリックでオプション',
+ '{name} — {desc}{shortcut} · Drag to move or reorder':
+ '{name} — {desc}{shortcut} · ドラッグで移動・並び替え',
+ '{name}{shortcut} · Drag to move or reorder':
+ '{name}{shortcut} · ドラッグで移動・並び替え',
+ 'Reorder (before)': '並び替え(前へ)',
+ 'Reorder (after)': '並び替え(後ろへ)',
+ '{badge} brush': '{badge}ブラシ',
+ 'Options for "{name}"': '「{name}」のオプション',
+ 'Options for {name}': '{name}のオプション',
+ 'Create New Brush in Brush Studio': 'ブラシスタジオで新規ブラシを作成',
+ 'Edit Active Brush in Brush Studio': '選択中のブラシをブラシスタジオで編集',
+ 'Edit in Brush Studio': 'ブラシスタジオで編集',
+ 'Open Brush Studio': 'ブラシスタジオを開く',
+ 'Open Full Brush Studio': 'ブラシスタジオを開く',
+ 'New Natural Brush': '新規リアル画材ブラシ',
+ 'New Decoration Brush': '新規デコレーションブラシ',
+ 'Custom Brush': 'カスタムブラシ',
+ '{name} Copy': '{name} のコピー',
+ 'Duplicate Active Brush': '選択中のブラシを複製',
+ 'Reset Brush to Default': 'ブラシを初期設定に戻す',
+ 'Reset Active Brush to Default': '選択中のブラシを初期設定に戻す',
+ 'Reset brush to default': 'ブラシを初期設定に戻す',
+ 'Brush reset to default': 'ブラシを初期設定に戻しました',
+ 'Delete Brush': 'ブラシを削除',
+ 'Delete brush': 'ブラシを削除',
+ 'Are you sure you want to delete this brush?': 'このブラシを削除してもよろしいですか?',
+ 'This permanently removes the brush from your library and cannot be undone.':
+ 'ライブラリから完全に削除されます。この操作は元に戻せません。',
+ 'Import Brush': 'ブラシを読み込み',
+ 'Import Brush (.inkb, .sut)': 'ブラシを読み込み (.inkb, .sut)',
+ 'Drop .inkb / .sut': '.inkb / .sut をドロップ',
+ 'Importing...': '読み込み中...',
+ 'Import failed': '読み込みに失敗しました',
+ 'Brush Import Failed': 'ブラシの読み込みに失敗しました',
+ 'Failed to import brush file.': 'ブラシファイルの読み込みに失敗しました。',
+ 'Import warning': '読み込みの注意',
+ 'Imported custom brush': 'カスタムブラシを読み込みました',
+ 'Imported "{name}"': '「{name}」を読み込みました',
+ 'Imported brush "{name}"': 'ブラシ「{name}」を読み込みました',
+ 'Imported "{name}" into "{group}"': '「{name}」を「{group}」に読み込みました',
+ 'Imported "{name}" (Notice: {notice})': '「{name}」を読み込みました(注意: {notice})',
+ 'Imported "{name}" with {count} CSP import notices':
+ '「{name}」を読み込みました(CSP読み込み注意: {count}件)',
+ 'Imported "{name}" with {count} CSP import notices — check inspector':
+ '「{name}」を読み込みました(CSP読み込み注意: {count}件 — インスペクターで確認)',
+ '1 CSP import notice': 'CSP読み込み注意 1件',
+ '{count} CSP import notices': 'CSP読み込み注意 {count}件',
+ 'CSP Import Notices ({count})': 'CSP読み込み注意({count}件)',
+ 'Export (.inkb)': '書き出し (.inkb)',
+ 'Export .inkb': '.inkb 書き出し',
+ 'Export Active Brush (.inkb)': '選択中のブラシを書き出し (.inkb)',
+ 'Export {name} (.inkb)': '「{name}」を書き出し (.inkb)',
+ 'Exported {fileName}': '{fileName} を書き出しました',
+ 'Export failed': '書き出しに失敗しました',
+ 'Brush Export Failed': 'ブラシの書き出しに失敗しました',
+ 'Failed to export brush.': 'ブラシの書き出しに失敗しました。',
+ 'Saved brush "{fileName}"': 'ブラシ「{fileName}」を保存しました',
+ 'Saved preset "{name}"': 'プリセット「{name}」を保存しました',
+
+ // Sub-Tool Shortcut Modal
+ 'Set Shortcut...': 'ショートカットを設定...',
+ 'Set Shortcut for {target}': '「{target}」のショートカット設定',
+ 'Close shortcut recorder': 'ショートカット設定を閉じる',
+ 'Current:': '現在の設定:',
+ 'Press any key combination...': '任意のキーの組み合わせを押してください...',
+ 'Supports Ctrl, {osKey}, Shift, Alt · Esc to cancel':
+ 'Ctrl・{osKey}・Shift・Alt に対応 · Esc でキャンセル',
+ '+ {osKey} Key': '+ {osKey} キー',
+ '+ {osKey} Key (Active)': '+ {osKey} キー(有効)',
+ 'Toggle {osKey} key modifier for the next key press':
+ '次のキー入力に対する {osKey} 修飾キーを切り替えます',
+ '{shortcut} is already assigned to {targets}. Replace it?':
+ '{shortcut} はすでに {targets} に割り当てられています。置き換えますか?',
+ Replace: '置き換え',
+ 'Clear Shortcut': 'ショートカットを解除',
+ 'Shortcut assigned: {shortcut}': 'ショートカットを設定しました: {shortcut}',
+ 'Shortcut cleared': 'ショートカットを解除しました',
+ 'Shortcut: {shortcut}': 'ショートカット: {shortcut}',
+
+ // ===========================================================================
+ // 8. Quick Brush Panel & Settings
+ // ===========================================================================
+ 'Quick Brush Panel': 'クイックブラシパネル',
+ 'Quick-Access Brush Panel': 'クイックブラシパネル',
+ 'Quick Brush Panel Settings': 'クイックブラシパネル設定',
+ 'Quick-Access Brush Panel Settings': 'クイックブラシパネル設定',
+ 'Close Quick Brush Settings': 'クイックブラシ設定を閉じる',
+ 'Show Quick-Access Brush Panel (Shift+B)': 'クイックブラシパネルを表示 (Shift+B)',
+ 'Hide Quick-Access Brush Panel (Shift+B)': 'クイックブラシパネルを非表示 (Shift+B)',
+ 'Hide Quick Brush Panel': 'クイックブラシパネルを非表示',
+ 'Hide Quick Brush Panel (Shift+B)': 'クイックブラシパネルを非表示 (Shift+B)',
+ 'Quick Brush Panel hidden (Shift+B to reopen)':
+ 'クイックブラシパネルを非表示にしました(Shift+B で再表示)',
+ 'Lock Quick Brush Panel': 'クイックブラシパネルをロック',
+ 'Unlock Quick Brush Panel': 'クイックブラシパネルのロック解除',
+ 'Quick Brush Panel locked': 'クイックブラシパネルをロックしました',
+ 'Quick Brush Panel unlocked': 'クイックブラシパネルのロックを解除しました',
+ 'Lock Panel Position & Brushes': 'パネル位置とブラシ構成をロック',
+ 'Lock position & brush list': '位置とブラシ一覧をロック',
+ 'Panel locked — unlock to drag or flip orientation':
+ 'ロック中 — 解除すると移動や向きの切替ができます',
+ 'Drag to move panel • Double-click to flip Vertical / Horizontal':
+ 'ドラッグで移動 • ダブルクリックで縦・横を切り替え',
+ 'Panel Settings': 'パネル設定',
+ 'Panel Label': 'パネルラベル',
+ 'Panel Opacity': 'パネル不透明度',
+ 'Show panel label (horizontal)': 'パネルラベルを表示(横向き時)',
+ 'Show brush names': 'ブラシ名を表示',
+ 'Category color accents': 'カテゴリー色アクセントを表示',
+ 'Show Hide/Show UI button on bar': 'バーにUI表示切替ボタンを表示',
+ 'Keep visible when UI hidden (Tab)': 'UI非表示時(Tab)も表示を維持',
+ 'Stay on canvas when all palettes are hidden':
+ 'パレット一括非表示中もキャンバス上に表示を維持します',
+ 'Show All Palettes': 'すべてのパレットを表示',
+ 'Show All Palettes (Tab)': 'すべてのパレットを表示 (Tab)',
+ 'Hide All Other Palettes': '他のパレットをすべて非表示',
+ 'Hide All Other Palettes (Tab)': '他のパレットをすべて非表示 (Tab)',
+ 'Snap to Edge': '端にスナップ',
+ 'Reset Panel': 'パネルをリセット',
+ 'Quick Brush Panel reset to defaults': 'クイックブラシパネルを初期設定に戻しました',
+ Orientation: '向き',
+ 'Tile Size': 'タイルサイズ',
+ 'Preview Style': 'プレビュー表示',
+ 'Stroke Curve': 'ストローク曲線',
+ 'Pinned ({count})': 'ピン留め({count})',
+ 'Brushes ({count})': 'ブラシ({count})',
+ 'Add Active': '使用中を追加',
+ 'Active Pinned': '使用中は追加済',
+ '+ Pin Eraser': '+ 消しゴムを追加',
+ 'Eraser Pinned': '消しゴム追加済',
+ 'Clear all pinned brushes': 'ピン留めブラシをすべて解除',
+ 'No brushes pinned yet. Pick any brush below or click the star in Sub Tool.':
+ 'ピン留めされたブラシはありません。下から選択するか、サブツールの星アイコンをクリックしてください。',
+ 'Add brushes to Quick-Access Brush Panel': 'クイックブラシパネルにブラシを追加',
+ 'Add {name} to Quick Brush Panel': '「{name}」をクイックブラシパネルに追加',
+ 'Added "{name}" to Quick Brush Panel': '「{name}」をクイックブラシパネルに追加しました',
+ 'Added "{name}" to Quick Brushes': '「{name}」をクイックブラシに追加しました',
+ '"{name}" is already in Quick Brushes': '「{name}」はすでにクイックブラシに追加されています',
+ 'Pin to Quick Brushes': 'クイックブラシにピン留め',
+ '+ Pin to Quick Brushes': '+ クイックブラシにピン留め',
+ 'Unpin from Quick Brushes': 'クイックブラシから解除',
+ 'Remove from Quick Brushes': 'クイックブラシから削除',
+ 'Remove from Panel': 'パネルから削除',
+ 'Remove {name}': '「{name}」を削除',
+ 'Remove {name} from Quick Brush Panel': '「{name}」をクイックブラシパネルから削除',
+ 'Remove {name} from Quick Brushes': '「{name}」をクイックブラシから削除',
+ 'Removed "{name}" from Quick Brush Panel': '「{name}」をクイックブラシパネルから削除しました',
+ 'Removed "{name}" from Quick Brushes': '「{name}」をクイックブラシから削除しました',
+ 'Manage Brushes...': 'ブラシを管理...',
+ 'Search brushes...': 'ブラシを検索...',
+ 'Search brushes to add...': '追加するブラシを検索...',
+ 'Search brush presets': 'ブラシプリセットを検索',
+ 'No matching brushes': '一致するブラシがありません',
+ 'Move Up': '上へ移動',
+ 'Move Down': '下へ移動',
+ 'Move Left': '左へ移動',
+ 'Move Right': '右へ移動',
+ 'Move earlier': '前へ移動',
+ 'Move later': '後ろへ移動',
+
+ // ===========================================================================
+ // 9. Brush Size Palette, Floating Brush Pill, Pressure Curve & Pigment Blend
+ // ===========================================================================
+ 'Brush Size': 'ブラシサイズ',
+ 'Brush size [{name}]': 'ブラシサイズ [{name}]',
+ 'Brush Size Options': 'ブラシサイズオプション',
+ 'Current: {size} px': '現在: {size} px',
+ 'Reset Size to Default': 'サイズを初期値に戻す',
+ 'Brush Size ([ / ]): {size}px': 'ブラシサイズ ([ / ]): {size}px',
+ 'Brush Size: {size}px (Drag · Shift for fine · Double-click to reset)':
+ 'ブラシサイズ: {size}px(ドラッグ・Shiftで微調整・ダブルクリックでリセット)',
+ 'Opacity: {pct}% (Drag · Shift for fine · Double-click to reset)':
+ '不透明度: {pct}%(ドラッグ・Shiftで微調整・ダブルクリックでリセット)',
+ 'Strength: {pct}% (Drag · Shift for fine · Double-click to reset)':
+ '強さ: {pct}%(ドラッグ・Shiftで微調整・ダブルクリックでリセット)',
+ 'Active Color (Click to swap Primary/Secondary)':
+ '選択中の色(クリックで描画色・背景色を入れ替え)',
+ 'Swap Primary and Secondary Colors': '描画色と背景色を入れ替え',
+ 'Paint with Transparent Ink (C)': '透明色で描画(消しゴム効果)(C)',
+ 'Erase Ink': '透明色',
+ 'Color On': '描画色',
+
+ // Pressure Curve Editor
+ 'Global Pen Pressure Curve': '筆圧検知レベルの調整',
+ 'Output Y / Input X': '出力 Y / 入力 X',
+ 'Input 0%': '入力 0%',
+ 'In {inPct}% -> Out {outPct}%': '入力 {inPct}% → 出力 {outPct}%',
+ 'Live Stylus Test Strip': 'ライブ筆圧テスト',
+ 'Clear test strip': 'テスト領域をクリア',
+ 'Draw with pen (or drag left-to-right with mouse) to test size & opacity':
+ 'ペンで描く(またはマウスで左右にドラッグ)とサイズと不透明度を確認できます',
+ 'Click curve to add point, drag to adjust, double-click interior point to remove':
+ 'クリックで点を追加、ドラッグで調整、中間点をダブルクリックで削除',
+
+ // Pigment Blend Control
+ 'Color Blending': '色混ぜ方式',
+ Blending: '混色方式',
+ 'Pigment Strength': '顔料強度',
+ Pigment: '顔料',
+ Regular: '通常RGB',
+ 'Blue + Yellow': '青 + 黄',
+ 'Navy + White': '紺 + 白',
+ 'Crimson + Yellow': '深紅 + 黄',
+ 'FG + BG': '描画色 + 背景色',
+ '{pair} (Pigment {pct}%) — Click to cycle preview colors':
+ '{pair}(顔料 {pct}%)— クリックでプレビュー色を切替',
+ '{pair} (Regular RGB) — Click to cycle preview colors':
+ '{pair}(通常RGB)— クリックでプレビュー色を切替',
+
+ // ===========================================================================
+ // 10. Brush Studio Modal, Scratchpad, Primary & Secondary Tabs
+ // ===========================================================================
+ 'Brush Studio': 'ブラシスタジオ',
+ 'Brush Studio — {name}': 'ブラシスタジオ — {name}',
+ 'Brush Studio Sections': 'ブラシスタジオ項目',
+ 'Close Brush Studio (Esc)': 'ブラシスタジオを閉じる (Esc)',
+ 'Shape & Bristles': '先端・剛毛',
+ 'Stroke & Taper': 'ストローク・入り抜き',
+ 'Texture & Grain': '紙質・グレイン',
+ 'Dual Brush': 'デュアルブラシ',
+ 'Impasto & Wet': '厚塗り・水彩境界',
+ 'Sensor Matrix': '筆圧・ダイナミクス',
+ 'About & Presets': '概要・プリセット',
+ 'Save New': '新規保存',
+ 'Save New Preset': '新規プリセットとして保存',
+ 'Reset All Brush Settings': 'すべてのブラシ設定をリセット',
+
+ // Scratchpad
+ 'Sumi Ink': '墨インク',
+ 'Prussian Blue': 'プルシアンブルー',
+ 'Vermilion Red': 'バーミリオン',
+ 'Cadmium Yellow': 'カドミウムイエロー',
+ 'Ultramarine Violet': 'ウルトラマリンバイオレット',
+ 'Paper White Surface': '白紙サーフェス',
+ 'Mid-Grey Surface': 'グレーサーフェス',
+ 'Dark Studio Surface': 'ダークサーフェス',
+ 'Scratchpad Surface': '試し描きサーフェス',
+ Grey: 'グレー',
+ 'Test ink: {label}': '試し描きインク: {label}',
+ 'Use active foreground color': '現在の描画色を使用',
+ 'Active foreground ink ({color})': '現在の描画色 ({color})',
+ 'Clear Scratchpad': '試し描きをクリア',
+ 'Wash dirty pigment off bristles': '筆に付いた混色絵具を洗う',
+ Clean: '筆を洗う',
+ '{surface} — Draw & overlap strokes': '{surface} — 線を描いて重ね塗りをテスト',
+ '{pct}% spc': '間隔 {pct}%',
+ '{pct}% load': '絵具量 {pct}%',
+
+ // Primary Tabs — Shape & Bristles
+ 'Engine & Tip Profile': 'エンジン・ブラシ先端',
+ 'Render Mode': '描画モード',
+ Stamp: 'スタンプ',
+ 'Bristle Ribbon': '剛毛リボン',
+ 'Bristle Hybrid': '剛毛ハイブリッド',
+ 'Primary Tip Shape': 'メインブラシ先端',
+ 'Upload Tip': '先端を読み込み',
+ 'Use Rake Tip': 'レーキ先端を使用',
+ 'Multi-Tip Atlas': 'マルチ先端リスト',
+ 'Combine up to 16 sequential or random tip shapes':
+ '最大16個の先端形状を順番またはランダムに組み合わせて描画します',
+ '{count} tips': '{count}個',
+ 'Add Tip': '先端を追加',
+ 'Sub-Tip Order': '先端の適用順',
+ Sequential: '順番',
+ 'Remove sub-tip {n}': '先端 {n} を削除',
+ 'Bristle Architecture': '剛毛構造',
+ '{count} strands': '{count}本',
+ 'Brush Tip Profile': '筆先の形状',
+ Round: '丸筆',
+ Flat: 'フラット',
+ Filbert: 'フィルバート',
+ Rake: 'レーキ',
+ 'Bristle Count': '毛束の本数',
+ 'Bristle Clumping': '毛先のまとまり',
+ Stiffness: '毛のコシ(硬さ)',
+ 'Pressure / Tilt Splay': '筆圧・傾きによる広がり',
+ 'Strand Irregularity': '毛先のばらつき',
+ 'Tip Geometry & Orientation': '先端形状・向き',
+ 'Thickness (Aspect)': '厚さ(縦横比)',
+ 'Thickness Axis': '厚さの向き',
+ 'Tip Angle': '先端角度',
+ Tip: '先端',
+ '{label} active': '{label}(有効)',
+ 'Angle Dynamics': '向きの影響元',
+ 'This brush rotates': 'ブラシカーソルを回転',
+ 'Rotate the brush cursor preview to track brush direction':
+ '描画方向に合わせてブラシカーソルを回転表示します',
+ 'Rotate the brush cursor silhouette as you move to track brush direction':
+ 'ブラシの進行方向に合わせてカーソル輪郭を回転表示します',
+ 'Flip Horizontal': '左右反転',
+ 'Flip Vertical': '上下反転',
+ 'Flip H': '左右反転',
+ 'Flip V': '上下反転',
+ 'Blend Tips': '先端の合成方法',
+
+ // Primary Tabs — Stroke & Taper
+ 'Stroke Path & Smoothing': 'ストローク・手ブレ補正',
+ 'Gap (Spacing)': '間隔',
+ 'Brush Density': 'ブラシ濃度',
+ 'Adjust by Gap': '間隔によって濃度を調整',
+ 'Streamline / Stabilization': '手ブレ補正',
+ 'Post-Correction': '後補正',
+ 'Sharp Angles': '角を尖らせる',
+ 'Preserve crisp corners instead of rounding':
+ '急な折り返しを丸めず鋭い角として維持します',
+ 'Bezier Smoothing': 'ベジェ曲線補正',
+ 'Anti-Aliasing': 'アンチエイリアス',
+ 'Anti-aliasing': 'アンチエイリアス',
+ 'Anti-Alias': 'アンチエイリアス',
+ Weak: '弱',
+ Med: '中',
+ Strong: '強',
+ 'Taper In & Taper Out': '入り抜き',
+ 'Enable Taper In': '入りを有効にする',
+ 'Taper In Length': '入りの長さ',
+ 'Start Sharpness': '入りの鋭さ',
+ 'Enable Taper Out': '抜きを有効にする',
+ 'Taper Out Length': '抜きの長さ',
+ 'End Sharpness': '抜きの鋭さ',
+ 'Taper In': '入り',
+ 'Taper Out': '抜き',
+ 'Taper Length': '入り抜きの長さ',
+ 'Affect Size': 'ブラシサイズに影響',
+ 'Affect Density / Opacity': '濃度・不透明度に影響',
+ 'Affect Paint Load (Dry Tail)': '絵具量(かすれ)に影響',
+ 'Spraying Effect': '散布効果',
+ 'Particle Size': '粒子サイズ',
+ 'Spray Density': '粒子密度',
+ Spray: '散布',
+
+ // Primary Tabs — Texture & Grain
+ 'Surface Texture Library': '紙質ライブラリ',
+ '512 × 512 seamless grain': '512×512 シームレス紙質',
+ 'Upload PNG': 'PNGを読み込み',
+ 'Grain & Paper Physics': '紙質・グレイン設定',
+ 'Grain Depth / Intensity': '紙質濃度',
+ 'Texture Scale': '拡大率',
+ 'Texture Mode': '紙質の適用方法',
+ 'Texture Blend Mode': '紙質合成モード',
+ 'Spatial Grain Mapping': '紙質の座標マッピング',
+ Fixed: 'キャンバス固定',
+ 'Dry-Brush Valley Cutoff': 'ドライブラシ凹みカット',
+ 'Valley Penetration Curve': '紙の凹みへの浸透カーブ',
+ 'Invert Texture': '紙質を反転',
+
+ // Primary Tabs — Dual Brush
+ 'Dual Brush Compositing': 'デュアルブラシ合成',
+ 'Modulate primary tip with a secondary tip shape':
+ 'メインブラシに2つ目の先端形状を組み合わせて質感を加えます',
+ 'Enable Dual Brush': 'デュアルブラシを有効にする',
+ 'Composite Blend Mode': '合成モード',
+ 'Dual Tip': 'サブ先端形状',
+ 'Import PNG/WebP': 'PNG/WebPを読み込み',
+ 'Dual Scale': 'サブブラシ倍率',
+ 'Dual Spacing': 'サブブラシ間隔',
+ 'Dual Scatter': 'サブブラシ散布',
+ 'Dual Angle': 'サブブラシ角度',
+ 'Secondary Dual Grain': 'サブ紙質テクスチャ',
+ 'Dual Grain Depth': 'サブ紙質濃度',
+
+ // Secondary Tabs — Natural Paint & Mixing
+ 'Natural Paint Engine': 'リアル画材エンジン',
+ 'Per-bristle pigment mixing, load capacity & dry-brush':
+ '毛束ごとの顔料混色、絵具の含み量、ドライブラシ表現を制御します',
+ 'Enable Natural Paint & Wet Mixing': 'リアル画材・ウェット混色を有効にする',
+ 'Mixing Mode': '混色モード',
+ 'Pigment & Reservoir Physics': '顔料・絵具量シミュレーション',
+ 'Paint Load': '絵具量',
+ 'Wetness / Pickup': '濡れ・色拾い',
+ 'Depletion Rate': '絵具の減りやすさ',
+ Viscosity: '絵具の粘度',
+ 'Charge per Pressure': '筆圧による補充量',
+ 'Per-Bristle Spatial Mixing': '毛束ごとの空間混色',
+ 'Each bristle picks up & drags local canvas color streaks':
+ '各毛先がキャンバス上の色を拾い、リアルな多色ストロークを引き延ばします',
+ 'Auto-Clean After Stroke': 'ストロークごとに筆を洗う',
+ 'Off keeps picked-up pigment on bristles across strokes':
+ 'オフにすると前のストロークで拾った絵具を次の筆運びへ引き継ぎます',
+ 'Optical Blend Blur': '光学ぼかし混色',
+ 'Isotropic smoothing on picked-up canvas color':
+ '拾い上げたキャンバス色を滑らかに均一化します',
+ 'Optical Blur': '光学ぼかし',
+ 'Blur Strength': 'ぼかし強度',
+ 'Blending & Mixing': '色混ぜ・混色',
+ 'Color Mixing': '色混ぜ',
+ 'Amount of Paint': '絵具量',
+ 'Density of Paint': '絵具濃度',
+ 'Color Stretch': '色延び',
+
+ // Secondary Tabs — Impasto & Wet Edge
+ '3D Impasto Relief': '3D厚塗りレリーフ',
+ 'Real-time paint heightmap with directional lighting & sheen':
+ '絵具の厚み(ハイトマップ)に指向性ライトと光沢をリアルタイム適用します',
+ 'Enable 3D Impasto Relief': '3D厚塗りレリーフを有効にする',
+ 'Impasto Depth': '厚塗りの深さ',
+ 'Bristle Groove Relief': '筆跡溝の凹凸',
+ 'Edge Ridge Buildup': 'エッジの盛り上がり',
+ 'Gloss / Oil Sheen': '油彩光沢(ツヤ)',
+ 'Relief Lighting Contrast': '立体ライティング強度',
+ 'Watercolor Wet Edge & Granulation': '水彩境界・分離(グラニュレーション)',
+ 'Watercolor Edge': '水彩境界',
+ 'Edge Width': '境界の幅',
+ 'Wet Edge Strength': '水彩境界の強さ',
+ 'Wet Edge Radius': '水彩境界の半径',
+ 'Paper-Valley Granulation': '紙目への顔料沈殿',
+
+ // Secondary Tabs — Dynamics & Sensor Matrix
+ 'Sensor-to-Property Matrix': '影響元センサー設定',
+ 'Flow / Density': 'インク量 / 濃度',
+ 'Bristle Splay': '毛先の広がり',
+ 'Grain Depth': '紙質濃度',
+ Scatter: '散布',
+ 'Stylus Pressure': '筆圧',
+ 'Tilt Altitude': '傾き(角度)',
+ 'Tilt Azimuth': '傾き(方位)',
+ 'Stroke Velocity': '速度',
+ 'Stroke Distance': '距離',
+ 'Random Variance': 'ランダム',
+ 'Minimum at Zero Pressure': '筆圧ゼロ時の最小値',
+ 'Response Curve': '応答カーブ',
+ 'Stamp & Color Jitter': 'スタンプ・色変化ジッター',
+ 'Size Jitter': 'サイズジッター',
+ 'Angle Jitter': '角度ジッター',
+ 'Roundness Jitter': '真円率ジッター',
+ 'Flow Jitter': 'インク量ジッター',
+ 'Scatter Both Axes': '両軸に散布',
+ 'Color Jitter': '色変化',
+ 'Enable Color Dynamics': '色変化を有効にする',
+ 'Hue Jitter': '色相の変化',
+ 'Saturation Jitter': '彩度の変化',
+ 'Lightness Jitter': '明度の変化',
+ 'Temperature Jitter': '色温度の変化',
+ 'FG / BG Mix': '描画色・背景色ミックス',
+ 'FG/BG': '描画/背景',
+
+ // Secondary Tabs — About & Presets
+ 'Brush Identity': 'ブラシ情報',
+ 'Brush Name': 'ブラシ名',
+ Category: 'カテゴリー',
+ Description: '説明',
+ "Describe this brush's physical feel, bristle setup, or surface interaction...":
+ 'このブラシの描き味、毛先構成、紙との相性などを記入...',
+ 'Preset & File Actions': 'プリセット・ファイル操作',
+
+ // Image/Brush Format Errors
+ 'Failed to read image file.': '画像ファイルの読み込みに失敗しました。',
+ 'Unsupported or corrupted image file.': '非対応または破損した画像ファイルです。',
+ 'Ink Studio Brush': 'Ink Studio ブラシ',
+ 'Save Brush As': 'ブラシに名前を付けて保存',
+ 'Invalid .inkb file: file is empty.': '無効な .inkb ファイルです: ファイルが空です。',
+ 'Invalid .inkb file: exceeds 25 MB safety limit.':
+ '無効な .inkb ファイルです: 上限サイズ(25 MB)を超えています。',
+ 'Invalid .inkb file: unrecognized format header.':
+ '無効な .inkb ファイルです: ファイル形式ヘッダーが認識できません。',
+ 'Invalid .inkb file: corrupted archive.':
+ '無効な .inkb ファイルです: アーカイブデータが破損しています。',
+ 'Invalid .inkb file: missing or oversized brush.json.':
+ '無効な .inkb ファイルです: brush.json が見つからないかサイズ超過です。',
+ 'Invalid .inkb file: payload too large.':
+ '無効な .inkb ファイルです: データサイズが大きすぎます。',
+ 'Invalid .inkb file: malformed JSON payload.':
+ '無効な .inkb ファイルです: JSON データの形式が不正です。',
+ 'Invalid .inkb file: root must be an object.':
+ '無効な .inkb ファイルです: ルート要素はオブジェクトである必要があります。',
+ 'Unsupported .inkb brush version: {version}':
+ '非対応の .inkb ブラシバージョンです: {version}',
+ 'Invalid .inkb file: missing brush definition.':
+ '無効な .inkb ファイルです: ブラシ定義が見つかりません。',
+
+ // ===========================================================================
+ // 11. Tool Options Bar & Tool Property Inspector (All Tools)
+ // ===========================================================================
+ 'Contextual Tool Options': 'ツールオプションバー',
+ 'Hide Tool Options Bar': 'ツールオプションバーを非表示',
+ 'Hide Tool Options Bar (Window → Tool Options Bar)':
+ 'ツールオプションバーを非表示(ウィンドウ → ツールオプションバー)',
+ 'Active Brush: {name} — Click to switch preset':
+ '使用中のブラシ: {name} — クリックでプリセット切替',
+ 'Close brush picker': 'ブラシピッカーを閉じる',
+ 'Brush Blend Mode': '合成モード',
+ Studio: 'スタジオ',
+ Stab: '補正',
+ Stabilization: '手ブレ補正',
+ 'Stabilization & Stroke': '手ブレ補正・ストローク',
+ 'Brush Tip': 'ブラシ先端',
+ 'Texture & Spray': '紙質・散布効果',
+ 'Dynamics & Jitter': '筆圧・ジッター',
+ 'Pen Pressure': '筆圧',
+ Pressure: '筆圧',
+ 'Toggle Stylus Pressure Sensitivity': '筆圧検知のオン/オフ',
+ 'Toggle Bézier Stroke Smoothing': 'ベジェ曲線補正のオン/オフ',
+ Curve: '補正',
+ 'Min Width': '最小幅',
+ 'Pressure Curve': '筆圧カーブ',
+ 'Stylus Tilt': 'ペンの傾き',
+ 'Pen Tilt': 'ペンの傾き',
+ Tilt: '傾き',
+ 'Barrel Twist': 'バレル回転',
+ Twist: '回転',
+ 'Direction of Line': '線の向き',
+ 'Initial Direction': '描き始めの向き',
+ 'Direction + Random': '線の向き+ランダム',
+ Alternate: '交互',
+ 'Velocity Dynamics': '速度ダイナミクス',
+ 'Subtract (Valley Fill)': '減算(凹み塗り)',
+ 'Texture Density': '紙質濃度',
+ Gap: '間隔',
+
+ // Blend modes (extra labels in ToolOptionsBar arrays)
+ Behind: '背景',
+ 'Compare Density': '濃度比較',
+ Multiply: '乗算',
+ Darken: '比較(暗)',
+ 'Color Burn': '焼き込みカラー',
+ 'Linear Burn': '焼き込み(リニア)',
+ Lighten: '比較(明)',
+ Screen: 'スクリーン',
+ 'Add (Glow)': '加算(発光)',
+ 'Color Dodge': '覆い焼きカラー',
+ Overlay: 'オーバーレイ',
+ 'Soft Light': 'ソフトライト',
+ 'Hard Light': 'ハードライト',
+ 'Vivid Light': 'ビビッドライト',
+ Difference: '差の絶対値',
+
+ // Fill Tool
+ 'Fill Method': '塗りつぶし方法',
+ 'Bucket Fill': '塗りつぶし',
+ 'Smart Line Fill': '線画スマート塗り',
+ 'All Visible': '他レイヤーを参照',
+ 'Refer All Layers': '他レイヤーを参照',
+ 'Active Layer': '編集レイヤーのみ参照',
+ 'Reference Layer': '参照レイヤー',
+ 'Enclose and Fill': '囲って塗る',
+ 'Enclose & Fill': '囲って塗る',
+ 'Paint Unfilled Area': '塗り残し部分に塗る',
+ 'Paint Unfilled': '塗り残し塗り',
+ 'Lasso Fill': '投げなわ塗り',
+ 'Draw a lasso around complex line art to fill all closed areas inside without affecting the background':
+ '複雑な線画を投げなわで囲み、背景を塗らずに閉じた内側領域を一括で塗りつぶします',
+ 'Brush over outlines to fill only tiny enclosed unfilled corners and crevices':
+ '線画の上をなぞって、細かい角や隙間の塗り残し部分だけを塗りつぶします',
+ 'Draw a freehand shape to fill directly':
+ 'フリーハンドで囲んだ範囲をそのまま塗りつぶします',
+ 'Transparent (Erase)': '透明色(消去)',
+ 'Draw a closed shape on canvas to fill. Press Esc to cancel.':
+ 'キャンバス上に閉じた形を描くと塗りつぶします。Esc でキャンセル。',
+ 'Refer Source': '参照先',
+ Reference: '参照',
+ 'Target Area': '塗り対象',
+ 'All Enclosed': '閉領域すべて',
+ 'Unfilled Only': '塗り残しのみ',
+ 'Area Scaling': '領域拡縮',
+ Tol: '許容',
+ 'Lasso around line art (e.g. hair strands) to fill all closed areas inside without affecting the background. Press Esc to cancel.':
+ '髪の毛などの線画を囲むと、背景に影響せず閉じた内側だけを一括で塗れます。Esc でキャンセル。',
+ 'Brush over outlines and tight corners to fill only tiny enclosed unfilled pixels. Press [ / ] to resize, Esc to cancel.':
+ '線の際や細かい角をなぞると、小さな塗り残しだけを埋めます。[ / ] でサイズ変更、Esc でキャンセル。',
+
+ // Selection Tools
+ Rect: '長方形',
+ Lasso: '投げなわ',
+ Wand: '自動選択',
+ Erase: '消去',
+ Contiguous: '隣接ピクセル',
+ 'Wand Refer Mode': '自動選択の参照元',
+ 'Refer: All': '参照: すべて',
+ 'Refer: Active': '参照: 編集層',
+ Ref: '参照',
+ 'Expand +5px': '拡張 +5px',
+ 'Expand 5px': '5px 拡張',
+ 'Expand Selection by 5px': '選択範囲を 5px 拡張',
+ 'Contract 5px': '5px 縮小',
+ 'Feather 5px': '5px ぼかし',
+ 'Feather Selection (5px)': '選択範囲の境界をぼかす (5px)',
+ 'Cut Selection (Ctrl+X)': '選択範囲を切り取り (Ctrl+X)',
+ 'Copy Selection (Ctrl+C)': '選択範囲をコピー (Ctrl+C)',
+ 'Paste to New Layer (Ctrl+V)': '新規レイヤーに貼り付け (Ctrl+V)',
+ 'Move Selected Section to New Layer (Ctrl+Shift+J)':
+ '選択範囲を新規レイヤーへ移動 (Ctrl+Shift+J)',
+ 'Move to New Layer': '新規レイヤーへ移動',
+ 'Delete Selected Section (Del)': '選択範囲内を消去 (Del)',
+ 'Delete Section': '選択部分を削除',
+ 'Delete Outside Selected Section': '選択範囲外を消去',
+ 'Delete Outside': '選択範囲外を削除',
+ 'Invert Selection': '選択範囲を反転',
+ 'Transform Selection (Ctrl+T)': '選択範囲を変形 (Ctrl+T)',
+ 'Deselect (Ctrl+D)': '選択を解除 (Ctrl+D)',
+
+ // Gradient Tool
+ 'Gradient Type': 'グラデーション種類',
+ Mesh: 'メッシュ',
+ 'Use FG / BG': '描画色・背景色を使用',
+ 'Stops ({count})': 'カラーノード({count})',
+ '+ Add': '+ 追加',
+ 'Stop {n} Position': 'ノード {n} の位置',
+ 'Position: {pct}%': '位置: {pct}%',
+ 'Stop {n} Opacity': 'ノード {n} の不透明度',
+ 'Stop Opacity %': 'ノードの不透明度 (%)',
+ 'Remove Stop': 'ノードを削除',
+ Repeat: '繰り返し',
+ 'Gradient Repeat': '繰り返し方法',
+ Clamp: '繰り返さない',
+ Reflect: '折り返し',
+ Mirror: '折り返し',
+ Reverse: '反転',
+ 'Gradient Blend Mode': '合成モード',
+ Dither: 'ディザリング',
+ Columns: '列数',
+ Rows: '行数',
+ 'Rotate Mesh': 'メッシュを回転',
+ 'Vertices ({selected}/{total})': '頂点({selected}/{total})',
+ 'Shift+Click or drag box to multi-select vertices':
+ 'Shift+クリックまたはドラッグ囲みで複数頂点を選択できます',
+ 'Node #{n}': '頂点 #{n}',
+ '{count} Nodes': '{count}個の頂点',
+ '{count} Nodes (Mixed)': '{count}個の頂点(混在)',
+ 'Use FG': '描画色',
+ 'Apply current foreground color to selected vertices':
+ '選択中の頂点に現在の描画色を適用します',
+ 'Node Opacity': '頂点の不透明度',
+ 'Nodes Opacity': '選択頂点の不透明度',
+ 'Create Mesh': 'メッシュを作成',
+ 'Reset Mesh': 'メッシュをリセット',
+ 'Apply (Enter)': '確定 (Enter)',
+ 'Cancel (Esc)': 'キャンセル (Esc)',
+
+ // Retouch Tool
+ 'Retouch Mode': 'レタッチモード',
+ Smudge: '指先',
+ Blur: 'ぼかし',
+ Dodge: '覆い焼き',
+ Burn: '焼き込み',
+ 'Clone Stamp': 'コピースタンプ',
+ Exposure: '露光量',
+ 'Finger Painting': '指先ペイント',
+ Range: '範囲',
+ 'Tonal Range': '階調範囲',
+ Shadows: 'シャドウ',
+ Mid: '中間調',
+ 'Protect Tones': '色調を保護',
+ 'Click Canvas to Set Origin...': 'キャンバスをクリックしてコピー元を指定...',
+ 'Pick Source (Alt+Click)': 'コピー元を指定 (Alt+クリック)',
+ 'Origin: {x}, {y}': 'コピー元: {x}, {y}',
+ 'No source set': 'コピー元未設定',
+ Aligned: '位置合わせ',
+ Sample: '参照',
+
+ // Pen Tool (Vector / Bézier)
+ 'Bézier Pen': 'ベジェ曲線ペン',
+ 'Pen Mode': 'ペンモード',
+ Draw: '描画',
+ 'Edit Nodes': '制御点編集',
+ 'Stroke Width': '線幅',
+ 'Stroke Path': 'パスに線を描画',
+ 'Fill Closed Path': '閉じたパスを塗る',
+ 'Fill Color Source': '塗りつぶし色',
+ Primary: '描画色',
+ Sub: 'サブ',
+ 'Rubber Band': 'ラバーバンド表示',
+ 'Path: {count} anchor': 'パス: 制御点 {count}個',
+ 'Path: {count} anchors': 'パス: 制御点 {count}個',
+ 'Path: {count} anchor (Closed)': 'パス: 制御点 {count}個(閉パス)',
+ 'Path: {count} anchors (Closed)': 'パス: 制御点 {count}個(閉パス)',
+ 'Open Path': 'パスを開く',
+ 'Close Path': 'パスを閉じる',
+ 'Smooth / Corner': '滑らか/角切替',
+ 'Delete Node': '制御点を削除',
+ 'Commit (Enter)': '確定 (Enter)',
+ 'Click: corner · Drag: handles · Alt+Drag: break · Ctrl: edit nodes · Click curve in Edit: split':
+ 'クリック: 角点 · ドラッグ: ハンドル · Alt+ドラッグ: 片側折り返し · Ctrl: 点編集 · 編集中に曲線クリック: 分割',
+
+ // Shape Tool
+ 'Geometric Shape': '図形',
+ 'Shape Type': '図形の種類',
+ Rectangle: '長方形',
+ 'Rounded Rect': '角丸長方形',
+ Rounded: '角丸',
+ Ellipse: '楕円',
+ Triangle: '三角形',
+ Polygon: '多角形',
+ Star: '星形',
+ Line: '直線',
+ Arrow: '矢印',
+ 'Shape Style': '描画スタイル',
+ Both: '線と塗り',
+ 'Fill Color': '塗りの色',
+ 'Shape Fill Color': '図形の塗り色',
+ 'Corner Radius': '角の丸み',
+ Points: '頂点数',
+ Sides: '角数',
+ 'Inner Ratio': '内側の比率',
+ 'Dashed Line': '破線',
+ 'Dash Length': '破線の長さ',
+ 'Dash Gap': '破線の間隔',
+ Cap: '線端',
+ Corner: '角の形状',
+ 'Constrain (Shift)': '縦横比/角度固定 (Shift)',
+ 'Lock 1:1 aspect ratio or 15° angle increments (or hold Shift while dragging)':
+ '1:1の縦横比や15°刻みに固定します(ドラッグ中にShiftキーでも有効)',
+ 'From Center (Alt)': '中心から描画 (Alt)',
+ 'Draw symmetrically from center (or hold Alt while dragging)':
+ '中心から対称に描画します(ドラッグ中にAltキーでも有効)',
+
+ // Liquify Tool
+ 'Liquify Mode': 'ゆがみモード',
+ Push: '押し出し',
+ Expand: '膨張',
+ Pinch: '収縮',
+ 'Push Left': '左へ押し出し',
+ 'Push Right': '右へ押し出し',
+ 'Twirl CW': '時計回りに回転',
+ 'Twirl CCW': '反時計回りに回転',
+ Reconstruct: '復元',
+ 'Multi-layer': '複数レイヤー参照',
+ 'Multi-Layer': '複数レイヤー',
+ 'Apply Liquify simultaneously to all visible unlocked layers (or multi-selected layers / active folder)':
+ '表示中でロックされていない全レイヤー(または複数選択レイヤー/選択フォルダー)にゆがみを同時適用します',
+
+ // Text Tool
+ 'Plain White': '標準の白',
+ 'Reset to plain white text without outline':
+ 'フチなしの白テキストにリセット',
+ Font: 'フォント',
+ 'Font Family': 'フォント',
+ 'Text Orientation': '文字の向き',
+ 'Toggle Horizontal / Vertical Writing Mode': '横書き/縦書きを切り替え',
+ Horiz: '横書',
+ Vert: '縦書',
+ 'Bold (Ctrl+B)': '太字 (Ctrl+B)',
+ 'Italic (Ctrl+I)': '斜体 (Ctrl+I)',
+ 'Underline (Ctrl+U)': '下線 (Ctrl+U)',
+ 'Align left': '左揃え',
+ 'Align center': '中央揃え',
+ 'Align right': '右揃え',
+ 'Font Size': 'フォントサイズ',
+ 'Line Height': '行間',
+ 'Letter Spacing': '字間',
+ 'Text Color': '文字色',
+ 'Text Color ({color})': '文字色 ({color})',
+ 'Custom Text Color': 'カスタム文字色',
+ 'Copy current brush color': '現在の描画色を取得',
+ Outline: 'フチ取り',
+ 'Outline Width': '縁取りの幅',
+ 'Outline Color': 'フチの色',
+ 'Outline Color ({color})': '縁取りの色 ({color})',
+ '• Click canvas to type, or drag to create a wrapped text box':
+ '• キャンバスをクリックして入力、またはドラッグで折り返しボックスを作成',
+ '• Click existing text to re-edit non-destructively':
+ '• 既存のテキストをクリックすると非破壊で再編集できます',
+ '• Latest typography settings save automatically':
+ '• 最新の文字設定は自動的に保存されます',
+
+ // Transform, Object, Frame, Balloon, Vector Edit, 3D & Misc Tools
+ 'Transform & Warp': '変形・ワープ',
+ 'Free Transform': '自由変形',
+ Free: 'フリー',
+ Perspective: 'パース',
+ 'Puppet Warp': 'パペットワープ',
+ 'Cage Transform': 'ケージ変形',
+ 'Start Free Transform (Ctrl+T)': '自由変形を開始 (Ctrl+T)',
+ 'Shift: keep aspect · Enter: apply · Esc: cancel':
+ 'Shift: 縦横比維持 · Enter: 確定 · Esc: キャンセル',
+ 'Use the floating transform bar on the canvas to switch between {free}, {perspective}, {mesh}, {puppet}, and {cage}.':
+ 'キャンバス上のフローティング変形バーで、{free}・{perspective}・{mesh}・{puppet}・{cage}を切り替えられます。',
+ 'Puppet Warp Tips': 'パペットワープのヒント',
+ '• Click artwork to place 5–6 joint pins':
+ '• アートワークをクリックして5〜6箇所に関節ピンを配置',
+ '• Drag pins to bend arms, head, or folds':
+ '• ピンをドラッグして腕や頭、服のシワを自然に曲げる',
+ '• Drag ring handle or Alt+Drag to tilt/rotate':
+ '• リングハンドルをドラッグ、または Alt+ドラッグで回転・傾け',
+ '• Right-click or Delete removes a pin':
+ '• 右クリックまたは Delete キーでピンを削除',
+ 'Cage Transform Tips': 'ケージ変形のヒント',
+ '• Drag vertices or edges to warp smoothly':
+ '• 頂点や辺をドラッグして滑らかに変形',
+ '• Switch to Edit Cage to add/shape points':
+ '• ケージ編集に切り替えて制御点を追加・整形',
+ '• Click Redraw to outline a specific region':
+ '• 再描画をクリックして特定の領域を囲み直す',
+ 'Apply: Enter': '確定: Enter',
+ 'Cancel: Esc': 'キャンセル: Esc',
+
+ 'Object Tool': 'オブジェクトツール',
+ Object: 'オブジェクト',
+ 'Click any non-destructive Text or Speech Balloon layer on the canvas to reopen its editor without quality loss.':
+ 'キャンバス上のテキストやフキダシレイヤーをクリックすると、画質を損なわずエディターを再編集できます。',
+
+ 'Frame Border Folder': 'コマ枠フォルダー',
+ 'Frame Mode': 'コマ枠モード',
+ Divide: 'コマ枠分割',
+ 'Divide Method': '分割方法',
+ 'Divide Frame Border (Same Folder)': 'コマ枠を分割(同一フォルダー)',
+ 'Divide Frame Folder (2 Folders)': 'コマ枠フォルダーを分割(2フォルダー)',
+ 'Border Width': '枠線の幅',
+ 'Vert Gutter': '縦の間隔',
+ 'Horiz Gutter': '横の間隔',
+ 'Frame Background': 'コマの背景',
+ Empty: '項目なし',
+
+ Border: '枠線',
+ 'Correct Line': '線修正',
+ 'Pinch Level': 'つまみレベル',
+ 'Adjust Width': '線幅調整',
+ Simplify: '単純化',
+ 'Effect Lines...': '効果線...',
+
+ '3D Tool Mode': '3D操作モード',
+ '3D Stage': '3Dステージ',
+ 'Camera Orbit': 'カメラ回転',
+ 'Camera Pan': 'カメラ移動',
+ 'Model Move': 'モデル移動',
+ 'Model Rotate': 'モデル回転',
+ 'Model Scale': 'モデル拡大縮小',
+ 'Toggle Gizmo Coordinate Space': 'ギズモ座標系を切り替え',
+ World: 'ワールド',
+ Local: 'ローカル',
+ '3D Shading': '3Dシェーディング',
+ Shaded: 'シェーディング',
+ Toon: 'トゥーン',
+ Wireframe: 'ワイヤーフレーム',
+ Silhouette: 'シルエット',
+ 'Directional Light': '平行光源',
+ FOV: '画角 (FOV)',
+ Snap: 'スナップ',
+ Grid: 'グリッド',
+
+ 'Click or drag on canvas to sample color · Hold Alt with any brush for temporary eyedropper':
+ 'キャンバスをクリック/ドラッグして色を取得 · ブラシ使用中に Alt 長押しで一時スポイト',
+ 'Click or drag directly on the canvas.':
+ 'キャンバス上を直接クリックまたはドラッグして操作します。',
+ 'Flip View H': '表示を左右反転',
+ 'Flip View V': '表示を上下反転',
+ 'Reset Angle': '角度をリセット',
+ Rotate: '回転',
+ 'Fill Paper': '用紙で塗りつぶし',
+ Single: '単一',
+ Visible: '表示全体',
+ Smart: 'スマート',
+ In: '入り',
+ Out: '抜き',
+ 'In & Out': '入り抜き',
+ Lead: '先頭',
+ Track: '追従',
+
+ // Contextual homonym disambiguations
+ 'brushName::Feather': '羽根',
+ 'bristleTip::Flat': '平筆',
+ 'gradientPreset::Chrome': 'クローム',
+ 'gradientPreset::Sky': '青空',
+ 'gradientPreset::Sunset': '夕焼け',
+ 'fillOption::Empty': '塗りなし',
+};
diff --git a/src/i18n/ja/color.ts b/src/i18n/ja/color.ts
new file mode 100644
index 0000000..84af55a
--- /dev/null
+++ b/src/i18n/ja/color.ts
@@ -0,0 +1,479 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_COLOR: TranslationDictionary = {
+ // =========================================================================
+ // ColorPanel, ColorWheel & ColorSlider
+ // =========================================================================
+ 'Primary: {color}': '描画色: {color}',
+ 'Secondary: {color}': '背景色: {color}',
+ 'Swap Colors (X)': '描画色と背景色を入れ替え (X)',
+ 'Swap Colors': '描画色と背景色を入れ替え',
+ 'Color Wheel': 'カラーサークル',
+ 'Color Sliders': 'カラースライダー',
+ '3D Sphere (Floating — click to dock)': '3Dカラー球(フローティング — クリックでドック)',
+ '3D Sphere (Docked — click to unpin & float)': '3Dカラー球(ドック中 — クリックでフロート表示)',
+ '3D Sphere Color Picker': '3Dカラー球ピッカー',
+ 'Hide Sliders Below Wheel': 'カラーサークル下のスライダーを隠す',
+ 'Show Sliders Below Wheel': 'カラーサークル下にスライダーを表示',
+ 'Hex Color': '16進数カラーコード',
+ 'Recent: {color}': '履歴: {color}',
+ 'Recent color {color}': '最近使用した色 {color}',
+ 'No history': '履歴なし',
+ 'Open Color History': 'カラーヒストリーを開く',
+ 'Recent Color History': '最近使用した色',
+ 'Color History': 'カラーヒストリー',
+ 'Clear Color History': 'カラーヒストリーを消去',
+ 'No recent colors': '履歴がありません',
+ 'Select recent color {color}': '履歴の色 {color} を選択',
+ 'Switch to Triangle Mode': '三角形カラーサークルに切り替え',
+ 'Switch to Square Mode': '四角形カラーサークルに切り替え',
+ 'Color Slider': 'カラースライダー',
+ 'Swap Primary & Secondary Colors (X)': '描画色と背景色を入れ替え (X)',
+ 'RGB Color Model': 'RGB カラーモデル',
+ 'HSV Color Model': 'HSV カラーモデル',
+ 'CMYK Color Model': 'CMYK カラーモデル',
+ 'Increment (+1)': '増やす (+1)',
+ 'Decrement (-1)': '減らす (-1)',
+ 'Primary Color: {color} (Click to select & edit)': '描画色: {color}(クリックで選択・編集)',
+ 'Secondary Color: {color} (Click to select & edit)': '背景色: {color}(クリックで選択・編集)',
+ 'Transparent Color / Eraser Mode (C)': '透明色/消しゴムモード (C)',
+ 'Copy Hex Code': 'HEXコードをコピー',
+ 'Recent Colors': '最近使用した色',
+ '{count} items': '{count}件',
+
+ // =========================================================================
+ // SphereColorPicker & sphereColorMath built-in presets
+ // =========================================================================
+ 'Drag to move palette — Double-click to collapse/expand': 'ドラッグでパレット移動・ダブルクリックで開閉',
+ 'Color Sphere': 'カラー球',
+ 'Unpin & Float Palette': 'ドック解除してフロート表示',
+ 'Pin back to Color Panel': 'カラーパネルにドックする',
+ 'Unpin panel': 'パネルをフロート表示',
+ 'Pin panel': 'パネルをドック',
+ 'Expand Panel': 'パネルを展開',
+ 'Hide / Collapse Panel': 'パネルを折りたたむ',
+ 'Expand Color Sphere': 'カラー球を展開',
+ 'Hide Color Sphere': 'カラー球を折りたたむ',
+ 'Close (Esc)': '閉じる (Esc)',
+ 'Lighting & Surface Settings': 'ライティング・質感設定',
+ 'Lighting Settings': 'ライティング設定',
+ 'Light Orbit Active (drag sphere to angle light)': '光源回転モード中(球をドラッグして光源の角度を調整)',
+ 'Rotate Light Source (or Shift+drag on sphere)': '光源を回転(または球をShift+ドラッグ)',
+ 'Toggle Light Orbit Mode': '光源回転モードを切り替え',
+ 'Previous: {color} (Click to revert)': '変更前: {color}(クリックで戻す)',
+ 'Previous color {color}': '変更前の色 {color}',
+ 'Current: {hex} | rgb({r}, {g}, {b})': '現在: {hex} | rgb({r}, {g}, {b})',
+ 'Lighting & Surface': 'ライティング・質感',
+ 'Reset Lighting': 'ライティングをリセット',
+ 'Key Tint': '主光源色',
+ 'Key Light Color Tint': '主光源の色味',
+ 'Rim Glow': 'リム光',
+ 'Rim Light Intensity': 'リムライトの強度',
+ 'Gloss': '光沢',
+ 'Surface Gloss': '表面の光沢',
+ 'Specular': '鏡面反射',
+ 'Specular Strength': '鏡面反射の強さ',
+ 'SSS Glow': '透過光',
+ 'Subsurface Terminator Glow': '表面下散乱(明暗境界の透過光)',
+ 'Bounce': '反射光',
+ 'Bounce Light Intensity': '環境反射光の強さ',
+ 'Shadow': 'シャドウ',
+ 'Shadow Depth': '影の深さ',
+ 'sphere::Light': '光量',
+ 'sphereSlot::Shadow': '影',
+ 'sphereSlot::Base': 'ベース',
+ 'sphereSlot::Light': '光',
+ 'sphereSlot::Rim': 'リム',
+ 'sphereSlotLower::shadow': '影',
+ 'sphereSlotLower::base': 'ベース',
+ 'sphereSlotLower::light': '光',
+ 'sphereSlotLower::rim': 'リム',
+ '{label} Color ({hex})': '{label}カラー ({hex})',
+ '{slot} hue': '{slot}の色相',
+ 'Pick exact {slot} color ({hex})': '{slot}の色を指定 ({hex})',
+ 'Pick {slot} color': '{slot}の色を選択',
+ 'Chm': '彩度',
+ 'Chroma': '彩度',
+ 'Val': '明度',
+ 'Value': '明度',
+ 'Lighting Preset': 'ライティングプリセット',
+ 'Lighting Mood Preset...': 'ライティングプリセット...',
+ 'Reset Lighting & Colors': 'ライティングと色をリセット',
+ 'Amb': '環境光',
+ 'Ambient': '環境光',
+ 'Ctr': '対比',
+ 'Sat': '彩度',
+ 'Restore Color Saturation': '彩度を元に戻す',
+ 'Black & White / Grayscale Mode (0% Sat)': '白黒/グレースケール表示(彩度 0%)',
+ 'B&W': '白黒',
+ 'Copy HEX': 'HEXコピー',
+ 'Copy RGB': 'RGBコピー',
+ 'Drag to resize': 'ドラッグしてサイズ変更',
+
+ // Built-in 3D Sphere Lighting Presets (sphereColorMath.ts)
+ 'Studio Matte': 'スタジオマット',
+ 'Crimson Mood': 'クリムゾンムード',
+ 'High-Key Bright': 'ハイキーブライト',
+ 'Warm / Cool': '暖色/寒色',
+ 'Neon Dual-Tone': 'ネオンデュアルトーン',
+ 'Sunset Rim': 'サンセットリム',
+ 'Glossy Wet': 'グロスウェット',
+ 'Dim Chiaroscuro': 'キアロスクーロ(暗調)',
+ 'B&W Value Study': '白黒明度スタディ',
+
+ // =========================================================================
+ // ColorSetsPanel & ColorHistoryPanel
+ // =========================================================================
+ 'Custom Set {n}': 'カスタムセット {n}',
+ 'Ink Studio Color Set': 'Ink Studio カラーセット',
+ 'Save Color Set As': 'カラーセットを別名で保存',
+ 'Exported color set "{name}"': 'カラーセット「{name}」を書き出しました',
+ 'Could not export color set.': 'カラーセットを書き出せませんでした。',
+ 'Imported "{name}" ({count} colors)': '「{name}」({count}色)を読み込みました',
+ 'Failed to read color set file.': 'カラーセットファイルの読み込みに失敗しました。',
+ 'Imported {count} color set ({skipped} skipped)': '{count}件のカラーセットを読み込みました({skipped}件スキップ)',
+ 'Imported {count} color sets ({skipped} skipped)': '{count}件のカラーセットを読み込みました({skipped}件スキップ)',
+ 'Imported {count} color set': '{count}件のカラーセットを読み込みました',
+ 'Imported {count} color sets': '{count}件のカラーセットを読み込みました',
+ 'Failed to import color set files.': 'カラーセットファイルの読み込みに失敗しました。',
+ 'Copied {hex}': '{hex} をコピーしました',
+ 'Active Color Set': '使用中のカラーセット',
+ 'Color Set Actions': 'カラーセット操作',
+ 'New set name...': '新しいセット名...',
+ 'Set name...': 'セット名...',
+ 'Add active color ({hex}) to "{set}"': '描画色 ({hex}) を「{set}」に追加',
+ 'Set': 'セット',
+ 'Add current color to set': '現在の色をセットに追加',
+ 'Swatches per row (1–8)': '1行あたりの色数(1〜8)',
+ 'Color Sets columns': 'カラーセットの列数',
+ 'Empty color set': 'カラーセットが空です',
+ '+ Add {hex}': '+ {hex} を追加',
+ '{label} — Click: Primary · Middle: Secondary · Right-click: Menu · Alt+Click: Remove':
+ '{label} — クリック: 描画色・中クリック: 背景色・右クリック: メニュー・Alt+クリック: 削除',
+ 'New Color Set': '新規カラーセット',
+ 'Rename Set': 'セット名を変更',
+ 'Duplicate Set': 'セットを複製',
+ 'Import Color Set (.json, Clip Studio .cls, or .png palette)':
+ 'カラーセットを読み込み (.json / Clip Studio .cls / .pngパレット)',
+ 'Import Set (.json, .cls, .png)...': 'セットを読み込み (.json, .cls, .png)...',
+ 'Export Set (JSON)...': 'セットを書き出し (JSON)...',
+ 'Delete Set': 'セットを削除',
+ 'Set Secondary Color': '背景色に設定',
+ 'Replace with Primary': '描画色で置き換え',
+ 'Copy Hex': 'HEXをコピー',
+ 'Delete Swatch': '色を削除',
+ 'Added {hex} to "{set}"': '{hex} を「{set}」に追加しました',
+ 'Color History columns': 'カラーヒストリーの列数',
+ '{hex} — Click: Primary · Middle: Secondary · Right-click: Add to "{set}"':
+ '{hex} — クリック: 描画色・中クリック: 背景色・右クリック: 「{set}」に追加',
+ 'Add {hex} to "{set}"': '{hex} を「{set}」に追加',
+ 'Add {hex} to {set}': '{hex} を{set}に追加',
+ 'Add to "{set}"': '「{set}」に追加',
+ 'Remove from History': '履歴から削除',
+
+ // Built-in Color Set Names & Import Errors (useColorSetsStore.ts)
+ 'Atelier Neutrals & Values': 'アトリエ無彩色・明度',
+ 'Skin & Portrait Tones': '肌色・ポートレート',
+ 'Manga & Ink Accents': '漫画・インクアクセント',
+ 'Classic Primaries': 'クラシック基本色',
+ 'Imported Set': '読み込みセット',
+ 'Color set file is empty.': 'カラーセットファイルが空です。',
+ 'Color set file exceeds 256 KB limit.': 'カラーセットファイルが上限(256 KB)を超えています。',
+ 'Invalid JSON file.': '無効なJSONファイルです。',
+ 'No valid hex color swatches found.': '有効なカラーコードが見つかりませんでした。',
+ 'Color set JSON must be an object or array.': 'カラーセットJSONはオブジェクトまたは配列である必要があります。',
+ 'Color set JSON is missing a "swatches" array.': 'カラーセットJSONに "swatches" 配列がありません。',
+ 'No valid colors found in Clip Studio color set.': 'CLIP STUDIO カラーセットに有効な色が見つかりませんでした。',
+ 'No valid colors found in PNG color palette.': 'PNGカラーパレットに有効な色が見つかりませんでした。',
+ 'Unsupported color set format. Use .json, Clip Studio .cls, or .png palette files.':
+ '非対応の形式です。.json、CLIP STUDIO .cls、または .png パレットを使用してください。',
+ 'Maximum of 64 color sets reached. Delete a set before importing.':
+ 'カラーセット数が上限(64件)に達しています。読み込む前に不要なセットを削除してください。',
+
+ // Built-in Swatch Names — Atelier Neutrals & Values
+ 'Sumi Black': '墨黒',
+ 'Charcoal 90%': 'チャコール 90%',
+ 'Graphite 80%': 'グラファイト 80%',
+ 'Neutral 70%': 'ニュートラル 70%',
+ 'Neutral 60%': 'ニュートラル 60%',
+ 'Middle Grey 50%': 'ミドルグレー 50%',
+ 'Neutral 40%': 'ニュートラル 40%',
+ 'Silver 30%': 'シルバー 30%',
+ 'Light Grey 20%': 'ライトグレー 20%',
+ 'Off White 10%': 'オフホワイト 10%',
+ 'Warm Paper': 'ウォームペーパー',
+ 'Titanium White': 'チタニウムホワイト',
+ 'Raw Umber': 'ローアンバー',
+ 'Burnt Umber': 'バーントアンバー',
+ 'Warm Taupe': 'ウォームトープ',
+ 'Stone Khaki': 'ストーンカーキ',
+ 'Parchment': 'パーチメント',
+ 'Atelier Cream': 'アトリエクリーム',
+ 'Payne Shadow': 'ペインズシャドウ',
+ 'Slate Dark': 'スレートダーク',
+ 'Cool Mid': 'クールミドル',
+ 'Steel Grey': 'スチールグレー',
+ 'Cool Mist': 'クールミスト',
+ 'Cool Paper': 'クールペーパー',
+
+ // Built-in Swatch Names — Skin & Portrait Tones
+ 'Porcelain Highlight': '磁器ハイライト',
+ 'Fair Light': '色白ライト',
+ 'Fair Midtone': '色白中間色',
+ 'Fair Shadow': '色白シャドウ',
+ 'Warm Umber Shadow': '暖色アンバー影',
+ 'Deep Core Shadow': '深部コアシャドウ',
+ 'Golden Highlight': 'ゴールデンハイライト',
+ 'Olive Light': 'オリーブライト',
+ 'Warm Tan': 'ウォームタン',
+ 'Golden Midtone': 'ゴールデン中間色',
+ 'Ochre Shadow': 'オーカー影',
+ 'Espresso Shadow': 'エスプレッソ影',
+ 'Chestnut Highlight': 'チェスナットハイライト',
+ 'Warm Sienna': 'ウォームシエナ',
+ 'Rich Umber': 'リッチアンバー',
+ 'Deep Mahogany': 'ディープマホガニー',
+ 'Dark Cocoa': 'ダークココア',
+ 'Deepest Occlusion': '最暗部オクルージョン',
+ 'Soft Blush': 'ソフトチーク',
+ 'Rose Subsurface': 'ローズ透過光',
+ 'Lip Crimson': 'リップクリムゾン',
+ 'Cool Mauve': 'クールモーブ',
+ 'Shadow Violet': 'シャドウバイオレット',
+ 'Ambient Cool Shadow': '環境寒色影',
+
+ // Built-in Swatch Names — Manga & Ink Accents
+ 'G-Pen Ink': 'Gペンインク',
+ 'Indigo Ink': '藍色インク',
+ 'Vermilion Seal': '朱印',
+ 'Persimmon': '柿色',
+ 'Ochre Gold': '山吹色',
+ 'Soft Canary': 'カナリア黄',
+ 'Matcha': '抹茶',
+ 'Pine': '松葉',
+ 'Cerulean': 'セルリアン',
+ 'Prussian Blue': 'プルシアンブルー',
+ 'Wisteria': '藤色',
+ 'Camellia': '椿色',
+ 'Sakura': '桜色',
+ 'Sky Wash': '浅葱空色',
+ 'Celadon': '青磁',
+ 'Manga Paper': '漫画原稿用紙',
+
+ // Built-in Swatch Names — Classic Primaries
+ 'Cadmium Deep': 'カドミウムディープ',
+ 'Cadmium Red': 'カドミウムレッド',
+ 'Burnt Orange': 'バーントオレンジ',
+ 'Deep Amber': 'ディープアンバー',
+ 'Cadmium Yellow': 'カドミウムイエロー',
+ 'Chartreuse': 'シャルトリューズ',
+ 'Viridian Green': 'ビリジアングリーン',
+ 'Teal': 'ティール',
+ 'Cerulean Blue': 'セルリアンブルー',
+ 'Cobalt Blue': 'コバルトブルー',
+ 'Ultramarine': 'ウルトラマリン',
+ 'Dioxazine Violet': 'ジオキサジンバイオレット',
+ 'Magenta': 'マゼンタ',
+ 'Alizarin Rose': 'アリザリンローズ',
+ 'Oxblood': 'オックスブラッド',
+ 'Raw Sienna': 'ローシエナ',
+ 'Hooker Green': 'フッカーズグリーン',
+ 'Deep Pine': 'ディープパイン',
+ 'Indigo': 'インディゴ',
+ 'Plum Dark': 'ダークプラム',
+ 'Pale Coral': 'ペールコーラル',
+ 'Naples Yellow': 'ネープルスイエロー',
+ 'Mint Tint': 'ミントティント',
+ 'Ice Blue': 'アイスブルー',
+
+ // =========================================================================
+ // NavigatorPanel
+ // =========================================================================
+ 'Click or drag red viewport frame to pan canvas': '赤い枠をクリックまたはドラッグしてキャンバスを移動',
+ 'B/W Tone': '白黒確認',
+ 'CLR': 'カラー',
+ 'B/W': '白黒',
+ 'Color and B/W Split Position': 'カラー/白黒の分割位置',
+ 'Drag to compare Color | B/W tones (Double-click to center 50%)':
+ 'ドラッグでカラーと白黒の明度を比較(ダブルクリックで50%にリセット)',
+ 'Main Canvas Value Check (Live B/W) is ON — Click to return main canvas to Color':
+ 'メインキャンバスの明度チェック(白黒表示)がONです — クリックでカラー表示に戻す',
+ 'Canvas B/W': '画面白黒',
+ 'Zoom Out': 'ズームアウト',
+ 'Zoom In': 'ズームイン',
+ 'Fit to Screen (Ctrl+0)': '画面に合わせる (Ctrl+0)',
+ 'Reset Zoom to 100% (Ctrl+1)': '100%表示に戻す (Ctrl+1)',
+ 'Rotate Left (-15°)': '左に回転 (-15°)',
+ 'Reset Canvas Angle (0°)': '回転をリセット (0°)',
+ 'Rotate Right (+15°)': '右に回転 (+15°)',
+ 'Flip Horizontal View (Shift+H)': '表示を左右反転 (Shift+H)',
+ 'Flip Vertical View (Shift+V)': '表示を上下反転 (Shift+V)',
+ 'Navigator Preview Mode': 'ナビゲーター表示モード',
+ 'Color Navigator Preview': 'カラープレビュー',
+ 'Split': '分割',
+ 'Split View — Compare Color & Live B/W Tones in Navigator (Alt+Shift+Y)':
+ '分割表示 — カラーと白黒明度を並べて比較 (Alt+Shift+Y)',
+ 'Live B/W Preview in Navigator — Paint in color on main canvas while monitoring B/W values in real time':
+ '白黒プレビュー — カラーで描きながら明度バランスをリアルタイム確認',
+ '1-Click Value Check — Toggle Live B/W Tone Check on Main Canvas (Shift+Y)':
+ 'ワンクリック明度チェック — メインキャンバスの白黒表示を切り替え (Shift+Y)',
+
+ // =========================================================================
+ // SubViewPanel (References / PureRef Board)
+ // =========================================================================
+ 'Reference': '参照',
+ 'Failed to decode image': '画像のデコードに失敗しました',
+ 'Could not load "{name}"': '「{name}」を読み込めませんでした',
+ 'Use Ctrl+V while hovering References to paste an image':
+ 'サブビュー上にカーソルを置いて Ctrl+V で画像を貼り付けられます',
+ 'Clipboard {n}': 'クリップボード {n}',
+ 'No image found in clipboard': 'クリップボードに画像がありません',
+ 'Clipboard image read blocked — press Ctrl+V over References':
+ 'クリップボードの読み取りがブロックされました — サブビュー上で Ctrl+V を押してください',
+ 'Import Reference Image(s)': '資料画像を読み込み',
+ 'Paste Reference from Clipboard (Ctrl+V while hovering)': 'クリップボードから資料を貼り付け(ホバー中に Ctrl+V)',
+ 'Previous Reference': '前の資料へ',
+ 'Next Reference': '次の資料へ',
+ 'Reference View Mode': 'サブビュー表示モード',
+ 'PureRef Board Mode (multiple simultaneous references in one zoomable & rotatable area)':
+ 'ボードモード(複数の資料を自由に配置・拡大・回転)',
+ 'Board': 'ボード',
+ 'Single Focus Mode (cycle one reference at a time)': '単体表示モード(資料を1枚ずつ切り替え)',
+ 'Extract Dominant Color Palette': '代表カラーパレットを抽出',
+ 'Reference List': '資料一覧',
+ 'Remove Current Reference': '表示中の資料を削除',
+ 'Disable Card B/W': 'カードの白黒表示を解除',
+ 'Per-Card B/W': 'カード単位で白黒表示',
+ 'BW': '白黒',
+ 'Unlock Card': 'カードのロックを解除',
+ 'Lock Card Position': 'カードの位置をロック',
+ 'No reference': '資料なし',
+ 'Clear All': 'すべて消去',
+ 'Key': '代表色',
+ '{hex} · Value {percent}% (Click to pick)': '{hex}・明度 {percent}%(クリックで取得)',
+ 'No swatches': 'スウォッチなし',
+ 'Toggle Perceptual Black & White Value Study (Shortcut: G)': '知覚白黒の明度スタディを切り替え (G)',
+ 'Split Compare: Color | Perceptual B/W': '分割比較: カラー | 知覚白黒',
+ 'Light & Shape Study Value Grouping (Off → 2-Value Notan → 3-Value → 5-Value)':
+ '明暗スタディ階調化(オフ → 2階調ノータン → 3階調 → 5階調)',
+ 'Squint Blur (Simplify fine details to read big shapes & masses)':
+ '細目ぼかし(細部を簡略化して大きなシルエットを把握)',
+ 'Proportional Grid Overlay: {mode} (Click to cycle)': '比率グリッド表示: {mode}(クリックで切替)',
+ 'Light & Shape Study Settings (Notan Threshold, Brightness, Contrast)':
+ '明暗スタディ設定(ノータンしきい値・明るさ・コントラスト)',
+ 'Light & Shape Study': '明暗・シルエットスタディ',
+ 'Full': '全画面',
+ 'Notan Pivot': 'ノータン基準',
+ 'When enabled, eyedropper picks the filtered B/W or Notan tone instead of the original color':
+ '有効にすると、スポイトで元の色ではなく白黒・ノータン変換後の明度を取得します',
+ 'Pick: Study Tone': '取得: スタディ明度',
+ 'Pick: Original': '取得: 元画像の色',
+ 'Reference Color and B/W Split Position': '資料のカラー/白黒分割位置',
+ 'Drag to compare Color | B/W (Double-click to center)':
+ 'ドラッグでカラーと白黒を比較(ダブルクリックで中央に戻す)',
+ 'Toggle Per-Card B/W (independent of other references)': 'このカードのみ白黒表示を切り替え',
+ 'Flip Selected Reference Horizontally': '選択中の資料を左右反転',
+ 'Flip Selected Reference Vertically': '選択中の資料を上下反転',
+ 'Card Opacity: {percent}% (Click to cycle)': 'カード不透明度: {percent}%(クリックで切替)',
+ 'Bring Card to Front': 'カードを最前面へ',
+ 'Send Card to Back': 'カードを最背面へ',
+ 'Duplicate Reference Card': '資料カードを複製',
+ 'Lock Card': 'カードをロック',
+ 'Focus / Fit Selected Card': '選択中のカードにフォーカス',
+ 'Drop images, click +, or Ctrl+V': '画像をドロップ、+をクリック、または Ctrl+V',
+ 'PureRef Board · Multi-ref · B/W & Notan Study': '資料ボード・複数配置・白黒/ノータン分析',
+ '{name} (reload file)': '{name}(ファイルを再読み込み)',
+ 'Re-open': '開き直す',
+ 'References Zoom Out': '資料を縮小',
+ 'References Zoom In': '資料を拡大',
+ 'Fit All References & Reset Board View (Shortcut: F)': '全資料を画面に合わせてボード表示をリセット (F)',
+ 'Reset Reference View (Fit, 0°, Unflip)': '資料表示をリセット(全体表示・0°・反転解除)',
+ 'Auto-Arrange PureRef Board (Pack Grid, Row, Column)': 'ボードの資料を自動整列(グリッド・横一列・縦一列)',
+ 'Pack Grid': 'グリッド整列',
+ 'Horizontal Strip': '横一列に整列',
+ 'Vertical Stack': '縦一列に整列',
+ 'Rotate Left (-15°, or Shift+Wheel)': '左に回転(-15°、または Shift+ホイール)',
+ 'Reset Rotation (0°)': '回転をリセット (0°)',
+ 'Rotate Right (+15°, or Shift+Wheel)': '右に回転(+15°、または Shift+ホイール)',
+ 'Flip View Horizontally (Shortcut: H)': '表示を左右反転 (H)',
+ 'Arrange Cards (Drag cards to move, drag corners to resize, top handle to rotate; drag empty space to pan)':
+ 'カード整理(ドラッグで移動、角でリサイズ、上部ハンドルで回転、余白ドラッグでパン)',
+ 'Pan Board (or hold Space / Middle-click anywhere)': 'ボード移動(Spaceキー押下または中ドラッグでも可)',
+ 'Eyedropper Mode (Click any reference to pick color; Alt+Click works from any tool)':
+ 'スポイトモード(クリックで色を取得・どのツールからでも Alt+クリック可)',
+ 'Pick': 'スポイト',
+ 'Switch to Eyedropper Automatically on Hover/Click (CSP mode)':
+ 'ホバー/クリックで自動的にスポイトに切り替え(CSP方式)',
+ 'Eyedropper Active (click for Pan)': 'スポイト有効(クリックで手のひらに切替)',
+ 'Pan Active (click for Eyedropper)': '手のひら有効(クリックでスポイトに切替)',
+ '2V': '2階調',
+ '3V': '3階調',
+ '5V': '5階調',
+
+ // =========================================================================
+ // InfoPanel
+ // =========================================================================
+ 'Automatically tracks active time spent drawing and editing this artwork':
+ 'この作品の描画・編集にかかった実作業時間を自動記録します',
+ 'Work Time': '作業時間',
+ 'Time spent in the current session': '今回のセッションの作業時間',
+ 'Session {time}': '今回 {time}',
+ 'Cursor': 'カーソル',
+ 'P:': '筆圧:',
+ 'Active Color: {color}': '描画色: {color}',
+ 'Resolution': '解像度',
+ 'Engine': 'エンジン',
+ 'Canvas 2D (CPU)': 'Canvas 2D (CPU)',
+ 'Tile RAM': 'タイルメモリ',
+ 'Freed {mb} MB tiles, {steps} undo steps': 'タイル {mb} MB・履歴 {steps} 件を解放しました',
+ 'Memory & GPU caches flushed': 'メモリとGPUキャッシュを解放しました',
+ 'Purge Tile, Undo & GPU Caches': 'タイル・ヒストリー・GPUキャッシュを解放',
+ '1-bit Mono': 'モノクロ 1bit',
+ 'Grayscale': 'グレースケール',
+ 'RGB Color': 'RGB カラー',
+
+ // =========================================================================
+ // QuickAccessPanel, COMMAND_CATALOG & QUICK_TOOL_CATALOG
+ // =========================================================================
+ 'Grid View': 'グリッド表示',
+ 'List View': 'リスト表示',
+ 'Pin Primary Color ({color})': '現在の描画色 ({color}) を登録',
+ 'Customize Quick Access': 'クイックアクセスを編集',
+ 'No shortcuts. Click Edit to add tools, commands, brushes, or colors.':
+ 'ショートカットが登録されていません。「編集」からツール・コマンド・ブラシ・色を追加できます。',
+ 'Move Up': '上へ移動',
+ 'Move Down': '下へ移動',
+ 'Reset Quick Access to defaults': 'クイックアクセスを初期設定に戻す',
+ '+ Color': '+ 描画色',
+ '+ Brush': '+ ブラシ',
+ 'commands': 'コマンド',
+ 'tools': 'ツール',
+ 'brushs': 'ブラシ',
+ 'Ink Black': '墨黒',
+ 'Paper White': '紙白',
+
+ // COMMAND_CATALOG & QUICK_TOOL_CATALOG labels
+ 'Value Check (Live B/W)': '明度チェック(白黒表示)',
+ 'Merge Down': '下のレイヤーと結合',
+ 'New Layer': '新規レイヤー',
+ 'Reset Zoom': '表示倍率をリセット',
+ 'Reset Zoom to 100%': '100%表示',
+ 'Reset Rotation': '回転をリセット',
+ 'Transparent Ink': '透明色',
+ 'Lasso Selection': '投げなわ選択',
+ 'Toggle Fullscreen': 'フルスクリーン切替',
+ 'Focus Mode (Hide Palettes)': 'フォーカスモード(パレット非表示)',
+ 'Quick Brush Panel': 'クイックブラシパネル',
+ 'Fill Bucket': '塗りつぶし',
+ 'Shapes': '図形',
+ 'Marquee': '長方形選択',
+ 'Lasso': '投げなわ',
+ 'Magic Wand': '自動選択',
+ 'Frame Border': 'コマ枠',
+ 'Speech Balloon': 'フキダシ',
+ 'Correct Line': '線修正',
+
+ // Contextual homonym disambiguations
+ 'subView::Reference': '資料',
+ 'subView::Full': '全体',
+};
diff --git a/src/i18n/ja/common.ts b/src/i18n/ja/common.ts
new file mode 100644
index 0000000..4b020e8
--- /dev/null
+++ b/src/i18n/ja/common.ts
@@ -0,0 +1,270 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_COMMON: TranslationDictionary = {
+ // Common actions & buttons
+ 'OK': 'OK',
+ 'Ok': 'OK',
+ 'Cancel': 'キャンセル',
+ 'Close': '閉じる',
+ 'Apply': '適用',
+ 'Save': '保存',
+ 'Save As': '別名で保存',
+ 'Save As...': '別名で保存...',
+ 'Save Changes': '変更を保存',
+ 'Discard': '破棄',
+ 'Don\'t Save': '保存しない',
+ 'Delete': '削除',
+ 'Remove': '削除',
+ 'Rename': '名前を変更',
+ 'Duplicate': '複製',
+ 'Copy': 'コピー',
+ 'Cut': '切り取り',
+ 'Paste': '貼り付け',
+ 'Clear': '消去',
+ 'Reset': 'リセット',
+ 'Reset All': 'すべてリセット',
+ 'Reset to Defaults': '初期設定に戻す',
+ 'Restore Defaults': '初期設定に戻す',
+ 'Default': '標準',
+ 'Defaults': '初期設定',
+ 'Custom': 'カスタム',
+ 'Auto': '自動',
+ 'Manual': '手動',
+ 'None': 'なし',
+ 'Off': 'オフ',
+ 'On': 'オン',
+ 'ON': 'ON',
+ 'OFF': 'OFF',
+ 'Yes': 'はい',
+ 'No': 'いいえ',
+ 'Add': '追加',
+ 'New': '新規',
+ 'Create': '作成',
+ 'Open': '開く',
+ 'Open...': '開く...',
+ 'Import': '読み込み',
+ 'Import...': '読み込み...',
+ 'Export': '書き出し',
+ 'Export...': '書き出し...',
+ 'Download': 'ダウンロード',
+ 'Install': 'インストール',
+ 'Update': 'アップデート',
+ 'Refresh': '更新',
+ 'Reload': '再読み込み',
+ 'Search': '検索',
+ 'Search...': '検索...',
+ 'Filter': 'フィルター',
+ 'All': 'すべて',
+ 'Show': '表示',
+ 'Hide': '非表示',
+ 'Enable': '有効',
+ 'Disable': '無効',
+ 'Enabled': '有効',
+ 'Disabled': '無効',
+ 'Lock': 'ロック',
+ 'Unlock': 'ロック解除',
+ 'Locked': 'ロック中',
+ 'Confirm': '確定',
+ 'Done': '完了',
+ 'Continue': '続行',
+ 'Back': '戻る',
+ 'Next': '次へ',
+ 'Skip': 'スキップ',
+ 'Edit': '編集',
+ 'View': '表示',
+ 'Select': '選択',
+ 'Select All': 'すべて選択',
+ 'Deselect': '選択を解除',
+ 'Invert': '反転',
+ 'Preview': 'プレビュー',
+ 'Settings': '設定',
+ 'Preferences': '環境設定',
+ 'Preferences...': '環境設定...',
+ 'Help': 'ヘルプ',
+ 'About': 'バージョン情報',
+ 'Loading...': '読み込み中...',
+ 'Saving...': '保存中...',
+ 'Exporting...': '書き出し中...',
+ 'Processing...': '処理中...',
+ 'Ready': '準備完了',
+ 'Active': '使用中',
+ 'Selected': '選択中',
+ 'Untitled': '名称未設定',
+ 'Undo': '元に戻す',
+ 'Redo': 'やり直す',
+ 'More': 'その他',
+ 'Options': 'オプション',
+ 'Advanced': '詳細設定',
+ 'Basic': '基本',
+ 'General': '一般',
+ 'Name': '名前',
+ 'Type': '種類',
+ 'Mode': 'モード',
+ 'Style': 'スタイル',
+ 'Preset': 'プリセット',
+ 'Presets': 'プリセット',
+ 'Size': 'サイズ',
+ 'Width': '幅',
+ 'Height': '高さ',
+ 'Opacity': '不透明度',
+ 'Flow': 'インク量',
+ 'Density': '濃度',
+ 'Hardness': '硬さ',
+ 'Softness': '柔らかさ',
+ 'Strength': '強さ',
+ 'Intensity': '強度',
+ 'Amount': '適用量',
+ 'Radius': '半径',
+ 'Angle': '角度',
+ 'Rotation': '回転',
+ 'Scale': '拡大率',
+ 'Zoom': 'ズーム',
+ 'Position': '位置',
+ 'Offset': 'オフセット',
+ 'Spacing': '間隔',
+ 'Thickness': '太さ',
+ 'Length': '長さ',
+ 'Color': 'カラー',
+ 'Colors': 'カラー',
+ 'Background': '背景',
+ 'Foreground': '描画色',
+ 'Transparent': '透明',
+ 'Quality': '品質',
+ 'Speed': '速度',
+ 'Direction': '方向',
+ 'Horizontal': '水平',
+ 'Vertical': '垂直',
+ 'Left': '左',
+ 'Right': '右',
+ 'Top': '上',
+ 'Bottom': '下',
+ 'Center': '中央',
+ 'Top Left': '左上',
+ 'Top Right': '右上',
+ 'Bottom Left': '左下',
+ 'Bottom Right': '右下',
+ 'Low': '低',
+ 'Medium': '中',
+ 'High': '高',
+ 'Max': '最大',
+ 'Min': '最小',
+ 'Sharp': 'シャープ',
+ 'Soft': 'ソフト',
+ 'Hard': 'ハード',
+ 'Smooth': '滑らか',
+ 'Normal': '通常',
+ 'Linear': 'リニア',
+ 'Radial': '放射状',
+ 'Random': 'ランダム',
+ 'Count': '個数',
+ 'Contrast': 'コントラスト',
+ 'Brightness': '明るさ',
+ 'Saturation': '彩度',
+ 'Hue': '色相',
+ 'Lightness': '明度',
+ 'Luminosity': '輝度',
+ 'Gamma': 'ガンマ',
+ 'Threshold': 'しきい値',
+ 'Tolerance': '色の許容誤差',
+ 'Feather': 'ぼかし',
+ 'Blur': 'ぼかし',
+ 'Noise': 'ノイズ',
+ 'Grain': '粒子',
+ 'Texture': 'テクスチャ',
+ 'Paper': '用紙',
+ 'Canvas': 'キャンバス',
+ 'Layer': 'レイヤー',
+ 'Layers': 'レイヤー',
+ 'Folder': 'フォルダー',
+ 'Mask': 'マスク',
+ 'Selection': '選択範囲',
+ 'Brush': 'ブラシ',
+ 'Brushes': 'ブラシ',
+ 'Pen': 'ペン',
+ 'Pencil': '鉛筆',
+ 'Eraser': '消しゴム',
+ 'Fill': '塗りつぶし',
+ 'Gradient': 'グラデーション',
+ 'Eyedropper': 'スポイト',
+ 'Hand': '手のひら',
+ 'Move': '移動',
+ 'Transform': '変形',
+ 'Crop': '切り抜き',
+ 'Text': 'テキスト',
+ 'Shape': '図形',
+ 'Liquify': 'ゆがみ',
+ 'Retouch': 'レタッチ',
+ 'Decoration': 'デコレーション',
+ 'Ruler': '定規',
+ 'Frame': 'コマ枠',
+ 'Balloon': 'フキダシ',
+ 'Tone': 'トーン',
+ 'Animation': 'アニメーション',
+ 'Timelapse': 'タイムラプス',
+ 'Language': '言語',
+ 'System Default': 'システム設定に従う',
+ 'System Default ({lang})': 'システム設定に従う({lang})',
+ 'English': 'English',
+ 'Japanese': '日本語',
+ 'Language changed to {lang}': '表示言語を{lang}に変更しました',
+
+ // Contextual disambiguations
+ 'action::Close': '閉じる',
+ 'action::Clear': '消去',
+ 'action::Fill': '塗りつぶし',
+ 'action::Open': '開く',
+ 'action::Normal': '標準',
+ 'blendMode::Normal': '通常',
+ 'blendMode::Multiply': '乗算',
+ 'blendMode::Screen': 'スクリーン',
+ 'blendMode::Overlay': 'オーバーレイ',
+ 'blendMode::Darken': '比較(暗)',
+ 'blendMode::Lighten': '比較(明)',
+ 'blendMode::Color Dodge': '覆い焼きカラー',
+ 'blendMode::Color Burn': '焼き込みカラー',
+ 'blendMode::Hard Light': 'ハードライト',
+ 'blendMode::Soft Light': 'ソフトライト',
+ 'blendMode::Difference': '差の絶対値',
+ 'blendMode::Exclusion': '除外',
+ 'blendMode::Hue': '色相',
+ 'blendMode::Saturation': '彩度',
+ 'blendMode::Color': 'カラー',
+ 'blendMode::Luminosity': '輝度',
+ 'blendMode::Add (Glow)': '加算(発光)',
+ 'blendMode::Glow Dodge': '覆い焼き(発光)',
+ 'blendMode::Linear Burn': '焼き込み(リニア)',
+ 'blendMode::Vivid Light': 'ビビッドライト',
+ 'blendMode::Linear Light': 'リニアライト',
+ 'blendMode::Pin Light': 'ピンライト',
+ 'blendMode::Hard Mix': 'ハードミックス',
+ 'blendMode::Subtract': '減算',
+ 'blendMode::Divide': '除算',
+ 'blendMode::Through': '通過',
+ 'layerStyle::Stroke': '境界線',
+ 'brushStudio::Stroke': 'ストローク',
+ 'theme::Light': 'ライト',
+ 'theme::Dark': 'ダーク',
+ '3d::Light': '光源',
+ 'fill::Close Gap': '隙間閉じ',
+ 'pressure::Soft': '柔らかめ',
+ 'pressure::Hard': '硬め',
+ 'pressure::Linear': 'リニア',
+
+ // ErrorBoundary (main.tsx)
+ 'Graphics Editor Encountered an Error': 'エディターでエラーが発生しました',
+ 'An unexpected error occurred.': '予期しないエラーが発生しました。',
+ 'Reload Editor': 'エディターを再読み込み',
+
+ // Relative dates
+ 'Just now': 'たった今',
+ 'Yesterday': '昨日',
+ '{n}m ago': '{n}分前',
+ '{n}h ago': '{n}時間前',
+ '{n}d ago': '{n}日前',
+
+ // Default layer & doc names
+ 'Layer {n}': 'レイヤー {n}',
+ 'Folder {n}': 'フォルダー {n}',
+ 'Untitled {n}': '名称未設定 {n}',
+ 'Background Layer': '背景レイヤー',
+};
diff --git a/src/i18n/ja/index.ts b/src/i18n/ja/index.ts
new file mode 100644
index 0000000..06b8df7
--- /dev/null
+++ b/src/i18n/ja/index.ts
@@ -0,0 +1,43 @@
+import { TranslationDictionary } from '../types';
+import { JA_COMMON } from './common';
+import { JA_MENU } from './menu';
+import { JA_WORKSPACE } from './workspace';
+import { JA_BRUSHES } from './brushes';
+import { JA_LAYERS } from './layers';
+import { JA_COLOR } from './color';
+import { JA_MANGA_AND_3D } from './mangaAnd3d';
+import { JA_SETTINGS } from './settings';
+
+export const JA_DICTIONARY_DOMAINS: Readonly<Record<string, TranslationDictionary>> = {
+ common: JA_COMMON,
+ menu: JA_MENU,
+ workspace: JA_WORKSPACE,
+ brushes: JA_BRUSHES,
+ layers: JA_LAYERS,
+ color: JA_COLOR,
+ mangaAnd3d: JA_MANGA_AND_3D,
+ settings: JA_SETTINGS,
+};
+
+export const JA_DICTIONARY: TranslationDictionary = Object.assign(
+ Object.create(null) as TranslationDictionary,
+ JA_COMMON,
+ JA_MENU,
+ JA_WORKSPACE,
+ JA_BRUSHES,
+ JA_LAYERS,
+ JA_COLOR,
+ JA_MANGA_AND_3D,
+ JA_SETTINGS
+);
+
+export {
+ JA_COMMON,
+ JA_MENU,
+ JA_WORKSPACE,
+ JA_BRUSHES,
+ JA_LAYERS,
+ JA_COLOR,
+ JA_MANGA_AND_3D,
+ JA_SETTINGS,
+};
diff --git a/src/i18n/ja/layers.ts b/src/i18n/ja/layers.ts
new file mode 100644
index 0000000..3f359fc
--- /dev/null
+++ b/src/i18n/ja/layers.ts
@@ -0,0 +1,704 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_LAYERS: TranslationDictionary = {
+ // =========================================================================
+ // Contextual Disambiguations
+ // =========================================================================
+ // Extra Blend Modes (display labels beyond JA_COMMON)
+ 'blendMode::Pass Through': '通過',
+ 'blendMode::Darker Color': 'カラー比較(暗)',
+ 'blendMode::Lighter Color': 'カラー比較(明)',
+
+ // Blend Mode IDs (for history steps in useLayerPropertiesAndMasks)
+ 'blendModeId::pass-through': '通過',
+ 'blendModeId::normal': '通常',
+ 'blendModeId::darken': '比較(暗)',
+ 'blendModeId::multiply': '乗算',
+ 'blendModeId::color-burn': '焼き込みカラー',
+ 'blendModeId::linear-burn': '焼き込み(リニア)',
+ 'blendModeId::darker-color': 'カラー比較(暗)',
+ 'blendModeId::lighten': '比較(明)',
+ 'blendModeId::screen': 'スクリーン',
+ 'blendModeId::color-dodge': '覆い焼きカラー',
+ 'blendModeId::color-dodge-glow': '覆い焼き(発光)',
+ 'blendModeId::add-glow': '加算(発光)',
+ 'blendModeId::lighter-color': 'カラー比較(明)',
+ 'blendModeId::overlay': 'オーバーレイ',
+ 'blendModeId::soft-light': 'ソフトライト',
+ 'blendModeId::hard-light': 'ハードライト',
+ 'blendModeId::vivid-light': 'ビビッドライト',
+ 'blendModeId::linear-light': 'リニアライト',
+ 'blendModeId::pin-light': 'ピンライト',
+ 'blendModeId::hard-mix': 'ハードミックス',
+ 'blendModeId::difference': '差の絶対値',
+ 'blendModeId::exclusion': '除外',
+ 'blendModeId::subtract': '減算',
+ 'blendModeId::divide': '除算',
+ 'blendModeId::hue': '色相',
+ 'blendModeId::saturation': '彩度',
+ 'blendModeId::color': 'カラー',
+ 'blendModeId::luminosity': '輝度',
+
+ // Layer Styles & Stroke Position
+ 'layerStyle::Drop Shadow': 'ドロップシャドウ',
+ 'layerStyle::Outer Glow': '光彩(外側)',
+ 'layerStyle::Color Overlay': 'カラーオーバーレイ',
+ 'strokePos::outside': '外側',
+ 'strokePos::inside': '内側',
+ 'strokePos::center': '中央',
+
+ // Tonal Ranges (Color Balance)
+ 'tonalRange::shadows': 'シャドウ',
+ 'tonalRange::midtones': '中間調',
+ 'tonalRange::highlights': 'ハイライト',
+
+ // Puppet Warp & Mesh Density
+ 'puppetRigidity::rigid': '剛体',
+ 'puppetRigidity::normal': '通常',
+ 'puppetRigidity::distort': '伸縮',
+ 'meshDensity::coarse': '粗め',
+ 'meshDensity::normal': '標準',
+ 'meshDensity::fine': '細かい',
+
+ // Layer Filter
+ 'layerFilter::Reference': '参照',
+
+ // Hook Enums (Adjustment, Filter, Manga Effect, Expression Color, Shape, Liquify, Vector Edit)
+ 'adjustmentType::curves': 'トーンカーブ',
+ 'adjustmentType::gradient-map': 'グラデーションマップ',
+ 'adjustmentType::levels': 'レベル補正',
+ 'adjustmentType::color-balance': 'カラーバランス',
+
+ 'filterName::gaussian blur': 'ガウスぼかし',
+ 'filterName::motion blur': '移動ぼかし',
+ 'filterName::unsharp mask': 'アンシャープマスク',
+ 'filterName::film grain': 'フィルム粒子',
+
+ 'mangaEffect::saturated': '集中線',
+ 'mangaEffect::stream': '流線',
+
+ 'expressionColor::color': 'カラー',
+ 'expressionColor::gray': 'グレー',
+ 'expressionColor::monochrome': 'モノクロ',
+ 'expressionColorUpper::COLOR': 'カラー',
+ 'expressionColorUpper::GRAY': 'グレー',
+ 'expressionColorUpper::MONOCHROME': 'モノクロ',
+
+ 'shapeType::Line': '直線',
+ 'shapeType::Rectangle': '長方形',
+ 'shapeType::Rounded-rect': '角丸長方形',
+ 'shapeType::Ellipse': '楕円',
+ 'shapeType::Triangle': '三角形',
+ 'shapeType::Polygon': '多角形',
+ 'shapeType::Star': '星形',
+ 'shapeType::Arrow': '矢印',
+
+ 'liquifyMode::Push': '移動',
+ 'liquifyMode::Expand': '膨張',
+ 'liquifyMode::Pinch': '収縮',
+ 'liquifyMode::Push-left': '左押し出し',
+ 'liquifyMode::Push-right': '右押し出し',
+ 'liquifyMode::Twirl-cw': '右回転',
+ 'liquifyMode::Twirl-ccw': '左回転',
+ 'liquifyMode::Reconstruct': '復元',
+
+ 'vectorEditMode::pinch': '線つまみ',
+ 'vectorEditMode::width': '線幅修正',
+ 'vectorEditMode::simplify': '線の単純化',
+
+ // =========================================================================
+ // RightSidebar (Layers & History Panel)
+ // =========================================================================
+ 'Resize sidebar': 'サイドバーの幅を変更',
+ '{match}/{total} Layers': '{match}/{total} レイヤー',
+ '{count} Layers': '{count} レイヤー',
+ '{count} Steps': '{count} 件',
+ 'Layers and History': 'レイヤーとヒストリー',
+ 'History': 'ヒストリー',
+ 'No canvas open': 'キャンバスが開かれていません',
+ 'Blend Mode': '合成モード',
+ 'Layer Opacity': '不透明度',
+ 'Layer Opacity: {percent}%': 'レイヤーの不透明度: {percent}%',
+ 'Unlock Layer': 'レイヤーのロックを解除',
+ 'Lock Layer': 'レイヤーをロック',
+ 'Clip to Layer Below': '下のレイヤーでクリッピング',
+ 'Lock Transparent Pixels (Alpha Lock)': '透明ピクセルをロック',
+ 'Enable Layer Mask': 'レイヤーマスクを有効化',
+ 'Disable Layer Mask': 'レイヤーマスクを無効化',
+ 'Add Layer Mask': 'レイヤーマスクを作成',
+ 'Reference Layer': '参照レイヤー',
+ 'Layer Color Label: {name}': 'レイヤーパレットカラー: {name}',
+ 'Set Layer Color Label': 'レイヤーパレットカラーを設定',
+ 'Owner-Locked by {owner} (click to unlock)': '{owner} によるオーナーロック中(クリックで解除)',
+ 'Owner': 'オーナー',
+ 'Lock Layer to Owner (prevents edits by other peers)': 'オーナーロック(他メンバーの編集を防止)',
+ '3D Reference Layer': '3D参照レイヤー',
+ 'Unlock folder to merge': '結合するにはフォルダーのロックを解除してください',
+ 'Merge Folder into Single Layer': 'フォルダーを1枚のレイヤーに結合',
+ 'Unlock folder to transform': '変形するにはフォルダーのロックを解除してください',
+ 'Transform Folder (Ctrl+T)': 'フォルダーを変形 (Ctrl+T)',
+ 'Search layers...': 'レイヤーを検索...',
+ 'Search layers': 'レイヤーを検索',
+ 'Clear search': '検索をクリア',
+ 'Filter layers by color label or type': 'パレットカラーや種類でレイヤーを絞り込み',
+ 'All Color Labels': 'すべてのカラー',
+ 'Filter: {name}': 'フィルター: {name}',
+ 'Filter: Unlabeled Layers': 'フィルター: ラベルなし',
+ 'Filter by layer type': 'レイヤーの種類で絞り込み',
+ 'All Kinds': 'すべての種類',
+ 'Raster Layers': 'ラスターレイヤー',
+ 'Folders': 'フォルダー',
+ 'Text / Balloons': 'テキスト/フキダシ',
+ 'Adjustments': '色調補正',
+ 'Screentone': 'トーン',
+ 'Masked': 'マスク付き',
+ 'Hidden': '非表示',
+ 'Isolated: {name}': '単独表示: {name}',
+ 'Solo: {name}': 'ソロ: {name}',
+ 'Restore': '復元',
+ 'No layers match filter': '条件に一致するレイヤーがありません',
+ 'Clear filter': 'フィルターを解除',
+ 'Soloed — Alt+Click to Restore All': '単独表示中 — Alt+クリックで元に戻す',
+ 'Hide Layer (Alt+Click to Solo)': 'レイヤーを非表示(Alt+クリックで単独表示)',
+ 'Show Layer (Alt+Click to Solo)': 'レイヤーを表示(Alt+クリックで単独表示)',
+ 'Color Label: {name}': 'カラーラベル: {name}',
+ 'Clipped to layer below': '下のレイヤーでクリッピング中',
+ 'Non-destructive Text Layer (Double-click to edit)': 'テキストレイヤー(ダブルクリックで編集)',
+ 'Non-destructive Speech Balloon (Double-click to edit)': 'フキダシレイヤー(ダブルクリックで編集)',
+ 'Layer Mask': 'レイヤーマスク',
+ 'Alpha Locked': '透明ピクセルをロック中',
+ 'Locked by {owner}': '{owner} がロック中',
+ 'owner': 'オーナー',
+ 'Expression Color': '表現色',
+ 'Mono': '等幅',
+ 'Gray': 'グレー',
+ 'Express': '描画色',
+ 'Black': '黒',
+ 'White': '白',
+ 'Apply Expression Color': 'プレビュー中の表現色を適用',
+ 'Tone & Tint': 'トーン・レイヤーカラー',
+ 'Tint': 'レイヤーカラー',
+ 'New Screentone Layer...': '新規トーンレイヤー...',
+ 'Layer tones': 'レイヤーの濃淡を使用',
+ 'Frequency': '線数',
+ 'Circle Dot': '円',
+ 'Euclidean Dot': 'ユークリッド網点',
+ 'Line (Hatching)': '線(平行線)',
+ 'Diamond': 'ひし形',
+ 'Layer Tint': 'レイヤーカラー',
+ 'Main': 'メイン',
+ 'Sub': 'サブ',
+ 'Apply Tint': 'レイヤーカラーを確定',
+ 'New Layer (Ctrl+Shift+N)': '新規ラスターレイヤー (Ctrl+Shift+N)',
+ 'New Folder / Group (Ctrl+G)': '新規レイヤーフォルダー (Ctrl+G)',
+ 'Toggle Layer Mask': 'レイヤーマスクを切り替え',
+ 'New Adjustment Layer': '新規色調補正レイヤー',
+ 'New curves...': '新規トーンカーブ...',
+ 'New levels...': '新規レベル補正...',
+ 'New gradient map...': '新規グラデーションマップ...',
+ 'New color balance...': '新規カラーバランス...',
+ 'Layer Styles (fx)': 'レイヤースタイル (fx)',
+ 'Duplicate Layer (Ctrl+J)': 'レイヤーを複製 (Ctrl+J)',
+ 'Delete Layer': 'レイヤーを削除',
+ 'Drop image to import layer': '画像をドロップしてレイヤーとして読み込み',
+ 'Exit Solo Mode': '単独表示を解除',
+ 'Solo / Isolate Layer': 'このレイヤーのみ表示(単独表示)',
+ 'Alt+Eye': 'Alt+表示',
+ 'Enable Mask': 'マスクを有効化',
+ 'Disable Mask': 'マスクを無効化',
+ 'Link Mask': 'マスクをレイヤーにリンク',
+ 'Unlink Mask': 'マスクのリンクを解除',
+ 'Delete Mask': 'マスクを削除',
+ 'Edit Adjustment...': '色調補正を編集...',
+ 'Edit Text...': 'テキストを編集...',
+ 'Edit Speech Balloon...': 'フキダシを編集...',
+ 'Rasterize Layer': 'レイヤーをラスタライズ',
+ 'Layer Styles...': 'レイヤースタイル...',
+ 'Merge Folder': 'フォルダーを結合',
+ 'Group (Ctrl+G)': 'フォルダーにまとめる (Ctrl+G)',
+
+ // Layer Organization Color Labels (layerOrganization.ts)
+ 'Red': '赤',
+ 'Orange': 'オレンジ',
+ 'Yellow': 'イエロー',
+ 'Green': 'グリーン',
+ 'Cyan': 'シアン',
+ 'Blue': 'ブルー',
+ 'Purple': 'パープル',
+
+ // =========================================================================
+ // LayerStylesModal
+ // =========================================================================
+ 'Layer Style — {name}': 'レイヤースタイル — {name}',
+ 'Cancel (Esc)': 'キャンセル (Esc)',
+ 'Styles': 'スタイル',
+ 'Stroke Options': '境界線オプション',
+ 'Enable Stroke': '境界線を有効化',
+ 'Drop Shadow Options': 'ドロップシャドウオプション',
+ 'Enable Shadow': 'ドロップシャドウを有効化',
+ 'Distance': '距離',
+ 'Spread': 'スプレッド',
+ 'Size (Blur)': 'サイズ(ぼかし)',
+ 'Outer Glow Options': '光彩(外側)オプション',
+ 'Enable Glow': '光彩(外側)を有効化',
+ 'Reset Category': 'この項目をリセット',
+
+ // =========================================================================
+ // AdjustmentModal & GRADIENT_PRESETS
+ // =========================================================================
+ 'Edit Adjustment Layer': '色調補正レイヤーを編集',
+ 'Tone Curves': 'トーンカーブ',
+ 'Gradient Map': 'グラデーションマップ',
+ 'Levels': 'レベル補正',
+ 'Color Balance': 'カラーバランス',
+ 'Channel:': 'チャンネル:',
+ 'In: {inVal} Out: {outVal}': '入力: {inVal} 出力: {outVal}',
+ 'Click curve to add points': 'カーブ上をクリックして制御点を追加',
+ 'Delete Point': '点を削除',
+ 'Color Ramp (Click to add stop):': 'カラーバー(クリックで分岐点を追加):',
+ 'Blend:': '補間:',
+ 'Stop {index}: {color} ({percent}%)': '分岐点 {index}: {color} ({percent}%)',
+ 'Color:': '色:',
+ 'Pos:': '座標:',
+ 'Delete Stop': '分岐点を削除',
+ 'Presets:': 'プリセット:',
+ 'Shadows (Black Point):': 'シャドウ(黒レベル):',
+ 'Midtones (Gamma):': '中間調(ガンマ):',
+ 'Highlights (White Point):': 'ハイライト(白レベル):',
+ 'Out Min:': '出力最小:',
+ 'Out Max:': '出力最大:',
+ 'Preserve Luminosity': '輝度を保持',
+ 'Create Layer': 'レイヤーを作成',
+ // Gradient Map Presets
+ 'Sepia': 'セピア',
+ 'Sunset': '夕焼け',
+ 'Cyberpunk': 'サイバーパンク',
+ 'Emerald': 'エメラルド',
+ 'Inferno': 'インフェルノ',
+
+ // =========================================================================
+ // TonalCorrectionModal & FilterModal
+ // =========================================================================
+ 'Brightness / Contrast': '明るさ・コントラスト',
+ 'Binarization (Threshold)': '二値化(しきい値)',
+ 'Hue / Saturation / Luminosity': '色相・彩度・明度',
+ 'Posterization': '階調化',
+ 'Level Correction': 'レベル補正',
+ 'Tonal Correction': '色調補正',
+ 'Black (1)': '黒 (1)',
+ 'Mid (128)': '中間 (128)',
+ 'White (255)': '白 (255)',
+ 'Gradation Levels': '階調数',
+ '2 (High Contrast)': '2(高コントラスト)',
+ '32 (Smooth)': '32(滑らか)',
+ 'Channel': 'チャンネル',
+ 'Input Levels (Shadow / Gamma / Highlight)': '入力レベル(シャドウ/ガンマ/ハイライト)',
+ 'Highlight': 'ハイライト',
+ 'Output Levels': '出力レベル',
+ 'Min (Black)': '最小(黒)',
+ 'Max (White)': '最大(白)',
+ 'Reset parameters': 'パラメーターをリセット',
+ 'Gaussian Blur': 'ガウスぼかし',
+ 'Motion Blur': '移動ぼかし',
+ 'Unsharp Mask': 'アンシャープマスク',
+ 'Film Grain': 'フィルム粒子',
+ 'Radius (px)': '半径 (px)',
+ 'Distance (px)': '距離 (px)',
+ 'Angle (°)': '角度 (°)',
+ 'Intensity (%)': '強度 (%)',
+ 'Grain Size (px)': '粒子サイズ (px)',
+ 'Monochromatic Grain': 'モノクロ粒子',
+
+ // =========================================================================
+ // TransformOverlay, SelectionOverlay, GradientOverlay, PenPathOverlay, QuickShapeOverlay
+ // =========================================================================
+ 'Drag to Move': 'ドラッグで移動',
+ 'Drag to Rotate': 'ドラッグで回転',
+ 'Corner Pin {index}': 'コーナーピン {index}',
+ 'Mesh Handle [{row}, {col}]': 'メッシュ制御点 [{row}, {col}]',
+ 'Drag to rotate joint ({angle}°, Shift snaps 15°, double-click resets)':
+ 'ドラッグで関節を回転({angle}°・Shiftで15°スナップ・ダブルクリックでリセット)',
+ 'Pin #{index} · Drag to move · Alt+Drag or ring to rotate · Right-click or Del to remove':
+ 'ピン #{index}・ドラッグで移動・Alt+ドラッグまたはリングで回転・右クリック/Delで削除',
+ 'Click to close cage & begin deforming': 'クリックしてケージを閉じ、変形を開始',
+ 'Cage Vertex {index} · Drag to shape cage · Right-click to remove':
+ 'ケージ頂点 {index}・ドラッグで形状調整・右クリックで削除',
+ 'Cage Vertex {index} · Drag to warp': 'ケージ頂点 {index}・ドラッグで変形',
+ 'Free Transform (Affine Scale & Rotate)': '自由変形(拡大縮小・回転)',
+ 'Free': 'フリー',
+ 'Perspective Quad (4-Point Homography)': '遠近法変形(4点パース)',
+ 'Perspective': 'パース',
+ 'Mesh Warp (Catmull-Rom Bicubic Lattice)': 'メッシュ変形(格子ワープ)',
+ 'Mesh': 'メッシュ',
+ 'Puppet Warp (Place joint pins to bend limbs, tilt head & adjust cloak folds)':
+ 'パペットワープ(関節ピンを打って手足や姿勢を自然に曲げる)',
+ 'Puppet': 'パペット',
+ 'Cage Transform (Deform artwork inside an editable polygon cage)':
+ 'ケージ変形(多角形ケージで囲んで自由に変形)',
+ 'Cage': 'ケージ',
+ 'Apply Transform (Enter)': '変形を確定 (Enter)',
+ 'Cancel Transform (Esc)': '変形をキャンセル (Esc)',
+ 'Flip Horizontal': '左右反転',
+ 'Flip Vertical': '上下反転',
+ 'Reset Transform': '変形をリセット',
+ 'Grid': 'グリッド',
+ 'Rigid (Preserves bone/limb rigidity & volume)': '剛体(骨格や腕の硬さ・体積を保持)',
+ 'Normal (Balanced ARAP smooth bending)': '通常(バランスの良い滑らかな曲げ)',
+ 'Distort (Elastic similarity stretch for cloaks & stylization)': '伸縮(マントや誇張表現向けの柔軟な伸縮)',
+ 'Mesh Density: {density}': 'メッシュ密度: {density}',
+ 'Med': '中',
+ 'Fine': '細密',
+ 'Mesh Expansion padding around silhouette': 'シルエット周囲のメッシュ拡張余白',
+ 'Exp': '拡張',
+ 'Decrease mesh expansion': 'メッシュ拡張を減らす',
+ 'Increase mesh expansion': 'メッシュ拡張を増やす',
+ 'Show / Hide Mesh Wireframe': 'メッシュ枠を表示/非表示',
+ 'Send Pin Depth Backward (limb behind)': 'ピンの重なり順を奥へ送る',
+ 'Bring Pin Depth Forward (limb in front)': 'ピンの重なり順を手前へ出す',
+ 'Reset selected pin rotation to 0°': '選択中ピンの回転を 0° にリセット',
+ 'Remove Selected Pin (Del)': '選択中のピンを削除 (Del)',
+ 'Click artwork to place joint pins': 'イラスト上をクリックしてピンを配置',
+ '{count} pin': 'ピン {count}個',
+ '{count} pins': 'ピン {count}個',
+ 'Clear All Pins': 'すべてのピンを消去',
+ 'Deform Mode: Drag cage vertices or edges to smoothly warp pixels':
+ '変形モード: ケージの頂点や辺をドラッグして滑らかに変形',
+ 'Deform': '変形',
+ 'Edit Cage: Reshape rest cage, click edges to add points, right-click points to delete':
+ 'ケージ編集: 頂点移動・辺クリックで点追加・右クリックで削除',
+ 'Edit Cage': 'ケージ編集',
+ 'Close Cage Polygon': 'ケージを閉じる',
+ 'Close ({count})': '閉じる ({count})',
+ 'Draw a custom polygon cage around a specific region (head, arm, cloak)':
+ '任意の領域を囲むカスタムケージを描き直す',
+ 'Redraw': '描き直し',
+ 'Auto-fit tight silhouette cage around artwork': 'イラストの輪郭に自動でケージをフィット',
+ 'Auto Fit': '自動フィット',
+ 'Show / Hide Internal Cage Mesh': '内部ケージメッシュを表示/非表示',
+ 'Click to place cage vertices': 'クリックしてケージの頂点を配置',
+ 'Click first vertex or Close to deform': '最初の頂点または「閉じる」をクリックして変形開始',
+
+ // SelectionOverlay
+ 'Deselect (Ctrl+D)': '選択を解除 (Ctrl+D)',
+ 'Invert Selection (Ctrl+Shift+I)': '選択範囲を反転 (Ctrl+Shift+I)',
+ 'Expand Selection (+5px)': '選択範囲を拡張 (+5px)',
+ 'Contract Selection (-5px)': '選択範囲を縮小 (-5px)',
+ 'Feather Selection (5px)': '選択範囲の境界をぼかす (5px)',
+ 'Cut Selection (Ctrl+X)': '選択範囲を切り取り (Ctrl+X)',
+ 'Copy Selection (Ctrl+C)': '選択範囲をコピー (Ctrl+C)',
+ 'Paste to New Layer (Ctrl+V)': '新規レイヤーに貼り付け (Ctrl+V)',
+ 'Move Selected Section to New Layer (Ctrl+Shift+J)': '選択範囲を新規レイヤーへ移動 (Ctrl+Shift+J)',
+ 'To Layer': 'レイヤー化',
+ 'Delete Selected Section (Del)': '選択範囲内を消去 (Del)',
+ 'Delete Outside Selected Section': '選択範囲外を消去',
+ 'Del Outside': '範囲外消去',
+ 'Fill with Foreground Color': '描画色で塗りつぶし',
+ 'Fill Screentone into New Layer': '選択範囲に新規トーンを貼る',
+ 'Transform Selection (Ctrl+T)': '選択範囲を変形 (Ctrl+T)',
+
+ // GradientOverlay & PenPathOverlay
+ 'Drag to rotate all mesh vertices (Shift: 15° snap)': 'ドラッグでメッシュ全体を回転(Shiftで15°スナップ)',
+ 'Mesh ({cols}×{rows})': 'メッシュ ({cols}×{rows})',
+ ' · {count} sel': '・{count}点選択',
+ '{count}pt · Closed': '{count}点・閉じパス',
+ '{count}pt': '{count}点',
+ 'Commit': '確定',
+
+ // QuickShapeOverlay & quickShapeEngine
+ 'Line': '直線',
+ 'Arc': '円弧',
+ 'Circle': '正円',
+ 'Ellipse': '楕円',
+ 'Triangle': '三角形',
+ 'Rectangle': '長方形',
+ 'Shift: 15° · Alt: Move': 'Shift: 15°スナップ・Alt: 移動',
+ 'Alt: Bend · Shift: 15°': 'Alt: 曲げ調整・Shift: 15°スナップ',
+ 'Alt: Move': 'Alt: 移動',
+ 'Shift: Circle · Alt: Stretch': 'Shift: 正円・Alt: 伸縮',
+ 'Shift: Snap · Alt: Scale/Rotate': 'Shift: 整形・Alt: 拡縮/回転',
+ 'Shift: Square · Alt: Rotate': 'Shift: 正方形・Alt: 回転',
+
+ // =========================================================================
+ // AutoActionPanel & autoActionEngine Built-ins
+ // =========================================================================
+ 'Action Set {n}': 'アクションセット {n}',
+ 'Created set "{name}"': 'セット「{name}」を作成しました',
+ 'Auto Action recording stopped': 'オートアクションの記録を停止しました',
+ 'Recording Auto Action steps...': 'オートアクションの操作を記録中...',
+ 'Ink Studio Auto Actions': 'Ink Studio オートアクション',
+ 'Save Auto Actions As': 'オートアクションを別名で保存',
+ 'Exported {fileName}': '{fileName} を書き出しました',
+ 'Failed to export Auto Action sets': 'オートアクションセットの書き出しに失敗しました',
+ 'Imported {count} Auto Action set(s)': '{count}件のオートアクションセットを読み込みました',
+ 'Failed to import Auto Actions': 'オートアクションの読み込みに失敗しました',
+ 'New Action Set': '新規アクションセット',
+ 'Import Action Sets (.json)': 'アクションセットを読み込み (.json)',
+ 'Export Action Sets (.json)': 'アクションセットを書き出し (.json)',
+ 'New action name...': '新しいアクション名...',
+ 'Create Auto Action': 'オートアクションを作成',
+ 'Recording commands...': 'コマンドを記録中...',
+ 'Stop': '停止',
+ 'No actions in this set. Click + to create one.':
+ 'このセットにアクションがありません。+をクリックして作成してください。',
+ 'Play Auto Action': 'オートアクションを再生',
+ 'Delete Action': 'アクションを削除',
+ 'Empty. Press Record and perform layer/filter commands.':
+ '手順が空です。「記録」を押してレイヤーやフィルター操作を実行してください。',
+ 'Remove step': '手順を削除',
+ 'Record': '記録',
+ 'Play': '再生',
+ 'Invalid Auto Actions JSON format': 'オートアクションJSONの形式が無効です',
+
+ // Built-in Auto Action Set, Actions & Steps (autoActionEngine.ts)
+ 'Manga & Illustration Presets': '漫画・イラスト用プリセット',
+ 'Lineart Prep': '線画レイヤー下準備',
+ 'Expression Color: Monochrome': '表現色: モノクロ',
+ 'Disable Layer Tint': 'レイヤーカラーを無効化',
+ 'Blend Mode: Multiply': '合成モード: 乗算',
+ 'New Layer: Color Flats': '新規レイヤー: 下塗り',
+ 'Color Flats': '下塗り',
+ 'Quick Auto-Shadow': 'クイック自動影レイヤー',
+ 'New Layer: Shadow': '新規レイヤー: 影',
+ 'Opacity: 45%': '不透明度: 45%',
+ 'Fill Cool Shadow (#7b8cde)': '寒色影で塗りつぶし (#7b8cde)',
+ 'Draft to Blue Sketch': '下書きを青鉛筆化',
+ 'Layer Color: Blue Draft': 'レイヤーカラー: 青下書き',
+ 'Opacity: 35%': '不透明度: 35%',
+ 'New Layer: Inks': '新規レイヤー: ペン入れ',
+ 'Inks': 'ペン入れ',
+ 'Screentone Shade (60L)': 'スクリーントーン影(60線)',
+ 'New Layer: Tone 60L': '新規レイヤー: トーン 60L',
+ 'Tone 60L': 'トーン 60L',
+ 'Enable Screentone (60 LPI, 35%)': 'トーン有効化(60線・35%)',
+
+ // =========================================================================
+ // Shared UI Controls (ScrubSlider, PrecisionNumberInput, ToggleSwitch)
+ // =========================================================================
+ '{label}: {value} (Drag · Shift for fine · Double-click to reset)':
+ '{label}: {value}(ドラッグ調整・Shiftで微調整・ダブルクリックでリセット)',
+ '{value} (Drag · Shift for fine · Double-click to reset)':
+ '{value}(ドラッグ調整・Shiftで微調整・ダブルクリックでリセット)',
+ '{label}: {value} (Drag · Shift for fine)': '{label}: {value}(ドラッグ調整・Shiftで微調整)',
+ '{value} (Drag · Shift for fine)': '{value}(ドラッグ調整・Shiftで微調整)',
+ '{label} value': '{label}の値',
+ 'Numeric value': '数値',
+ 'Click to type exact value': 'クリックして数値を直接入力',
+ 'Drag horizontally to scrub {label} · Shift for fine · Double-click to reset':
+ '左右ドラッグで{label}を調整・Shiftで微調整・ダブルクリックでリセット',
+ 'Drag horizontally to scrub {label} · Shift for fine': '左右ドラッグで{label}を調整・Shiftで微調整',
+ 'Numeric input': '数値入力',
+ 'Increase {label}': '{label}を増やす',
+ 'Increase value': '値を増やす',
+ 'Decrease {label}': '{label}を減らす',
+ 'Decrease value': '値を減らす',
+ 'Toggle': '切り替え',
+
+ // =========================================================================
+ // Hooks: Tonal, Filters, Selection, Shape, Fill, Pen, Gradient, Retouch, Vector, History, Layer Manager
+ // =========================================================================
+ 'Updated {type} adjustment layer': '色調補正レイヤー({type})を更新しました',
+ 'Created new {type} adjustment layer': '新規色調補正レイヤー({type})を作成しました',
+ 'Updated Layer Styles': 'レイヤースタイルを更新しました',
+ 'Select an unlocked raster layer to apply filter': 'フィルターを適用するロック解除済みラスターレイヤーを選択してください',
+ 'Filter applied: {name}': 'フィルターを適用しました: {name}',
+ 'Brightness/Contrast': '明るさ・コントラスト',
+ 'Binarization': '二値化',
+ 'Hue/Saturation/Luminosity': '色相・彩度・明度',
+ 'Reverse Gradient': '階調の反転',
+ 'Switched to "{name}" (active layer had no pixels)': '「{name}」に切り替えました(選択中のレイヤーは空でした)',
+ 'Selected layer is empty. Draw or open an image first.': '選択中のレイヤーが空です。描画するか画像を開いてください。',
+ 'Applied {label}': '{label}を適用しました',
+ 'Inverted colors (Reverse Gradient)': '色を反転しました(階調の反転)',
+ 'Manga Effect ({type})': '効果線({type})',
+ 'Applied manga {type} lines': '効果線({type})を適用しました',
+ 'Added 3D layer "{name}".': '3Dレイヤー「{name}」を追加しました。',
+ 'Screentone ({density}%)': 'スクリーントーン ({density}%)',
+ 'Created Screentone Layer ({density}%)': 'トーンレイヤー({density}%)を作成しました',
+ 'Applied expression color to layer': 'レイヤーに表現色を適用しました',
+ 'Apply Layer Color Tint': 'レイヤーカラーを適用',
+ 'Applied tint to layer permanently': 'レイヤーカラーをレイヤーに確定しました',
+ 'Convert to {mode}': '{mode}に変換',
+ 'Converted layer to {mode}': 'レイヤーを{mode}に変換しました',
+
+ // Selection & Transform
+ 'Move Selection': '選択範囲を移動',
+ 'Select an unlocked raster layer': 'ロックされていないラスターレイヤーを選択してください',
+ 'Delete Selection': '選択範囲内を消去',
+ 'Delete Outside Selection': '選択範囲外を消去',
+ 'Deleted outside selection': '選択範囲外を消去しました',
+ 'Nothing outside selection to delete': '選択範囲外に消去する対象がありません',
+ 'Select a raster layer to copy selection': '選択範囲をコピーするラスターレイヤーを選択してください',
+ 'Copied selection from "{name}"': '「{name}」から選択範囲をコピーしました',
+ 'Selected area is empty': '選択範囲内に描画がありません',
+ 'Select an unlocked raster layer to cut': '切り取るにはロック解除済みのラスターレイヤーを選択してください',
+ 'Failed to cut selection': '選択範囲を切り取れませんでした',
+ 'Cut Selection': '選択範囲を切り取り',
+ 'Cut selection from "{name}"': '「{name}」から選択範囲を切り取りました',
+ '{name} (Cut)': '{name}(切り取り)',
+ 'Move Selection to New Layer': '選択範囲を新規レイヤーへ移動',
+ 'Moved selection to "{name}"': '選択範囲を「{name}」へ移動しました',
+ 'Select a raster layer': 'ラスターレイヤーを選択してください',
+ '{name} (Copy)': '{name}(コピー)',
+ 'Copy Selection to New Layer': '選択範囲をコピーして新規レイヤーへ',
+ 'Copied selection to "{name}"': '選択範囲を「{name}」へコピーしました',
+ 'Select a raster layer to fill': '塗りつぶすラスターレイヤーを選択してください',
+ 'Select a child layer inside the Frame Border Folder to fill':
+ '塗りつぶすにはコマ枠フォルダー内の子レイヤーを選択してください',
+ 'Active layer is locked': '選択中のレイヤーはロックされています',
+ 'Active layer is hidden': '選択中のレイヤーは非表示です',
+ 'Alpha Lock is enabled on an empty layer': '空のレイヤーで透明ピクセルのロックが有効になっています',
+ 'Fill Selection': '選択範囲を塗りつぶし',
+ 'Expand Selection (+{pixels}px)': '選択範囲を拡張 (+{pixels}px)',
+ 'Expanded Selection (+{pixels}px)': '選択範囲を拡張しました (+{pixels}px)',
+ 'Contract Selection (-{pixels}px)': '選択範囲を縮小 (-{pixels}px)',
+ 'Selection contracted to empty': '縮小により選択範囲がなくなりました',
+ 'Contracted Selection (-{pixels}px)': '選択範囲を縮小しました (-{pixels}px)',
+ 'Feather Selection ({radius}px)': '選択範囲をぼかす ({radius}px)',
+ 'Feathered Selection ({radius}px)': '選択範囲をぼかしました ({radius}px)',
+ 'Invert Selection': '選択範囲を反転',
+ 'Inverted Selection (Empty)': '選択範囲を反転しました(空)',
+ 'Inverted Selection': '選択範囲を反転しました',
+ 'Selected All (Ctrl+A)': 'すべて選択しました (Ctrl+A)',
+ 'Select an unlocked raster layer or folder to transform':
+ '変形するにはロック解除済みのラスターレイヤーまたはフォルダーを選択してください',
+ 'Unlock the selected folder to transform': '選択中のフォルダーのロックを解除してください',
+ 'Selected folder has no unlocked raster layers to transform':
+ '選択中のフォルダー内に変形可能なラスターレイヤーがありません',
+ 'Selected folder is empty': '選択中のフォルダーは空です',
+ 'Selected layers are empty': '選択中のレイヤーは空です',
+ 'Active layer is empty': '選択中のレイヤーは空です',
+ 'Puppet Warp': 'パペットワープ',
+ 'Cage Transform': 'ケージ変形',
+ 'Mesh Warp': 'メッシュ変形',
+ 'Perspective Transform': '遠近法変形',
+ 'Free Transform': '自由変形',
+ '{mode} ({count} layers)': '{mode}({count}レイヤー)',
+ 'Magic Wand Select': '自動選択',
+ 'Selection Eraser': '選択範囲消しゴム',
+ 'Selection Pen': '選択ペン',
+ 'Marquee Select': '長方形選択',
+ 'Lasso Select': '投げなわ選択',
+
+ // Shape, Liquify, Fill, Frame, Pen, Gradient, Retouch, Vector
+ 'Layer is locked': 'レイヤーがロックされています',
+ 'Select an unlocked, visible raster layer to draw shapes':
+ '図形を描くには表示中・ロック解除済みのラスターレイヤーを選択してください',
+ 'Select a raster layer to use the Fill tool': '塗りつぶしツールを使うにはラスターレイヤーを選択してください',
+ 'Switch off Transparent Ink (C) to paint unfilled areas':
+ '塗り残し部分を塗るには透明色モード (C) を解除してください',
+ 'Click inside the active selection to fill': '選択範囲の内側をクリックして塗りつぶしてください',
+ 'Erase Fill': '透明色で塗りつぶし',
+ 'Bucket Fill': '塗りつぶし',
+ 'Fill failed': '塗りつぶしに失敗しました',
+ 'Click a Text or Speech Balloon layer to edit': '編集するテキストまたはフキダシをクリックしてください',
+ 'Shape: {name}': '図形: {name}',
+ 'Liquify ({count} layers): {mode}': 'ゆがみ({count}レイヤー): {mode}',
+ 'Liquify: {mode}': 'ゆがみ: {mode}',
+ 'Enclose & Erase': '囲って消去',
+ 'Enclose & Fill': '囲って塗る',
+ 'No closed outline found — try increasing Close Gap or check Reference Layer':
+ '閉じた輪郭が見つかりません — 隙間閉じを大きくするか参照レイヤーを確認してください',
+ 'Paint Unfilled Area': '塗り残し部分に塗る',
+ 'Lasso Erase': '投げなわ消去',
+ 'Lasso Fill': '投げなわ塗り',
+ 'No Frame Border Folder intersected by cut line': '分割線と交差するコマ枠フォルダーがありません',
+ 'Divide Frame Folder': 'コマ枠フォルダーを分割',
+ 'Divide Frame Border': 'コマ枠を分割',
+ 'Frame split into 2 Frame Folders': 'コマ枠を2つのコマ枠フォルダーに分割しました',
+ 'Frame divided with manga gutter': 'コマ枠をコマ間隔付きで分割しました',
+ 'Cut line must cross completely through a frame border': '分割線はコマ枠を端から端まで横切るように引いてください',
+ 'Create Frame Folder': 'コマ枠フォルダーを作成',
+ 'Created Frame Border Folder (child layers auto-clip)':
+ 'コマ枠フォルダーを作成しました(子レイヤーは自動で枠内にクリッピングされます)',
+ 'Select an unlocked, visible Raster or Vector layer to commit Bézier path':
+ 'ベジェパスを確定するには表示中・ロック解除済みのラスターまたはベクターレイヤーを選択してください',
+ 'Enable Stroke or Fill (closed path) before committing':
+ '確定する前に「線」または「塗り」(閉じパス)を有効にしてください',
+ 'Edit Bézier Path': 'ベジェパスを編集',
+ 'Bézier Pen Path': 'ベジェ曲線パス',
+ 'Select an unlocked, visible Raster or Vector layer to use the Pen Tool':
+ 'ペンツールを使うには表示中・ロック解除済みのラスターまたはベクターレイヤーを選択してください',
+ 'Loaded vector path for Bézier editing': 'ベクターパスをベジェ編集用に読み込みました',
+ 'Click a vector path to edit, or switch to Draw mode to plot a new Bézier path':
+ '編集するベクターパスをクリックするか、描画モードに切り替えて新規パスを作成してください',
+ 'Select an unlocked, visible raster layer to apply gradients':
+ 'グラデーションを適用するには表示中・ロック解除済みのラスターレイヤーを選択してください',
+ 'Mesh Gradient': 'メッシュグラデーション',
+ 'Radial Gradient': '円形グラデーション',
+ 'Linear Gradient': '線形グラデーション',
+ 'Smudge': '指先',
+ 'Dodge': '覆い焼き',
+ 'Burn': '焼き込み',
+ 'Clone Stamp': 'コピースタンプ',
+ 'Clone source set ({x}, {y})': 'コピー元を設定しました ({x}, {y})',
+ 'Select an unlocked, visible raster layer to use Retouch tools':
+ 'レタッチツールを使うには表示中・ロック解除済みのラスターレイヤーを選択してください',
+ 'Alt+Click on canvas (or click Pick Source) to set Clone Stamp origin':
+ 'キャンバスを Alt+クリック(またはコピー元指定をクリック)してスタンプの基準点を設定してください',
+ 'Vector Eraser': 'ベクター消しゴム',
+ 'Vector Pencil': 'ベクター鉛筆',
+ 'Vector Pen': 'ベクターペン',
+ 'Select a Vector Layer to use Correct Line tools':
+ '線修正ツールを使うにはベクターレイヤーを選択してください',
+ 'Correct Line ({mode})': '線修正({mode})',
+
+ // History & Layer CRUD / Clipboard / Masks / Special Layers
+ 'New Document': '新規ドキュメント',
+ 'Layer is locked by its owner': 'このレイヤーはオーナーによってロックされています',
+ 'Clear Layer': 'レイヤーを消去',
+ 'Add Folder': 'フォルダーを追加',
+ 'Add Vector Layer': 'ベクターレイヤーを追加',
+ 'Add Frame Folder': 'コマ枠フォルダーを追加',
+ 'Add Layer': 'レイヤーを追加',
+ '{name} Copy': '{name} のコピー',
+ 'Duplicate Layer': 'レイヤーを複製',
+ 'Delete {count} Layers': '{count}枚のレイヤーを削除',
+ 'Group Layers': 'フォルダーにまとめる',
+ 'Rename Layer': 'レイヤー名を変更',
+ 'Reorder Layer': 'レイヤー順を変更',
+ 'Move Layer to Folder': 'レイヤーをフォルダーへ移動',
+ 'Reorder Layers': 'レイヤー順を変更',
+ 'Move Layers': 'レイヤーを移動',
+ 'Pasted Layer': '貼り付けレイヤー',
+ 'Paste Layer ({name})': 'レイヤーを貼り付け({name})',
+ 'Screen Tone': 'トーン',
+ 'Screen Tone {n}': 'トーン {n}',
+ '{name} (Selection)': '{name}(選択範囲)',
+ 'Pasted Image': '貼り付け画像',
+ 'Failed to decode image "{name}".': '画像「{name}」のデコードに失敗しました。',
+ 'Failed to read file "{name}".': 'ファイル「{name}」の読み込みに失敗しました。',
+ 'Image "{name}" has invalid dimensions.': '画像「{name}」のサイズが無効です。',
+ 'Import Image ({name})': '画像を読み込み({name})',
+ 'Toggle Visibility': '表示/非表示を切り替え',
+ 'Blend Mode ({mode})': '合成モード({mode})',
+ 'Toggle Layer Lock': 'レイヤーロックを切り替え',
+ 'Toggle Clipping Mask': '下のレイヤーでクリッピングを切替',
+ 'Toggle Alpha Lock': '透明ピクセルロックを切り替え',
+ 'Apply Layer Mask': 'レイヤーマスクを適用',
+ 'Delete Layer Mask': 'レイヤーマスクを削除',
+ 'Toggle Mask Link': 'マスクのリンクを切り替え',
+ 'Curves {n}': 'トーンカーブ {n}',
+ 'Gradient Map {n}': 'グラデーションマップ {n}',
+ 'Levels {n}': 'レベル補正 {n}',
+ 'Color Balance {n}': 'カラーバランス {n}',
+ 'Vector {n}': 'ベクター {n}',
+ 'Text {n}': 'テキスト {n}',
+ 'Balloon {n}': 'フキダシ {n}',
+ 'Adjustment {n}': '色調補正 {n}',
+ 'Add {name}': '{name}を追加',
+ 'Update Adjustment': '色調補正を更新',
+ 'Layer Styles': 'レイヤースタイル',
+ 'Edit Text Layer': 'テキストレイヤーを編集',
+ 'Add Text Layer': 'テキストレイヤーを追加',
+ 'Balloon: {text}': 'フキダシ: {text}',
+ 'Edit Speech Balloon': 'フキダシを編集',
+ 'Add Speech Balloon': 'フキダシを追加',
+ 'Frame {n}': 'コマ枠 {n}',
+ 'Panel Layer': 'コマ内レイヤー',
+ '{name} B': '{name} B',
+
+ // Contextual homonym disambiguations
+ 'expressionColor::Mono': 'モノクロ',
+ 'transformMode::Free': '自由変形',
+ 'transformMode::Perspective': 'パース変形',
+};
diff --git a/src/i18n/ja/mangaAnd3d.ts b/src/i18n/ja/mangaAnd3d.ts
new file mode 100644
index 0000000..2526992
--- /dev/null
+++ b/src/i18n/ja/mangaAnd3d.ts
@@ -0,0 +1,637 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_MANGA_AND_3D: TranslationDictionary = {
+ // =========================================================================
+ // Text Tool & Typography (TextEditorOverlay & textSettings.ts)
+ // =========================================================================
+ 'Type text...': 'テキストを入力...',
+ 'Canvas text input': 'キャンバステキスト入力',
+ 'Vertical text input': '縦書きテキスト入力',
+ 'Type vertical text (Enter starts next column)...': '縦書きテキストを入力(Enterで改行・次の列へ)...',
+ 'Drag to reposition vertical text': 'ドラッグして縦書きテキストの位置を移動',
+ 'Drag to move text': 'ドラッグしてテキストを移動',
+ 'Drag to move text (or Alt+Drag / Alt+Arrow keys)': 'ドラッグしてテキストを移動(Alt+ドラッグ / Alt+矢印キー)',
+ 'Wrap width: {width}px (drag to resize, double-click for auto width)': '折り返し幅: {width}px(ドラッグで変更、ダブルクリックで自動幅)',
+ 'Drag to set word-wrap box width': 'ドラッグして折り返し幅を設定',
+ 'Drag diagonally to scale font size': '斜めにドラッグしてフォントサイズを変更',
+ 'Font Family': 'フォント',
+ 'Font Size': 'フォントサイズ',
+ 'Decrease font size (Ctrl+[)': 'フォントサイズを縮小 (Ctrl+[)',
+ 'Increase font size (Ctrl+])': 'フォントサイズを拡大 (Ctrl+])',
+ 'Text Color': '文字色',
+ 'Text Color ({color})': '文字色 ({color})',
+ 'Use current brush color ({color})': '現在の描画色を使用 ({color})',
+ 'Bold (Ctrl+B)': '太字 (Ctrl+B)',
+ 'Italic (Ctrl+I)': '斜体 (Ctrl+I)',
+ 'Underline (Ctrl+U)': '下線 (Ctrl+U)',
+ 'Align Left (Ctrl+Shift+L)': '左揃え (Ctrl+Shift+L)',
+ 'Align Center (Ctrl+Shift+E)': '中央揃え (Ctrl+Shift+E)',
+ 'Align Right (Ctrl+Shift+R)': '右揃え (Ctrl+Shift+R)',
+ 'Horizontal Text': '横書き',
+ 'Vertical Text (Tate-gaki)': '縦書き',
+ 'writingMode::H': '横',
+ 'writingMode::V': '縦',
+ 'writingMode::Horizontal': '横書き',
+ 'writingMode::Vertical': '縦書き',
+ 'textDirection::Direction': '文字の向き',
+ 'Spacing, opacity, and outline options': '行間・字間・不透明度・フチ取りの設定',
+ 'Delete text layer': 'テキストレイヤーを削除',
+ 'Cancel (Esc)': 'キャンセル (Esc)',
+ 'Apply text (Ctrl+Enter or click outside)': 'テキストを確定(Ctrl+Enter または枠外をクリック)',
+ 'Line {value}': '行間 {value}',
+ 'Track {value}px': '字間 {value}px',
+ 'Opacity {value}%': '不透明度 {value}%',
+ 'Outline': 'フチ取り',
+ 'Reset to plain white text without outline': 'フチなしの白テキストにリセット',
+ 'Plain White': '標準の白',
+ 'outline::Width {value}px': 'フチ幅 {value}px',
+ 'Color:': '色:',
+ 'Black outline': '黒のフチ取り',
+ 'White outline': '白のフチ取り',
+ 'Outline Color': 'フチの色',
+ 'Click outside or Ctrl+Enter to apply': '枠外をクリック、または Ctrl+Enter で確定',
+ 'Alt+Arrows to nudge • Drag edge to wrap': 'Alt+矢印で微調整・右端ドラッグで折り返し',
+
+ // Built-in Font Presets, Categories & Quick Colors (textSettings.ts)
+ 'Sans Clean': 'サンセリフ(標準)',
+ 'Segoe UI / System': 'Segoe UI / システム',
+ 'Arial / Helvetica': 'Arial / Helvetica',
+ 'Verdana': 'Verdana',
+ 'Trebuchet MS': 'Trebuchet MS',
+ 'Georgia Serif': 'Georgia セリフ',
+ 'Times New Roman': 'Times New Roman',
+ 'Palatino': 'Palatino',
+ 'Manga / Comic': '漫画・コミック',
+ 'Anime Ace': 'Anime Ace',
+ 'Impact (SFX)': 'Impact(擬音・見出し)',
+ 'Monospace': '等幅フォント',
+ 'Japanese Gothic (游ゴシック)': '日本語ゴシック(游ゴシック)',
+ 'Japanese Mincho (游明朝)': '日本語明朝(游明朝)',
+ 'Japanese UI Sans (BIZ UDゴシック)': '日本語UIゴシック(BIZ UD)',
+ 'Japanese Manga (明朝・縦書き)': '日本語漫画(明朝・縦書き)',
+ 'Sans': 'ゴシック',
+ 'Serif': '明朝',
+ 'Manga': '漫画',
+ 'Display': '見出し',
+ 'Mono': '等幅',
+ 'System': 'システム',
+ 'White': '白',
+ 'Black': '黒',
+ 'Soft White': 'オフホワイト',
+ 'Red': '赤',
+ 'Amber': 'アンバー',
+ 'Sky': 'スカイブルー',
+
+ // =========================================================================
+ // Speech Balloon (SpeechBalloonOverlay)
+ // =========================================================================
+ 'Speech Balloon': 'フキダシ',
+ 'Drag Tail Tip': 'しっぽの先端をドラッグ',
+ 'Handle: {id}': 'ハンドル: {id}',
+ 'balloon::Shape': '形状',
+ 'Shape Preset': 'フキダシ形状',
+ 'balloon::Ellipse': '楕円',
+ 'balloon::Box': '四角',
+ 'balloon::Flash': 'フラッシュ',
+ 'balloon::Thought': '心の声',
+ 'Border Width': '枠線の幅',
+ 'Balloon dialogue text...': 'セリフを入力...',
+ 'Delete Balloon': 'フキダシを削除',
+ 'Apply Balloon': 'フキダシを確定',
+
+ // =========================================================================
+ // Screentone (SimpleToneModal)
+ // =========================================================================
+ 'Simple Tone Settings': '簡易トーン設定',
+ 'Dot Shape': '網点の種類',
+ 'Circle (Standard)': '円(標準)',
+ 'Euclidean (Halftone)': '網点(ユークリッド)',
+ 'Line (Hatching)': '線(平行線)',
+ 'Diamond': 'ひし形',
+ 'Screen Frequency (LPI)': 'トーン線数 (LPI)',
+
+ // =========================================================================
+ // Manga Effect Lines (MangaEffectsModal)
+ // =========================================================================
+ 'Manga Effect Lines': '効果線',
+ 'Saturated Lines (Focus / Burst)': '集中線',
+ 'Stream Lines (Parallel Speed)': '流線(スピード線)',
+ 'Click on preview to move focus center': 'プレビューをクリックして中心位置を変更',
+ 'Click preview to reposition focus point': 'プレビューをクリックして集中線の中心を移動',
+ 'Center Cutout Radius': '中心の空白半径',
+ 'Line Density': '線の密度',
+ '{count} lines': '{count}本',
+ 'Stroke Width': '線幅',
+ 'Spacing & Depth Jitter': '間隔・長さのばらつき',
+ 'Taper Direction': '入り抜き',
+ 'Point to Center': '中心に向かって細く',
+ 'Uniform': '均一',
+ 'Streak Length': '線の長さ',
+ 'Thickness & Length Noise': '太さ・長さのばらつき',
+ 'Reset Defaults': '初期設定に戻す',
+ 'Apply Effect': '効果線を適用',
+
+ // =========================================================================
+ // LT Extraction (LTExtractionModal & bake3DService)
+ // =========================================================================
+ 'Line & Tone Extraction (LT Conversion)': 'レイヤーのLT変換(線画・トーン抽出)',
+ '3D Extraction [{name}]': 'LT変換 [{name}]',
+ 'lt::Line + Tone': '線画+トーン',
+ 'lt::Outline': '輪郭線',
+ 'lt::Tones': 'トーン',
+ 'Toggle Paper / Transparent Preview Background': '用紙 / 透明背景プレビューを切り替え',
+ 'Alpha': '透明',
+ 'Updating preview...': 'プレビューを更新中...',
+ 'Line Extraction': '輪郭線抽出',
+ 'Line Width': '線の太さ',
+ 'Edge Sensitivity': 'エッジ検出感度',
+ 'Anti-Aliasing': 'アンチエイリアス',
+ 'Screentones': 'トーン化',
+ 'Shadow Bands': '階調数',
+ 'Deep Shadow (45%)': '濃い影(45%)',
+ 'Light (20%) + Deep (45%)': '薄(20%)+濃(45%)',
+ 'Light (15%) + Mid (30%) + Deep (50%)': '薄(15%)+中(30%)+濃(50%)',
+ '4-step gradation (10% - 55%)': '4階調グラデーション(10%〜55%)',
+ 'Frequency': '線数',
+ 'Output Folder': '出力フォルダー名',
+ 'Extract': 'LT変換を実行',
+ 'Extracting...': '抽出中...',
+ '3D Layer': '3Dレイヤー',
+ '3D Model': '3Dモデル',
+ '3D ({name})': '3D ({name})',
+ '3D Outline': '3D輪郭線',
+ '3D Tone (Deep)': '3Dトーン(濃)',
+ '3D Tone 1 (Light)': '3Dトーン 1(薄)',
+ '3D Tone 2 (Deep)': '3Dトーン 2(濃)',
+ '3D Tone 2 (Mid)': '3Dトーン 2(中)',
+ '3D Tone 3 (Deep)': '3Dトーン 3(濃)',
+ '3D Tone 2 (Mid-Light)': '3Dトーン 2(やや薄)',
+ '3D Tone 3 (Mid-Deep)': '3Dトーン 3(やや濃)',
+ '3D Tone 4 (Deep)': '3Dトーン 4(濃)',
+ 'WebGL initialization failed: {message}': 'WebGLの初期化に失敗しました: {message}',
+ 'Unable to initialize a valid WebGL context for 3D rendering.': '3Dレンダリング用の有効なWebGLコンテキストを初期化できませんでした。',
+ 'Unable to create 2D canvas context for 3D rasterization': '3Dラスタライズ用の2Dキャンバスコンテキストを作成できませんでした',
+
+ // =========================================================================
+ // Webtoon Export & Smartphone Simulator
+ // =========================================================================
+ 'Webtoon Chapter Slicer': 'Webtoon分割書き出し',
+ 'Webtoon Export Failed': 'Webtoon書き出しに失敗',
+ 'Failed to export webtoon slices.': 'Webtoonの分割書き出しに失敗しました。',
+ 'Failed to create slice blob': '分割画像データの作成に失敗しました',
+ 'Webtoon Slices Archive': 'Webtoon分割画像アーカイブ',
+ 'Save Webtoon Slices As': 'Webtoon分割画像を別名で保存',
+ 'Canvas Dimensions': 'キャンバスサイズ',
+ 'Total Slices': '分割枚数',
+ '{count} tiles': '{count}枚',
+ 'Tile Dimensions': '分割サイズ',
+ 'Slice Tile Height': '分割する高さ',
+ 'Output Format': '書き出し形式',
+ 'JPEG (Standard)': 'JPEG(標準)',
+ 'PNG (Lossless)': 'PNG(可逆圧縮)',
+ 'JPEG Quality': 'JPEG品質',
+ 'Slicing tile {current} of {total}...': '{total}枚中 {current}枚目を分割中...',
+ 'Packaging ZIP...': 'ZIPを作成中...',
+ 'Export {count} Tiles (.ZIP)': '{count}枚をZIPで書き出し',
+ 'Drag to reposition smartphone preview frame': 'ドラッグしてスマホ表示枠を移動',
+ 'Hide Viewport Simulator': '表示枠を非表示',
+ '9:16 Webtoon Simulator': '9:16 Webtoon表示プレビュー',
+
+ // =========================================================================
+ // Perspective & Straight Rulers (PerspectiveRulerOverlay, StraightRulerOverlay, perspectiveMath)
+ // =========================================================================
+ 'Drag vertically to adjust Eye Level height': '上下にドラッグしてアイレベルの高さを調整',
+ 'Eye Level {angle}°': 'アイレベル {angle}°',
+ 'Drag {label} Vanishing Point': '{label} 消失点をドラッグ',
+ 'Drag to reposition {label} ({dist}px off-screen)': 'ドラッグして {label} を移動(画面外 {dist}px)',
+ 'Hide Perspective Ruler': 'パース定規を非表示',
+ 'Show Perspective Ruler': 'パース定規を表示',
+ 'Perspective Snapping: ENABLED (Hold Alt to freehand)': 'パーススナップ: 有効(Altを押しながらフリーハンド)',
+ 'Perspective Snapping: DISABLED (Hold Alt to freehand)': 'パーススナップ: 無効(Altを押しながらフリーハンド)',
+ 'Snap ON': 'スナップ ON',
+ 'Snap OFF': 'スナップ OFF',
+ '1P Perspective': '1点透視',
+ '2P Perspective': '2点透視',
+ '3P Perspective': '3点透視',
+ 'perspective::1P': '1点',
+ 'perspective::2P': '2点',
+ 'perspective::3P': '3点',
+ 'perspective::Lines': 'ガイド線',
+ 'Number of Guide Rays per Vanishing Point': '消失点ごとのガイドライン数',
+ 'Decrease Guide Rays': 'ガイド線を減らす',
+ 'Increase Guide Rays': 'ガイド線を増やす',
+ 'Ruler Locked (Handles frozen to prevent misclicks while inking)': '定規をロック中(ペン入れ時の誤操作を防止)',
+ 'Ruler Unlocked (Drag handles or eye level to adjust perspective)': '定規のロック解除中(ハンドルやアイレベルをドラッグして調整)',
+ 'Preset Perspective Angles': 'パース定規のプリセット',
+ '1-Point Center': '1点透視(中央)',
+ '1 VP': '消失点 1',
+ '2-Point Street (Wide)': '2点透視(広角・街並み)',
+ '2 VPs': '消失点 2',
+ "3-Point Bird's-Eye": '3点透視(俯瞰)',
+ 'High Angle': 'ハイアングル',
+ "3-Point Worm's-Eye": '3点透視(アオリ)',
+ 'Low Angle': 'ローアングル',
+ 'Remove Perspective Ruler from Canvas': 'パース定規をキャンバスから削除',
+
+ // Vanishing Point & Constraint Axis Labels (perspectiveMath.ts)
+ 'VP1': '消失点 1',
+ 'VP1 (Left)': '消失点 1(左)',
+ 'VP2 (Right)': '消失点 2(右)',
+ 'VP3 (Vertical)': '消失点 3(垂直)',
+ 'VP1 (X-Axis)': '消失点 1(X軸)',
+ 'VP2 (Z-Axis)': '消失点 2(Z軸)',
+ 'VP3 (Y-Axis)': '消失点 3(Y軸)',
+ 'VP1 Convergence Ray': '消失点1 収束線',
+ 'VP2 Convergence Ray': '消失点2 収束線',
+ 'VP3 Convergence Ray': '消失点3 収束線',
+ 'Horizontal Axis': '水平軸',
+ 'Vertical Axis': '垂直軸',
+
+ // Straight Ruler
+ 'Drag to move ruler': 'ドラッグして定規を移動',
+ 'Drag to rotate ruler (hold Shift for 15° snap)': 'ドラッグして定規を回転(Shiftで15°スナップ)',
+ 'Scroll to adjust angle (Shift+Scroll for 15°)': 'スクロールで角度を調整(Shift+スクロールで15°刻み)',
+ 'Set ruler angle to {deg}°': '定規の角度を {deg}° に設定',
+ 'Unlock Ruler Position & Angle': '定規の位置と角度のロックを解除',
+ 'Lock Ruler in Place': '定規の位置と角度をロック',
+ 'Disable Snapping (or hold Alt while drawing)': 'スナップを無効化(描画中にAltキーでも解除)',
+ 'Enable Snapping': 'スナップを有効',
+ 'Center Ruler in Viewport': '定規を画面中央に配置',
+ 'Hide Ruler (R)': '定規を非表示 (R)',
+
+ // =========================================================================
+ // 3D Stage, Toolbar, Property Inspector, Primitives & Lighting
+ // =========================================================================
+ 'Unable to initialize 3D WebGL context.': '3D用のWebGLコンテキストを初期化できませんでした。',
+ 'Failed to load 3D model "{name}".': '3Dモデル「{name}」の読み込みに失敗しました。',
+ '3D Viewport Unavailable': '3Dビューポートを利用できません',
+ '3D Reference Stage': '3Dリファレンスステージ',
+ '3D Reference': '3Dリファレンス',
+ '3D Studio': '3Dスタジオ',
+ '3D Studio Tool': '3Dスタジオツール',
+ 'Open or create a canvas document to use the 3D reference stage.': '3Dリファレンスステージを使用するには、キャンバスを開くか新規作成してください。',
+ 'Open the 3D reference stage to create primitives or drop .glb / .gltf / .obj models directly onto the canvas.': '3Dリファレンスステージを開くと、プリミティブの作成や .glb / .gltf / .obj モデルの読み込みが行えます。',
+ 'Open 3D Stage': '3Dステージを開く',
+ 'Drag & drop a .glb, .gltf, or .obj model onto the canvas, or create a primitive.': '.glb / .gltf / .obj モデルをキャンバスにドラッグ&ドロップするか、プリミティブを作成してください。',
+ 'Import 3D': '3D読み込み',
+ 'Import 3D Model': '3Dモデルを読み込む',
+ 'Import 3D Model (.glb / .obj)': '3Dモデル読み込み (.glb / .obj)',
+ 'Import 3D Model (.glb, .gltf, .obj) — or drag & drop onto canvas': '3Dモデル (.glb, .gltf, .obj) を読み込み(キャンバスへドラッグ&ドロップ可)',
+ 'Click to browse or drag & drop .glb, .gltf, or .obj onto canvas': 'クリックして選択、または .glb / .gltf / .obj をキャンバスにドロップ',
+ 'Switch to 3D Tool (K) to rotate, move, scale, or adjust lighting': '3Dツール (K) に切り替えて回転・移動・拡大縮小や光源を調整',
+ 'Edit 3D (K)': '3D編集 (K)',
+ 'Hide 3D Reference': '3Dリファレンスを非表示',
+ 'Show 3D Reference': '3Dリファレンスを表示',
+ 'Close 3D Stage': '3Dステージを閉じる',
+
+ // 3D Primitives (primitives3D.ts)
+ 'Primitives': 'プリミティブ',
+ 'Create Primitive': 'プリミティブを作成',
+ 'Create 3D Primitive (Cube, Sphere, Capsule, Cylinder, Pyramid)': '3Dプリミティブを作成(立方体・球・カプセル・円柱・角錐)',
+ 'Cube': '立方体',
+ 'Sphere': '球',
+ 'Capsule': 'カプセル',
+ 'Cylinder': '円柱',
+ 'Pyramid': '角錐',
+ 'Create a 3D cube primitive': '3D立方体プリミティブを作成',
+ 'Create a 3D sphere primitive': '3D球体プリミティブを作成',
+ 'Create a 3D capsule primitive': '3Dカプセルプリミティブを作成',
+ 'Create a 3D cylinder primitive': '3D円柱プリミティブを作成',
+ 'Create a 3D four-sided pyramid primitive': '3D四角錐プリミティブを作成',
+
+ // 3D Toolbar & Modes (Csp3DToolbar, Tool3DPropertyInspector, tool3DRules)
+ '3dToolbar::Smart': 'スマート',
+ '3dToolbar::Rotate': '回転',
+ '3dToolbar::Move': '移動',
+ '3dToolbar::Scale': '拡縮',
+ '3dToolbar::Floor': '床移動',
+ 'Smart CSP mode: drag model to transform, drag background to orbit': 'スマートモード:モデルをドラッグで変形、背景をドラッグでカメラ旋回',
+ 'Rotate model freely (click to select or drag button directly)': 'モデルを自由回転(クリックで選択、ボタンをドラッグで直接操作)',
+ 'Move model in view plane (click to select or drag button directly)': '画面に沿ってモデルを移動(クリックで選択、ボタンをドラッグで直接操作)',
+ 'Scale model uniformly (click to select or drag button directly)': 'モデルを均等に拡大・縮小(クリックで選択、ボタンをドラッグで直接操作)',
+ 'Slide model along ground floor plane (click or drag)': '床面に沿ってモデルを平行移動(クリックまたはドラッグ)',
+ 'Cam': 'カメラ',
+ '3dCam::Orbit': '旋回',
+ '3dCam::Pan': '平行',
+ '3dCam::Zoom': 'ズーム',
+ 'Orbit camera around model (click or drag)': 'モデルの周囲をカメラ旋回(クリックまたはドラッグ)',
+ 'Pan camera in screen plane (click or drag)': 'カメラを平行移動(クリックまたはドラッグ)',
+ 'Zoom camera distance (click or drag)': 'カメラの距離をズーム(クリックまたはドラッグ)',
+ 'Rotate Gizmo': '回転ギズモ',
+ 'Move Gizmo': '移動ギズモ',
+ 'Scale Gizmo': '拡縮ギズモ',
+ 'Hide Gizmo': 'ギズモを非表示',
+ 'Snap Model to Ground Floor (Y = 0)': 'モデルを床面 (Y = 0) に接地',
+ 'Undo 3D Action (Ctrl+Z)': '3D操作を元に戻す (Ctrl+Z)',
+ 'Redo 3D Action (Ctrl+Y)': '3D操作をやり直す (Ctrl+Y)',
+ 'Quick Lighting & 3D Light Sphere': 'クイック光源・3Dライトスフィア',
+ '3D Tool Controls & Behavior Rules': '3Dツールの操作ガイド',
+ '3D Tool Behavior Rules': '3Dツール操作ガイド',
+ 'Open Line & Tone Extraction Preview Dialog': 'LT変換(線画・トーン抽出)プレビューを開く',
+ 'LT': 'LT',
+ 'Load a 3D model first': '先に3Dモデルを読み込んでください',
+ 'Rasterize 3D view into a 2D Layer (Shift+Click to keep 3D stage open)': '3D表示を2Dレイヤーにラスタライズ(Shift+クリックで3Dステージを維持)',
+ 'Bake': '確定',
+ 'Baking...': '確定中...',
+ 'Bake Layer': 'レイヤーに確定',
+ 'Stamp': 'スタンプ',
+ 'Bake a 2D raster copy while keeping the 3D stage open': '3Dステージを開いたまま2Dレイヤーに複製',
+ 'Rasterize 3D model into a 2D Layer and close stage': '3Dモデルを2Dレイヤーに確定してステージを閉じる',
+
+ // Tool3DPropertyInspector
+ 'Canvas Tool Mode': '操作モード',
+ 'Smart (Auto)': 'スマート(自動)',
+ 'Free Rotate': '自由回転',
+ 'Turn Y-Axis': 'Y軸回転',
+ 'Screen Roll': '画面回転',
+ 'Move Plane': '画面移動',
+ 'Slide Floor': '床面移動',
+ 'Scale Drag': '拡大・縮小',
+ 'Cam Orbit': 'カメラ旋回',
+ 'On-Canvas Gizmo': 'マニピュレーター',
+ 'Toggle Local vs World Gizmo Axes': 'ローカル座標 / ワールド座標を切り替え',
+ 'Local': 'ローカル',
+ 'World': 'ワールド',
+ '3dGizmo::Rot': '回転',
+ '3dGizmo::Pos': '移動',
+ '3dGizmo::Scl': '拡縮',
+ '3dGizmo::Off': 'オフ',
+ 'Snap (15° / 10% · Shift)': 'スナップ (15° / 10%・Shift)',
+ 'units': '単位',
+ 'deg': '度',
+ 'Uniform scale locked (click to unlock X/Y/Z)': '縦横比を固定中(クリックでX/Y/Z個別変更)',
+ 'Non-uniform X/Y/Z scale (click to lock)': 'X/Y/Z個別スケール(クリックで縦横比固定)',
+ 'Snap Floor': '床に接地',
+ 'Key Light': 'メイン光源',
+ 'Key Light Enabled': '平行光を有効にする',
+ 'Light 2 (Rim / Fill)': '平行光 2(リム・補助光)',
+ 'Rim Light Color': '平行光 2 の色',
+ 'Ambient Color': '環境光カラー',
+ 'Cast Ground Shadow': '床に影を落とす',
+ 'Shadow Strength': '影の濃さ',
+ 'Sliders': 'スライダー',
+ 'Reset Lighting to Studio Default': '光源を初期設定に戻す',
+ 'Drag light angle': 'ドラッグで光源角度を調整',
+ 'Backlight': '逆光',
+ 'Front Light': '順光',
+ 'Azimuth': '方位角',
+ 'Elevation': '仰角',
+ 'Power': '強さ',
+ 'Ambient': '環境光',
+ 'Warm Sun': '暖色(太陽光)',
+ 'Golden Hour': '夕焼け',
+ 'Cool Sky': '寒色(青空)',
+ 'Cyber Cyan': 'シアン',
+ 'Custom Light Color': '光源カラーをカスタム選択',
+ 'Camera Angle': 'カメラアングル',
+ '3dCam::Front': '正面',
+ '3dCam::3/4': '斜め',
+ '3dCam::Side': '横',
+ '3dCam::Back': '背面',
+ '3dCam::Top': '真上',
+ '3dCam::Low': 'アオリ',
+ 'Shading': 'シェーディング',
+ '3dShading::Shaded': '標準',
+ '3dShading::Smooth': 'スムーズ',
+ '3dShading::Cel / Toon': 'トゥーン',
+ '3dShading::Wire': 'ワイヤー',
+ '3dShading::Silh': 'シルエット',
+ 'Roughness': '粗さ',
+ 'Manga Outline Preview': '輪郭線プレビュー',
+ 'Perspective (FOV)': 'パース (視野角)',
+ 'Stage Opacity': 'ステージ不透明度',
+ 'Floor Grid': '床グリッド',
+ 'Live Sync Perspective Ruler': 'パース定規をリアルタイム同期',
+ 'Sync Ruler to Camera Now': '現在のカメラでパース定規を作成',
+ 'Pose': 'ポーズ',
+ 'Pose Presets': 'ポーズプリセット',
+ 'Standing': '立ちポーズ',
+ 'Action': 'アクション',
+ 'Seated': '座りポーズ',
+ 'Fists': '握りこぶし',
+ 'Relaxed': 'リラックス',
+ 'IK Limb Handles': 'IKパーツ操作',
+ 'Click any colored joint sphere on the canvas or pick a limb below to drag it.': 'キャンバス上の関節球をクリックするか、下のパーツを選んでドラッグします。',
+ 'Head': '頭部',
+ 'L-Hand': '左手',
+ 'R-Hand': '右手',
+ 'L-Foot': '左足',
+ 'R-Foot': '右足',
+ 'Show Joint Spheres': '関節ハンドルを表示',
+ 'Controls & Rules': '操作ガイド',
+
+ // 3D Behavior Rules (tool3DRules.ts)
+ 'Left-Drag Model / Gizmo': 'モデル / ギズモを左ドラッグ',
+ 'Rotate, Move, or Scale object': 'オブジェクトを回転・移動・拡大縮小',
+ 'Left-Drag Background': '背景を左ドラッグ',
+ 'Orbit 3D camera (Smart mode)': '3Dカメラを旋回(スマートモード)',
+ 'Right-Drag or Wheel': '右ドラッグ / ホイール',
+ 'Zoom 3D camera in / out': '3Dカメラのズームイン・アウト',
+ 'Middle-Drag': '中ボタンドラッグ',
+ 'Pan 3D camera': '3Dカメラを平行移動',
+ 'Alt + Left-Drag': 'Alt + 左ドラッグ',
+ 'Orbit camera from any mode': 'どのモードからでもカメラ旋回',
+ 'Hold Shift': 'Shiftを押しながら',
+ 'Snap rotation (15°), scale (10%), or move': '回転 (15°)・拡大率 (10%)・移動をスナップ',
+ 'Ctrl+Z / Ctrl+Y': 'Ctrl+Z / Ctrl+Y',
+ 'Undo / Redo any 3D manipulation': '3D操作の取り消し / やり直し',
+ 'Click Joint Sphere': '関節球をクリック',
+ 'Select & pose IK limb directly': 'IKパーツを直接選択してポーズ調整',
+ 'Space + Drag / Ctrl+Wheel': 'Space+ドラッグ / Ctrl+ホイール',
+ 'Pan / zoom the 2D canvas': '2Dキャンバスの移動・ズーム',
+ 'Switch to Brush (B)': 'ブラシに切り替え (B)',
+ 'Draw directly over live 3D reference': '3Dリファレンスの上に直接描画',
+
+ // =========================================================================
+ // Animation Timeline (AnimationTimeline & animationEngine.ts)
+ // =========================================================================
+ 'Encoding frames...': 'フレームをエンコード中...',
+ 'Rendering {current}/{total}...': 'レンダリング中 {current}/{total}...',
+ 'First Frame (Home)': '最初のフレーム (Home)',
+ 'Previous Frame (Left Arrow)': '前のフレーム (←)',
+ 'Play / Pause (Alt+Space)': '再生 / 一時停止 (Alt+Space)',
+ 'Play': '再生',
+ 'Pause': '一時停止',
+ 'Next Frame (Right Arrow)': '次のフレーム (→)',
+ 'Loop Playback': 'ループ再生',
+ 'Loop': 'ループ',
+ 'Add Cel for Current Frame': '現在のフレームにセルを追加',
+ '+ Add Cel': '+ セルを追加',
+ 'Delete Cel from Current Frame': '現在のフレームのセルを削除',
+ 'Configure Colored Onion Skinning': 'オニオンスキン設定',
+ 'Onion Skin': 'オニオンスキン',
+ 'Prior Frames ({count})': '前のフレーム ({count})',
+ 'Next Frames ({count})': '次のフレーム ({count})',
+ 'Total': '合計',
+ 'Export Animation': 'アニメーション書き出し',
+ 'Close Timeline Dock': 'タイムラインを閉じる',
+ 'Frame {frame}: Cel Assigned': 'フレーム {frame}: セル割り当て済み',
+ 'Active Cel:': '選択中のセル:',
+ 'None (Drawing creates new frame cel)': 'なし(描画すると新規セルを作成)',
+ 'Drag scrubber to navigate': 'ドラッグでフレーム移動',
+ 'Alt+Space: Play/Pause': 'Alt+Space: 再生/停止',
+ '← / →: Step frame': '← / →: コマ送り',
+ 'Format': '書き出し形式',
+ 'Animated GIF': 'アニメーションGIF',
+ 'Animated PNG': 'アニメーションPNG (APNG)',
+ 'WebM Video': 'WebM 動画',
+ 'MP4 Video': 'MP4 動画',
+ 'PNG Sequence (.zip)': '連番PNG (.zip)',
+ 'GIF Animation': 'GIFアニメーション',
+ 'Animated PNG (APNG)': 'アニメーションPNG (APNG)',
+ 'PNG Sequence Archive': '連番PNGアーカイブ',
+ 'Animation File': 'アニメーションファイル',
+ 'Save Animation As': 'アニメーションを別名で保存',
+ 'Resolution: {width} × {height} px': '解像度: {width} × {height} px',
+ 'Frame Rate: {fps} FPS': 'フレームレート: {fps} FPS',
+ 'Total Frames: {count}': '総フレーム数: {count}',
+ 'Start Export': '書き出し開始',
+
+ // =========================================================================
+ // Timelapse Studio, Watermark & Fullscreen Viewer
+ // =========================================================================
+ 'Time-lapse Studio': 'タイムラプススタジオ',
+ 'Close (Esc)': '閉じる (Esc)',
+ 'Unknown date': '日時不明',
+ 'Saved locally': 'ローカル保存済み',
+ 'Time-lapse recording enabled (saved locally)': 'タイムラプス記録を開始しました(ローカルに保存)',
+ 'Time-lapse recording paused': 'タイムラプス記録を一時停止しました',
+ 'Capture area set to {label}': '記録対象を「{label}」に設定しました',
+ 'Time-lapse recording cleared': 'タイムラプス記録を消去しました',
+ 'Attached "{name}" ({count} frames)': '「{name}」({count}フレーム)を読み込みました',
+ 'Deleted local recording "{name}"': 'ローカル録画「{name}」を削除しました',
+ 'Save Time-lapse Video As': 'タイムラプス動画を別名で保存',
+ 'Exported {duration}s time-lapse ({fps} FPS, {ext})': '{duration}秒のタイムラプスを書き出しました({fps} FPS・{ext})',
+ 'Time-lapse export failed': 'タイムラプスの書き出しに失敗しました',
+ 'Local app storage': 'ローカルアプリ保存領域',
+ 'Browser storage': 'ブラウザ保存領域',
+ 'Session RAM': 'セッションメモリ',
+ 'Capture': '記録対象',
+ 'Capture area': '記録対象',
+ 'Artwork only': '作品のみ',
+ 'Clean upright canvas without UI or zoom wobble': 'UIやズーム操作を除いたキャンバス全体',
+ 'Canvas view': 'キャンバス表示',
+ 'Live viewport with pan, zoom, rotation & view flip': 'パン・ズーム・回転・反転を含む表示領域',
+ 'App window': 'アプリ画面全体',
+ 'Entire Ink Studio window including panels & canvas': 'パネルやツールを含むInk Studioウィンドウ全体',
+ 'Maximum': '最大解像度',
+ 'Maximum capture resolution': '最大記録解像度',
+ 'Pause Recording': '記録を一時停止',
+ 'Continue Recording': '記録を再開',
+ 'Record': '記録',
+ 'Capture keyframe now': '今すぐキーフレームを記録',
+ 'Clear recorded keyframes': '記録済みフレームを消去',
+ '{count} frame': '{count}フレーム',
+ '{count} frames': '{count}フレーム',
+ '{storage} · resumes automatically after restart': '{storage}・再起動後も自動で記録を再開',
+ 'Click to Play/Pause · Double-click for Full-Screen': 'クリックで再生/停止・ダブルクリックで全画面',
+ 'WM': '透かし',
+ 'View in full-screen': '全画面で表示',
+ 'Full-Screen Preview (F)': '全画面プレビュー (F)',
+ 'Full-screen': '全画面',
+ 'No time-lapse frames yet': 'まだタイムラプスフレームがありません',
+ 'Click Record and draw strokes to capture keyframes automatically in external storage.': '「記録開始」をクリックして描画すると、外部ストレージにキーフレームが自動記録されます。',
+ 'Preview clip': 'プレビュー長さ',
+ '15s': '15秒',
+ '30s': '30秒',
+ '60s': '60秒',
+ '2m': '2分',
+ 'Full': '全画面',
+ 'Custom duration seconds': 'カスタム動画の長さ(秒)',
+ 'unit::s': '秒',
+ 'Time-lapse preview timeline': 'タイムラプスプレビュータイムライン',
+ 'Jump to start': '先頭へ戻る',
+ 'Previous frame (Left Arrow)': '前のフレーム (←)',
+ 'Previous frame (Left arrow)': '前のフレーム (←)',
+ 'Play / Pause (Space)': '再生 / 一時停止 (Space)',
+ 'Next frame (Right Arrow)': '次のフレーム (→)',
+ 'Next frame (Right arrow)': '次のフレーム (→)',
+ 'Loop playback on': 'ループ再生オン',
+ 'Loop playback off': 'ループ再生オフ',
+ 'Loop enabled': 'ループ有効',
+ 'Loop disabled': 'ループ無効',
+ 'Preview playback speed': 'プレビュー再生速度',
+ 'Playback speed': '再生速度',
+ 'Key {current}/{total}': 'キー {current}/{total}',
+ 'Keyframe {current} / {total}': 'キーフレーム {current} / {total}',
+ 'Watermark': 'ウォーターマーク',
+ 'Library': 'ライブラリ',
+ 'Std': '標準',
+ 'Ultra': '超高',
+ 'timelapseQuality::standard': '標準',
+ 'timelapseQuality::high': '高画質',
+ 'timelapseQuality::ultra': '超高画質',
+ 'timelapseQuality::lossless': '最高画質',
+ 'Export Resolution': '書き出し解像度',
+ 'Aspect Ratio': 'アスペクト比',
+ 'Orig': '元比率',
+ 'Letterbox Backdrop': '余白の背景',
+ 'backdrop::White': '白',
+ 'backdrop::Dark': 'ダーク',
+ 'backdrop::Blur': 'ぼかし',
+ 'backdrop::Custom': 'カスタム',
+ 'Background color': '背景色',
+ 'Native FFmpeg (.mp4)': 'ネイティブ FFmpeg (.mp4)',
+ 'Fast H.264 encode with watermark & CRF quality': 'ウォーターマーク・CRF画質対応の高速 H.264 エンコード',
+ 'Use native FFmpeg encoder': 'ネイティブFFmpegエンコーダーを使用',
+ 'Custom logo enabled': 'カスタムロゴ有効',
+ '"{text}" · {position}': '「{text}」・{position}',
+ 'Off — click to add text or logo': 'オフ — クリックしてテキストやロゴを追加',
+ 'Saved locally outside your .ink files so projects stay fast & lightweight.': '.ink ファイルとは別にローカル保存されるため、プロジェクトファイルを軽量に保てます。',
+ 'Refresh local recordings': 'ローカル録画一覧を更新',
+ 'No locally stored recordings found yet.': 'ローカルに保存された録画はまだありません。',
+ 'Load': '読込',
+ 'Delete recording from local storage': 'ローカル保存領域から録画を削除',
+ 'Encoding {width}×{height} @ {fps} FPS...': 'エンコード中 {width}×{height} ({fps} FPS)...',
+ 'Output: {width}×{height} · {fps} FPS · {duration}s · {quality} · {format}': '出力: {width}×{height}・{fps} FPS・{duration}秒・{quality}・{format}',
+ 'Export Video': '動画を書き出し',
+
+ // Watermark Controls
+ 'Failed to load watermark image': 'ウォーターマーク画像の読み込みに失敗しました',
+ 'Enable Watermark': 'ウォーターマークを有効化',
+ 'Enable watermark': 'ウォーターマークを有効化',
+ 'Rendered live in preview and burned into exported videos': 'プレビューにリアルタイム反映され、書き出し動画に焼き込まれます',
+ 'Logo / Signature': 'ロゴ / サイン',
+ 'Watermark Text': 'ウォーターマーク文字',
+ '@yourhandle or Ink Studio': '@アカウント名 または Ink Studio',
+ 'fontStyle::Sans': 'ゴシック',
+ 'fontStyle::Bold': '太字',
+ 'fontStyle::Mono': '等幅',
+ 'fontStyle::Serif': '明朝',
+ 'Custom watermark color': 'ウォーターマークの色をカスタム選択',
+ 'Subtle backdrop pill': '半透明の背景バッジ',
+ 'Watermark backdrop pill': '半透明の背景バッジ',
+ 'Watermark logo preview': 'ウォーターマークロゴのプレビュー',
+ 'Custom logo / signature': 'カスタムロゴ / サイン',
+ 'No image selected': '画像が未選択です',
+ 'Replace': '置き換え',
+ 'Upload PNG/SVG': 'PNG/SVGを選択',
+ 'Remove logo': 'ロゴを削除',
+ 'wmPos::TL': '左上',
+ 'wmPos::TC': '上中央',
+ 'wmPos::TR': '右上',
+ 'wmPos::Center': '中央',
+ 'wmPos::BL': '左下',
+ 'wmPos::BC': '下中央',
+ 'wmPos::BR': '右下',
+ 'top-left': '左上',
+ 'top-center': '上中央',
+ 'top-right': '右上',
+ 'center': '中央',
+ 'bottom-left': '左下',
+ 'bottom-center': '下中央',
+ 'bottom-right': '右下',
+ 'Margin': '余白',
+
+ // Fullscreen Viewer
+ 'Time-lapse Full-screen Preview': 'タイムラプス全画面プレビュー',
+ '{width}×{height} · {fps} FPS · {count} frames': '{width}×{height}・{fps} FPS・{count}フレーム',
+ 'Exit full-screen': '全画面を終了',
+ 'Exit Full-screen (Esc / F)': '全画面を終了 (Esc / F)',
+ 'Exit Full-screen (F)': '全画面を終了 (F)',
+ 'Exit': '終了',
+ 'Full-screen timeline scrubber': '全画面タイムラインシークバー',
+
+ // Contextual homonym disambiguations
+ 'timelapse::Full': 'フル',
+};
diff --git a/src/i18n/ja/menu.ts b/src/i18n/ja/menu.ts
new file mode 100644
index 0000000..1b151d7
--- /dev/null
+++ b/src/i18n/ja/menu.ts
@@ -0,0 +1,518 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_MENU: TranslationDictionary = {
+ // Top-level menu headers & MenuBar chrome
+ 'Application Menu': 'アプリケーションメニュー',
+ 'Empty': '項目なし',
+ 'File': 'ファイル',
+ 'Manga': '漫画',
+ 'Window': 'ウィンドウ',
+
+ // File menu
+ 'New...': '新規...',
+ 'Import Brush (.inkb, .sut)...': 'ブラシを読み込み (.inkb, .sut)...',
+ 'Importing Brush: {name}...': 'ブラシ「{name}」を読み込み中...',
+ 'Imported brush "{name}"': 'ブラシ「{name}」を読み込みました',
+ 'Failed to import brush file.': 'ブラシファイルの読み込みに失敗しました。',
+ 'Export Active Brush (.inkb)...': '使用中のブラシを書き出し (.inkb)...',
+ 'Exported brush "{name}"': 'ブラシ「{name}」を書き出しました',
+ 'Failed to export brush.': 'ブラシの書き出しに失敗しました。',
+ 'Import 3D Model (.glb, .obj)...': '3Dモデルを読み込み (.glb, .obj)...',
+ 'Export Image...': '画像を書き出し...',
+ 'Export Webtoon Chapter Slices (.zip)...': 'Webtoon縦長画像を分割書き出し (.zip)...',
+ 'Time-lapse': 'タイムラプス',
+ 'Pause Time-lapse Recording': 'タイムラプス記録を一時停止',
+ 'Record Time-lapse': 'タイムラプスを記録',
+ 'Preview & Export Time-lapse...': 'タイムラプスをプレビュー・書き出し...',
+ 'Clear Canvas': 'キャンバスを消去',
+
+ // Edit menu
+ 'Move Selection to New Layer': '選択範囲を新規レイヤーへ移動',
+ 'Paste from file...': 'ファイルから貼り付け...',
+ 'Import 3D File (.glb, .obj)...': '3Dファイルを読み込み (.glb, .obj)...',
+ 'Clear Active Layer': '現在のレイヤーを消去',
+ 'Free Transform': '自由変形',
+ 'Puppet Warp': 'パペットワープ',
+ 'Cage Transform': 'ケージ変形',
+ 'Fill Selection': '選択範囲を塗りつぶし',
+ 'Tonal Correction': '色調補正',
+ 'Brightness/Contrast...': '明るさ・コントラスト...',
+ 'Hue/Saturation/Luminosity...': '色相・彩度・明度...',
+ 'Posterization...': '階調化...',
+ 'Reverse Gradient': '階調の反転',
+ 'Level Correction...': 'レベル補正...',
+ 'Binarization...': '二値化...',
+ 'Resize Canvas...': 'キャンバスサイズを変更...',
+ 'Settings...': '環境設定...',
+
+ // Select menu
+ 'Invert Selection': '選択範囲を反転',
+ 'Expand (+5px)...': '選択範囲を拡張 (+5px)...',
+ 'Contract (-5px)...': '選択範囲を縮小 (-5px)...',
+ 'Feather (5px)...': '選択範囲の境界をぼかす (5px)...',
+ 'Cut Selection': '選択範囲を切り取り',
+ 'Copy Selection': '選択範囲をコピー',
+ 'Delete Selection': '選択範囲内を消去',
+ 'Delete Outside Selection': '選択範囲外を消去',
+ 'Transform Selection': '選択範囲を変形',
+
+ // Layer menu
+ 'New Raster Layer': '新規ラスターレイヤー',
+ 'New Folder': '新規レイヤーフォルダー',
+ 'New Screentone Layer...': '新規トーンレイヤー...',
+ 'New 3D Reference Layer...': '新規3D参照レイヤー...',
+ 'New Adjustment Layer': '新規色調補正レイヤー',
+ 'Tone Curves...': 'トーンカーブ...',
+ 'Gradient Map...': 'グラデーションマップ...',
+ 'Levels...': 'レベル補正...',
+ 'Color Balance...': 'カラーバランス...',
+ 'Layer Mask': 'レイヤーマスク',
+ 'Mask Already Present': 'マスクは作成済みです',
+ 'Add Layer Mask (Reveal All)': 'レイヤーマスクを作成(すべて表示)',
+ 'Delete Layer Mask': 'レイヤーマスクを削除',
+ 'Enable Layer Mask': 'レイヤーマスクを有効化',
+ 'Disable Layer Mask': 'レイヤーマスクを無効化',
+ 'Link Mask to Layer': 'マスクをレイヤーにリンク',
+ 'Unlink Mask from Layer': 'マスクとレイヤーのリンクを解除',
+ 'New Frame Border Folder': '新規コマ枠フォルダー',
+ 'Rasterize Layer': 'レイヤーをラスタライズ',
+ 'Duplicate Layer': 'レイヤーを複製',
+ 'Merge with Layer Below': '下のレイヤーと結合',
+ 'Merge Folder': 'フォルダーを結合',
+ 'Layer Style (Stroke, Shadow, Glow)...': 'レイヤースタイル(境界線・影・光彩)...',
+ 'Enable Screentone': 'トーン化を有効',
+ 'Disable Screentone': 'トーン化を無効',
+ 'Enable Layer Color (Tint)': 'レイヤーカラーを有効',
+ 'Disable Layer Color (Tint)': 'レイヤーカラーを無効',
+ 'Convert Expression Color': '表現色を変換',
+ 'Color (RGB)': 'カラー (RGB)',
+ 'Gray (Grayscale)': 'グレー(グレースケール)',
+ 'Monochrome (1-bit B&W)': 'モノクロ(2値白黒)',
+ 'Delete Layer': 'レイヤーを削除',
+
+ // Filter menu
+ 'Gaussian Blur...': 'ガウスぼかし...',
+ 'Motion Blur...': '移動ぼかし...',
+ 'Unsharp Mask...': 'アンシャープマスク...',
+ 'Film Grain...': 'フィルム粒子...',
+
+ // Ruler menu & perspective toasts
+ 'Perspective Ruler': 'パース定規',
+ 'Add 1-Point Perspective Ruler': '1点透視パース定規を追加',
+ 'Add 2-Point Perspective Ruler': '2点透視パース定規を追加',
+ "Add 3-Point Perspective Ruler (Bird's-Eye)": '3点透視パース定規を追加(俯瞰)',
+ "Add 3-Point Perspective Ruler (Worm's-Eye)": '3点透視パース定規を追加(アオリ)',
+ '1-Point Perspective Ruler added to canvas': '1点透視パース定規をキャンバスに追加しました',
+ '2-Point Perspective Ruler added to canvas': '2点透視パース定規をキャンバスに追加しました',
+ "3-Point Perspective Ruler (Bird's-Eye) added to canvas": '3点透視パース定規(俯瞰)をキャンバスに追加しました',
+ "3-Point Perspective Ruler (Worm's-Eye) added to canvas": '3点透視パース定規(アオリ)をキャンバスに追加しました',
+ 'Remove Perspective Ruler from Canvas': 'パース定規をキャンバスから削除',
+ 'Removed perspective ruler from canvas': 'パース定規をキャンバスから削除しました',
+ 'Hide Perspective Ruler': 'パース定規を非表示',
+ 'Show Perspective Ruler': 'パース定規を表示',
+ 'Disable Snapping': 'スナップを無効',
+ 'Enable Snapping': 'スナップを有効',
+ 'Unlock Handles (Edit Mode)': 'ハンドルをロック解除(編集モード)',
+ 'Lock Handles (Freeze for Inking)': 'ハンドルをロック(ペン入れ固定)',
+ 'Guide Rays ({count} lines)': 'ガイド線({count}本)',
+ '{count} Rays per VP': '消失点ごとに {count}本',
+ 'Change Perspective Preset': 'パースプリセットを変更',
+ '1-Point Perspective (Center)': '1点透視(中央)',
+ '2-Point Perspective (Wide Street)': '2点透視(街並み)',
+ "3-Point Perspective (Bird's-Eye)": '3点透視(俯瞰)',
+ "3-Point Perspective (Worm's-Eye)": '3点透視(アオリ)',
+
+ // View menu
+ 'Zoom In': 'ズームイン',
+ 'Zoom Out': 'ズームアウト',
+ 'Reset Zoom & Center': '全体表示',
+ 'Reset Zoom to 100%': '100%表示',
+ 'Reset Rotation': '回転をリセット',
+ 'Flip View Horizontal': '表示を左右反転',
+ 'Flip View Vertical': '表示を上下反転',
+ 'Reset View Flip': '表示反転をリセット',
+ 'Value Check (Live B/W)': '明度チェック(白黒表示)',
+ 'Value Check (Live B/W): ON': '明度チェック(白黒表示): ON',
+ 'Value Check (Live B/W): OFF': '明度チェック(白黒表示): OFF',
+ 'Navigator Preview Mode': 'ナビゲーター表示モード',
+ 'Navigator Preview: Color': 'ナビゲーター表示: カラー',
+ 'Live B/W Tone Preview': 'ライブ白黒トーン確認',
+ 'Navigator Preview: Live B/W Tone': 'ナビゲーター表示: ライブ白黒トーン',
+ 'Split View (Color | B/W)': '分割表示(カラー|白黒)',
+ 'Navigator Preview: Split View (Color | B/W)': 'ナビゲーター表示: 分割(カラー|白黒)',
+ 'Straight Ruler': '直線定規',
+ 'Hide Straight Ruler': '直線定規を非表示',
+ 'Straight Ruler: ON': '直線定規: ON',
+ 'Straight Ruler: OFF': '直線定規: OFF',
+ 'Lock Straight Ruler': '直線定規をロック',
+ 'Unlock Straight Ruler': '直線定規のロックを解除',
+ 'Disable Perspective Snapping': 'パース定規へのスナップを無効',
+ 'Enable Perspective Snapping': 'パース定規へのスナップを有効',
+ 'Exit Webtoon Studio Mode': 'Webtoon スタジオモードを終了',
+ 'Webtoon Studio Mode (9:16 Mockup)': 'Webtoonスタジオモード (9:16 プレビュー)',
+ 'Webtoon Studio Mode (9:16 Simulator)': 'Webtoonスタジオモード (9:16 シミュレーター)',
+ 'Proof Setup': 'カラープロファイル設定',
+ 'Working CMYK - U.S. Web Coated (SWOP) v2': '作業用 CMYK - U.S. Web Coated (SWOP) v2',
+ 'Japan Color 2001 Coated': 'Japan Color 2001 Coated',
+ 'ISO Coated v2 (ECI)': 'ISO Coated v2 (ECI)',
+ 'Proof Colors': 'カラープロファイルプレビュー',
+ 'Gamut Warning': '色域外警告',
+
+ // Manga menu
+ 'Manga Effect Lines Generator...': '集中線・流線ジェネレーター...',
+ 'Parametric Speech Balloon Tool': 'フキダシツール',
+ 'Correct Line (Vector Pinch/Width/Simplify)': '線修正ツール(つまみ・線幅・単純化)',
+
+ // Animation menu
+ 'Hide Animation Timeline': 'タイムラインを非表示',
+ 'Show Animation Timeline': 'タイムラインを表示',
+ 'Add Cel to Current Frame': '現在のフレームにセルを追加',
+ 'Disable Onion Skinning': 'オニオンスキンを無効',
+ 'Enable Onion Skinning': 'オニオンスキンを有効',
+
+ // Window menu & workspace presets / panels
+ 'Workspace': 'ワークスペース',
+ 'Loaded workspace "{name}"': 'ワークスペース「{name}」を読み込みました',
+ 'Left-Handed Workspace Mirror': '左手用ワークスペース反転',
+ 'Left-Handed Workspace Mirror: ON': '左手用ミラー配置: ON',
+ 'Left-Handed Workspace Mirror: OFF': '左手用ミラー配置: OFF',
+ 'Register Current Layout as Custom': '現在のレイアウトをカスタムに登録',
+ 'Workspace saved to Custom preset': '現在のレイアウトをカスタムプリセットに保存しました',
+ 'Reset Workspace': 'ワークスペースをリセット',
+ 'Workspace reset to preset defaults': 'ワークスペースを初期配置にリセットしました',
+ 'Palette Locks': 'パレットロック',
+ 'Unlock All Palettes': 'すべてのパレットロックを解除',
+ 'Lock All Palettes': 'すべてのパレットをロック',
+ 'All palette locks: ON': 'すべてのパレットロック: ON',
+ 'All palette locks: OFF': 'すべてのパレットロック: OFF',
+ 'Lock Width': '幅をロック',
+ 'Lock Height': '高さをロック',
+ 'Lock Position / Move': '位置・移動をロック',
+ 'Show Palettes': 'パレットを表示',
+ 'Hide Palettes': 'パレットを隠す',
+ 'Quick-Access Brush Panel': 'クイックブラシパネル',
+ 'Contextual Tool Options Bar': 'ツールオプションバー',
+ 'Command Bar': 'コマンドバー',
+ 'Document Tab Bar': 'ドキュメントタブバー',
+ 'Status Bar': 'ステータスバー',
+ 'Appearance Studio...': '外観スタジオ...',
+
+ // Workspace presets (WORKSPACE_PRESET_LABELS)
+ 'Default Illustration': 'イラスト(標準)',
+ 'Photoshop Studio': 'Photoshop 風',
+ 'Clip Studio': 'CLIP STUDIO 風',
+ 'Manga Studio': '漫画制作',
+ 'Minimalist Tablet': 'ミニマル(液タブ向け)',
+
+ // Dock panel titles (DOCK_PANEL_META)
+ 'Tool': 'ツール',
+ 'Sub Tool': 'サブツール',
+ 'Tool Property': 'ツールプロパティ',
+ 'Brush Size': 'ブラシサイズ',
+ 'Navigator': 'ナビゲーター',
+ 'References': 'リファレンス',
+ 'Info': '情報',
+ 'Color Wheel': 'カラーサークル',
+ 'Color Sliders': 'カラースライダー',
+ 'Color Sets': 'カラーセット',
+ 'Color History': 'カラーヒストリー',
+ 'History': 'ヒストリー',
+ 'Quick Access': 'クイックアクセス',
+ 'Auto Action': 'オートアクション',
+
+ // Help menu & community links
+ 'Check for Updates...': 'アップデートを確認...',
+ 'Report an Issue': '不具合を報告',
+ 'About Ink Studio': 'Ink Studio について',
+ 'Discord Community': 'Discord コミュニティ',
+ 'X (Twitter)': 'X (Twitter)',
+ 'GitHub Repository': 'GitHub リポジトリ',
+ 'Ink Studio Website': 'Ink Studio 公式サイト',
+ 'Join Ink Studio on Discord': 'Ink Studio の Discord に参加',
+ 'Follow @inkstudio_app on X (Twitter)': 'X (Twitter) で @inkstudio_app をフォロー',
+ 'Ink Studio on GitHub': 'GitHub で Ink Studio を見る',
+ 'Visit Ink Studio Website': 'Ink Studio 公式サイトを開く',
+
+ // Header & WindowControls
+ 'App View': '表示切替',
+ 'Home': 'ホーム',
+ 'Home & Recent Documents': 'ホーム・最近のファイル',
+ 'Drawing Workspace': '制作ワークスペース',
+ '1-bit': 'モノクロ',
+ 'Gray': 'グレー',
+ 'Value B/W': '明度確認',
+ 'Live 1-Click Value Check (B/W Tone Check) is active — display only, layer colors unchanged. Click or press Shift+Y to return to Color.':
+ 'ワンクリック明度チェック(白黒表示)が有効です。表示のみの切り替えでレイヤーの色は変わりません。クリックまたは Shift+Y でカラーに戻ります。',
+ 'Non-destructive View Mirror active (display only — layer pixels unchanged). Click to reset view flip.':
+ '非破壊の表示反転が有効です(表示のみでレイヤー画像は変更されません)。クリックして解除します。',
+ 'View Flip H+V': '左右・上下反転',
+ 'View Flip H': '左右反転',
+ 'View Flip V': '上下反転',
+ 'Reset Canvas Rotation (Ctrl+Alt+0)': 'キャンバスの回転をリセット (Ctrl+Alt+0)',
+ 'Zoom Out (Ctrl+-)': 'ズームアウト (Ctrl+-)',
+ 'Reset Zoom & Center (Ctrl+0)': '全体表示・中央揃え (Ctrl+0)',
+ 'Zoom In (Ctrl++)': 'ズームイン (Ctrl++)',
+ '1-Click Value Check (Live B/W)': 'ワンクリック明度チェック(ライブ白黒)',
+ '1-Click Value Check (Shift+Y) — Live B/W Tone Check (non-destructive)':
+ 'ワンクリック明度チェック (Shift+Y) — 非破壊ライブ白黒プレビュー',
+ 'Flip View Horizontal (Shift+H) — non-destructive view mirror':
+ '表示を左右反転 (Shift+H) — 非破壊ミラー表示',
+ 'Flip View Vertical (Shift+V) — non-destructive view mirror':
+ '表示を上下反転 (Shift+V) — 非破壊ミラー表示',
+ 'Collab: Reconnecting...': '共同制作: 再接続中...',
+ 'Collab ({count} online)': '共同制作({count}人参加中)',
+ 'Collaborative Session': '共同制作セッション',
+ 'Exit Focus Mode (Tab)': 'フォーカスモードを終了 (Tab)',
+ 'Enter Focus Mode (Tab)': 'フォーカスモードを開始 (Tab)',
+ 'Focus Mode — Hide Palettes (Tab)': 'フォーカスモード — パレットを隠す (Tab)',
+ 'Live Appearance Studio': '外観スタジオ',
+ 'Preferences (Ctrl+,)': '環境設定 (Ctrl+,)',
+ 'Minimize': '最小化',
+ 'Maximize': '最大化',
+ 'Restore': '復元',
+ 'Exit Fullscreen': 'フルスクリーンを終了',
+
+ // CommandBar & COMMAND_CATALOG
+ 'Customize Command Bar': 'コマンドバーをカスタマイズ',
+ 'Pinned ({count})': 'ピン留め({count})',
+ 'Move left': '左へ移動',
+ 'Move right': '右へ移動',
+ 'Available Commands': '追加可能なコマンド',
+ 'Saved workspace "{name}"': 'ワークスペース「{name}」を保存しました',
+ 'Workspace Archetypes, Saved Profiles & Left-Handed Mirror':
+ 'ワークスペースプリセット・保存済みレイアウト・左手用反転',
+ 'Left-Handed Mirror Active': '左手用ミラー有効',
+ 'LH': '左手',
+ 'All palette locks active (Width, Height, Move)': 'すべてのパレットロックが有効(幅・高さ・移動)',
+ 'Palette locks active: {locks}': '有効なパレットロック: {locks}',
+ 'Workspace Archetypes': 'ワークスペース構成',
+ 'Saved Workspaces': '保存済みワークスペース',
+ 'Delete "{name}"': '「{name}」を削除',
+ 'Delete {name}': '{name} を削除',
+ 'Workspace Name': 'ワークスペース名',
+ 'e.g. Lineart, Coloring...': '例: 線画、着彩...',
+ 'Save Current Workspace...': '現在のワークスペースを保存...',
+ 'All palette locks enabled': 'すべてのパレットをロックしました',
+ 'All palette locks disabled': 'すべてのパレットロックを解除しました',
+ 'Unlock All': 'すべて解除',
+ 'Lock All': 'すべてロック',
+ 'Left-Handed Mirror': '左手用ミラー配置',
+ 'Tool Options Bar': 'ツールオプションバー',
+ 'Hide Quick Brushes': 'クイックブラシを隠す',
+ 'Show Quick Brushes': 'クイックブラシを表示',
+ 'Flip Horizontal': '左右反転',
+ 'Flip Vertical': '上下反転',
+ 'Clear Layer': 'レイヤーを消去',
+ 'Merge Down': '下のレイヤーと結合',
+ 'New Layer': '新規レイヤー',
+ 'Reset Zoom': '表示倍率をリセット',
+ 'Swap Colors': '描画色と背景色を入れ替え',
+ 'Transparent Ink': '透明色',
+ 'Lasso Selection': '投げなわ選択',
+ 'Toggle Fullscreen': 'フルスクリーン切替',
+ 'Focus Mode (Hide Palettes)': 'フォーカスモード(パレット非表示)',
+ 'Quick Brush Panel': 'クイックブラシパネル',
+
+ // DocumentTabBar
+ 'Unsaved changes': '未保存の変更があります',
+ 'Close {name}': '「{name}」を閉じる',
+ 'Close file': 'ファイルを閉じる',
+ 'New Document': '新規ドキュメント',
+ 'Create New File (Ctrl+N)': '新規ファイルを作成 (Ctrl+N)',
+
+ // StatusBar
+ 'Bézier': 'ベジェ補正',
+ 'Direct': 'ダイレクト',
+ 'Stab: {value}': '手ブレ: {value}',
+ 'Canvas Dimensions': 'キャンバスサイズ',
+ 'Active Document Color Mode: {mode}': '現在のカラーモード: {mode}',
+ '1-bit Manga': 'モノクロ2値',
+ 'Grayscale': 'グレースケール',
+ 'Color RGB': 'カラー RGB',
+ 'CMYK Soft Proofing: {standard}': 'CMYK校正プレビュー: {standard}',
+ 'CMYK Soft Proofing: {standard} (Gamut Warning ON)': 'CMYK校正プレビュー: {standard}(色域外警告 ON)',
+ '[CMYK Proof: {label}]': '[CMYK校正: {label}]',
+ 'No active document': '開いているドキュメントはありません',
+ '1-Click Value Check (Live B/W Tone Check) is ON — Click or press Shift+Y to disable':
+ 'ワンクリック明度チェック(白黒確認)ON — クリックまたは Shift+Y で解除',
+ '1-Click Value Check (Shift+Y) — Toggle Live B/W Tone Preview':
+ 'ワンクリック明度チェック (Shift+Y) — ライブ白黒トーン確認を切り替え',
+ '[Value Check: B/W]': '[明度確認: 白黒]',
+ 'Value': '明度',
+ 'Pos:': '座標:',
+ 'Pressure:': '筆圧:',
+ 'Canvas Rotation (Click or Double-click to Reset 0°)': 'キャンバス回転(クリックまたはダブルクリックで 0° にリセット)',
+ 'Angle:': '角度:',
+ 'Canvas Zoom Level (Click to Reset to 100% — Ctrl+1)': '表示倍率(クリックで 100% にリセット — Ctrl+1)',
+ 'Canvas Zoom Level': '表示倍率',
+ 'Zoom:': 'ズーム:',
+
+ // ToolStrip, LeftPanel, LeftSidebar, ModernPropertyBar
+ 'Transparent ink mode active': '透明色モードに切り替えました',
+ 'Color ink mode active': '描画色モードに切り替えました',
+ 'Brush (B)': 'ブラシ (B)',
+ 'Eraser (E)': '消しゴム (E)',
+ 'Eyedropper (I)': 'スポイト (I)',
+ 'Liquify (J)': 'ゆがみ (J)',
+ 'Retouch: Smudge / Blur / Dodge / Burn / Clone (S)': 'レタッチ: 指先・ぼかし・覆い焼き・焼き込み・コピースタンプ (S)',
+ 'Transform (Ctrl+T)': '自由変形 (Ctrl+T)',
+ 'Marquee (M)': '長方形選択 (M)',
+ 'Lasso (L)': '投げなわ選択 (L)',
+ 'Magic Wand (W)': '自動選択 (W)',
+ 'Selection Pen': '選択ペン',
+ 'Fill (G)': '塗りつぶし (G)',
+ 'Gradient: Linear / Radial / Mesh (Shift+G)': 'グラデーション: 線形・円形・メッシュ (Shift+G)',
+ 'Shapes (U)': '図形 (U)',
+ 'Bézier Pen (P)': 'ベクターペン (P)',
+ 'Object (O)': 'オブジェクト (O)',
+ 'Text (T)': 'テキスト (T)',
+ 'Frame Border (F)': 'コマ枠 (F)',
+ 'Speech Balloon': 'フキダシ',
+ 'Correct Line': '線修正',
+ '3D Object & Camera Tool (K)': '3Dオブジェクト・カメラツール (K)',
+ 'Straight Ruler (R)': '直線定規 (R)',
+ 'Secondary: {color} (X to swap, D to reset)': 'サブカラー: {color}(Xで入替、Dで初期化)',
+ 'Primary: {color}': '描画色: {color}',
+ 'Transparent Ink (C)': '透明色 (C)',
+ 'Swap Colors (X)': '描画色と背景色を入れ替え (X)',
+ 'Hide/Show Palettes (Tab)': 'パレットを表示/非表示 (Tab)',
+ 'Show Panel (Shift+Tab)': 'パネルを表示 (Shift+Tab)',
+ 'Hide Panel (Shift+Tab)': 'パネルを隠す (Shift+Tab)',
+ 'Resize brush panel': 'ブラシパネルの幅を変更',
+ 'Brush Tool (B)': 'ブラシツール (B)',
+ 'Decoration Tool': 'デコレーションツール',
+ 'Eraser Tool (E)': '消しゴムツール (E)',
+ 'Pipette Tool (I / Hold Alt)': 'スポイトツール (I / Alt長押し)',
+ 'Pipette (I / Hold Alt)': 'スポイト (I / Alt長押し)',
+ 'Liquify Tool (J)': 'ゆがみツール (J)',
+ 'Secondary Color: {color} (Click or press X to swap)': 'サブカラー: {color}(クリックまたはXで入替)',
+ 'Primary Active Color: {color} (Click to select/swap)': 'メインカラー: {color}(クリックで選択/入替)',
+ 'Transparent Ink / Color (C) - Brush as textured eraser': '透明色 (C) — ブラシ形状のまま消しゴムとして描画',
+ 'Browse Brush Presets': 'ブラシプリセット一覧を表示',
+ 'Current Brush Preset (Click to Toggle Editor)': '現在のブラシプリセット(クリックでエディター切替)',
+ 'Toggle Detailed Brush Settings & Dynamics': '詳細ブラシ設定・ダイナミクスを表示/非表示',
+ 'Brush Editor': 'ブラシエディター',
+ 'Mode:': '合成:',
+ 'Brush Blending Mode': 'ブラシ合成モード',
+ 'Size:': 'サイズ:',
+ 'Opacity:': '不透明度:',
+ 'Flow:': 'インク量:',
+ 'Tool Options & Presets': 'ツールオプション・プリセット',
+
+ // ModalHost loading overlay
+ 'Opening Document...': 'ドキュメントを開いています...',
+ 'Processing layers and tile data': 'レイヤーとタイルデータを処理中',
+ 'Extracting layers and pixel data': 'レイヤーとピクセルデータを展開中',
+
+ // App.tsx history steps, auto-action labels & toasts
+ 'Enable Animation Timeline': 'アニメーションタイムラインを有効化',
+ 'Disable Animation Timeline': 'アニメーションタイムラインを無効化',
+ 'Update Animation Cels': 'アニメーションセルを更新',
+ 'Update Animation Timeline': 'アニメーションタイムラインを更新',
+ 'Cel Frame {n}': 'セル {n}',
+ 'Add Cel Frame {n}': 'フレーム {n} にセルを追加',
+ 'Cel added for frame {n}': 'フレーム {n} にセルを追加しました',
+ 'Remove Cel Frame {n}': 'フレーム {n} のセルを削除',
+ 'Cel removed from frame {n}': 'フレーム {n} のセルを削除しました',
+ 'Viewers have read-only access': '閲覧者は読み取り専用です',
+ 'Toggle Reference Layer': '参照レイヤーを切替',
+ 'Layer is locked by its owner': 'このレイヤーはオーナーによってロックされています',
+ 'Cannot merge a protected layer': '保護されたレイヤーは結合できません',
+ 'Target layer below is locked by its owner': '下の結合先レイヤーはオーナーによってロックされています',
+ 'Merged layer down': '下のレイヤーと結合しました',
+ 'Cannot merge down: need an unlocked raster layer below': '結合できません:下にロックされていないラスターレイヤーが必要です',
+ 'Merged folder into layer': 'フォルダーをレイヤーに結合しました',
+ 'Cannot merge folder: select an unlocked folder': 'フォルダーを結合できません:ロックされていないフォルダーを選択してください',
+ 'Created Frame Border Folder': 'コマ枠フォルダーを作成しました',
+ 'Layer rasterized': 'レイヤーをラスタライズしました',
+ 'Only Text, Speech Balloon, or Vector layers can be rasterized': 'テキスト・フキダシ・ベクターレイヤーのみラスタライズできます',
+ 'Create Folder': 'フォルダーを作成',
+ 'Create Layer': 'レイヤーを作成',
+ 'Blend Mode: {mode}': '合成モード: {mode}',
+ 'Opacity: {percent}%': '不透明度: {percent}%',
+ 'Toggle Clipping Mask': '下のレイヤーでクリッピングを切替',
+ 'Filter: {type}': 'フィルター: {type}',
+ 'Expression Color: {mode}': '表現色: {mode}',
+ 'Auto Action "{name}" finished with {count} error(s)': 'オートアクション「{name}」が {count} 件のエラーで完了しました',
+ 'Played "{name}" ({count} steps)': '「{name}」を実行しました({count} ステップ)',
+ 'Time-lapse recording started (saved locally)': 'タイムラプス記録を開始しました(ローカル保存)',
+ 'Time-lapse recording paused': 'タイムラプス記録を一時停止しました',
+ 'Transform active — press Enter to apply or Esc / Ctrl+Z to cancel': '変形中です — Enterで確定、Esc または Ctrl+Z でキャンセルできます',
+ 'Use Text/Object tool to edit, or Rasterize Layer to paint directly': 'テキスト/オブジェクトツールで編集するか、ラスタライズして直接描画してください',
+ 'Select a child layer inside the Frame Border Folder to draw': 'コマ枠フォルダー内の子レイヤーを選択して描画してください',
+ 'Imported 3D model "{name}"': '3Dモデル「{name}」を読み込みました',
+
+ // Contextual tool IDs (StatusBar)
+ 'toolId::brush': 'ブラシ',
+ 'toolId::decoration': 'デコレーション',
+ 'toolId::eraser': '消しゴム',
+ 'toolId::pipette': 'スポイト',
+ 'toolId::transform': '変形',
+ 'toolId::select-rect': '長方形選択',
+ 'toolId::select-lasso': '投げなわ選択',
+ 'toolId::select-wand': '自動選択',
+ 'toolId::select-pen': '選択ペン',
+ 'toolId::select-eraser': '選択消し',
+ 'toolId::fill': '塗りつぶし',
+ 'toolId::gradient': 'グラデーション',
+ 'toolId::retouch': 'レタッチ',
+ 'toolId::shape': '図形',
+ 'toolId::pen': 'ベクターペン',
+ 'toolId::text': 'テキスト',
+ 'toolId::frame': 'コマ枠',
+ 'toolId::balloon': 'フキダシ',
+ 'toolId::object': 'オブジェクト',
+ 'toolId::vector-edit': '線修正',
+ 'toolId::liquify': 'ゆがみ',
+ 'toolId::3d': '3D',
+
+ // Contextual color mode IDs (StatusBar)
+ 'colorModeId::color': 'カラー (RGB)',
+ 'colorModeId::grayscale': 'グレースケール',
+ 'colorModeId::monochrome': 'モノクロ (2値)',
+
+ // Contextual blend mode IDs (App.tsx auto-action recording)
+ 'blendModeId::normal': '通常',
+ 'blendModeId::multiply': '乗算',
+ 'blendModeId::screen': 'スクリーン',
+ 'blendModeId::overlay': 'オーバーレイ',
+ 'blendModeId::darken': '比較(暗)',
+ 'blendModeId::lighten': '比較(明)',
+ 'blendModeId::color-dodge': '覆い焼きカラー',
+ 'blendModeId::color-burn': '焼き込みカラー',
+ 'blendModeId::hard-light': 'ハードライト',
+ 'blendModeId::soft-light': 'ソフトライト',
+ 'blendModeId::difference': '差の絶対値',
+ 'blendModeId::exclusion': '除外',
+ 'blendModeId::pass-through': '通過',
+ 'blendModeId::linear-burn': '焼き込み(リニア)',
+ 'blendModeId::add-glow': '加算(発光)',
+ 'blendModeId::color-dodge-glow': '覆い焼き(発光)',
+ 'blendModeId::divide': '除算',
+ 'blendModeId::vivid-light': 'ビビッドライト',
+ 'blendModeId::linear-light': 'リニアライト',
+ 'blendModeId::pin-light': 'ピンライト',
+ 'blendModeId::hard-mix': 'ハードミックス',
+ 'blendModeId::subtract': '減算',
+ 'blendModeId::darker-color': 'カラー比較(暗)',
+ 'blendModeId::lighter-color': 'カラー比較(明)',
+ 'blendModeId::hue': '色相',
+ 'blendModeId::saturation': '彩度',
+ 'blendModeId::color': 'カラー',
+ 'blendModeId::luminosity': '輝度',
+
+ // Contextual filter IDs (App.tsx auto-action recording)
+ 'filterId::gaussian-blur': 'ガウスぼかし',
+ 'filterId::motion-blur': '移動ぼかし',
+ 'filterId::unsharp-mask': 'アンシャープマスク',
+ 'filterId::film-grain': 'フィルム粒子',
+
+ // Contextual expression color IDs (App.tsx auto-action recording)
+ 'expressionColorId::color': 'カラー',
+ 'expressionColorId::gray': 'グレー',
+ 'expressionColorId::monochrome': 'モノクロ',
+
+ // Contextual homonym disambiguations
+ 'menu::Empty': '項目なし',
+ 'window::Restore': '元に戻す(縮小)',
+};
diff --git a/src/i18n/ja/settings.ts b/src/i18n/ja/settings.ts
new file mode 100644
index 0000000..a512aee
--- /dev/null
+++ b/src/i18n/ja/settings.ts
@@ -0,0 +1,1185 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_SETTINGS: TranslationDictionary = {
+ // =========================================================================
+ // Contextual Disambiguations
+ // =========================================================================
+ 'colorMode::color': 'カラー',
+ 'colorMode::grayscale': 'グレースケール',
+ 'colorMode::monochrome': 'モノクロ',
+ 'cornerRadius::Sharp': 'シャープ',
+ 'cornerRadius::Machined': '標準',
+ 'cornerRadius::Soft': '丸み',
+ 'contrast::AAA': 'AAA',
+ 'contrast::AA': 'AA',
+ 'contrast::AA Large': 'AA(大文字)',
+ 'contrast::Low': '低',
+ 'theme::Dark': 'ダーク',
+ 'theme::Light': 'ライト',
+ 'brushStudio::Stroke': 'ストローク',
+ 'appearanceTab::Density': '密度',
+ 'status::Active': '有効',
+
+ // =========================================================================
+ // Settings Modal — Shell, Tabs & Language
+ // =========================================================================
+ 'Preferences': '環境設定',
+ 'Appearance': '外観',
+ 'Canvas': 'キャンバス',
+ 'Brush & Stylus': 'ブラシ・筆圧',
+ 'Performance': 'パフォーマンス',
+ 'Collaboration': '共同制作',
+ 'Shortcuts': 'ショートカット',
+ 'Modifier Keys': '修飾キー',
+ 'About': 'バージョン情報',
+ 'Reset All Defaults': 'すべて初期設定に戻す',
+ 'Preferences reset to defaults': '環境設定を初期設定に戻しました',
+ 'Close (Esc)': '閉じる (Esc)',
+ 'Choose the display language for menus, panels, tools, and dialogs':
+ 'メニュー、パネル、ツール、ダイアログの表示言語を選択します',
+ 'System Default': 'システム設定に従う',
+ 'System Default ({lang})': 'システム設定に従う({lang})',
+
+ // =========================================================================
+ // Settings Modal — Appearance Tab & UI Scale
+ // =========================================================================
+ 'Live Appearance Studio': '外観スタジオ',
+ 'Fine-tune brightness, warmth, accent, chrome, density, and custom tokens live over your canvas':
+ 'キャンバス上で確認しながら、明るさ・色温度・アクセント・UIスタイル・密度・カスタムトークンをリアルタイムに微調整できます',
+ 'Open Live Appearance Studio': '外観スタジオを開く',
+ 'Look Presets': '外観プリセット',
+ 'Calibrated studio palettes for color-accurate dark, neutral 18%, and daylight work':
+ '正確な色評価のためのダーク・ニュートラル18%・デイライト向けスタジオ配色プリセット',
+ 'Interface Scale': 'UIスケール',
+ 'Interface Size': 'UIサイズ',
+ 'Interface Size Percentage': 'UIサイズ(%)',
+ 'Adjust UI scale for menus, panels, and controls ({min}%–{max}%)':
+ 'メニュー、パネル、コントロールのUI倍率を調整します({min}%〜{max}%)',
+ 'Decrease (-{step}%)': '縮小 (-{step}%)',
+ 'Increase (+{step}%)': '拡大 (+{step}%)',
+ 'Decrease Interface Size': 'UIサイズを縮小',
+ 'Increase Interface Size': 'UIサイズを拡大',
+ 'Reset Interface Size to 100%': 'UIサイズを100%にリセット',
+ 'UI Scale': 'UIスケール',
+ 'Viewport Overlays': 'ビューポート表示',
+ 'Transparency Checkerboard': '透明部分の市松模様',
+ 'Cursor Coordinates': 'カーソル座標',
+ 'Stylus Pressure Readout': '筆圧インジケーター',
+
+ // =========================================================================
+ // Settings Modal — Canvas Tab
+ // =========================================================================
+ 'Default Dimensions': '新規キャンバスの初期サイズ',
+ 'Width (px)': '幅 (px)',
+ 'Height (px)': '高さ (px)',
+ 'Resolution (DPI)': '解像度 (DPI)',
+ 'Color Mode': '表現色',
+
+ // =========================================================================
+ // Settings Modal — Brush & Stylus Tab
+ // =========================================================================
+ 'Default Stabilization': '標準の手ブレ補正',
+ 'Stylus Pressure Sensitivity': '筆圧感知を有効にする',
+ 'Bezier Curve Smoothing': 'ベジェ曲線による補正',
+ 'QuickShape (Hold Pen to Snap Shape)': 'クイックシェイプ(ペン停止で図形スナップ)',
+ 'Hold the stylus still (~350 ms) at the end of a freehand stroke to snap it into a smooth line, arc, circle, ellipse, triangle, or rectangle, then drag handles or corners before lifting.':
+ 'フリーハンドの描き終わりでペンを約350ms静止させると、直線・円弧・円・楕円・三角形・長方形に自動補正されます。ペンを離す前にハンドルや角をドラッグして形を調整できます。',
+ 'Max History States': 'ヒストリーの最大記録数',
+ 'RAM, GPU & Scratch Disk': 'RAM・GPU・仮想記憶ディスク',
+ 'Configure RAM allocation ({mb} MB), GPU adapter, and rendering optimization':
+ 'RAM割り当て({mb} MB)、GPUアダプター、描画最適化を設定します',
+ 'Open Performance': 'パフォーマンス設定を開く',
+
+ // =========================================================================
+ // Settings Modal — Collaboration Tab
+ // =========================================================================
+ 'Collaborative Drawing (WebRTC P2P)': '共同制作(WebRTC P2P)',
+ 'Configure your display nickname and optional custom signaling or TURN relay servers for P2P rooms':
+ '表示ニックネームや、P2Pルーム用のカスタムシグナリング/TURNリレーサーバー(任意)を設定します',
+ 'Artist Name': 'アーティスト名',
+ 'Artist': 'アーティスト',
+ 'Shown to other artists on live cursors, participant lists, and owned layers.':
+ 'ライブカーソル、参加者一覧、所有レイヤー上で他の参加者に表示されます。',
+ 'Free public Google and Cloudflare STUN servers are included automatically for direct WebRTC P2P connections across PC and Android tablets.':
+ 'PCおよびAndroidタブレット間の直接WebRTC P2P接続には、GoogleおよびCloudflareの無料公開STUNサーバーが自動的に使用されます。',
+ 'Custom Signaling Server URL (Optional)': 'カスタムシグナリングサーバーURL(任意)',
+ 'wss://your-worker.workers.dev/signal (leave blank for built-in free relays)':
+ 'wss://your-worker.workers.dev/signal(空欄で内蔵の無料リレーを使用)',
+ 'Signaling URL should start with {proto1} or {proto2}.':
+ 'シグナリングURLは {proto1} または {proto2} で始まる必要があります。',
+ 'Leave blank to use Ink Studio\'s built-in free multi-relay signaling. Only tiny SDP/ICE handshakes pass through signaling — all brush strokes and tiles travel directly peer-to-peer.':
+ '空欄にするとInk Studio内蔵の無料マルチリレー・シグナリングを使用します。シグナリングを通過するのは軽量のSDP/ICEハンドシェイクのみで、ブラシストロークやタイルデータはすべてP2Pで直接送受信されます。',
+ 'Optional TURN Server (Strict NAT / Firewall)': 'TURNサーバー(任意・厳格なNAT/ファイアウォール向け)',
+ 'TURN Server URL': 'TURNサーバーURL',
+ 'TURN URL must start with {proto1} or {proto2}.':
+ 'TURN URLは {proto1} または {proto2} で始まる必要があります。',
+ 'TURN Username': 'TURNユーザー名',
+ 'Optional username': 'ユーザー名(任意)',
+ 'TURN Credential': 'TURN認証情報',
+ 'Optional password / token': 'パスワード/トークン(任意)',
+ 'Only required when direct P2P hole-punching is blocked by symmetric NAT or corporate firewalls.':
+ '対称NATや企業ファイアウォールにより直接P2P接続がブロックされる場合のみ必要です。',
+ 'Collaboration network settings reset to defaults': '共同制作のネットワーク設定を初期設定に戻しました',
+
+ // =========================================================================
+ // Settings Modal — Shortcuts Tab
+ // =========================================================================
+ 'Search commands or keys...': 'コマンドやキーを検索...',
+ 'Click any key badge to rebind. Supports Ctrl, {osKey} (OS), Shift, and Alt — including direct shortcuts for custom sub tools & groups.':
+ 'キーバッジをクリックして割り当てを変更できます。Ctrl・{osKey} (OS)・Shift・Altに対応し、カスタムサブツールやグループにも直接割り当てられます。',
+ 'Reset all keybindings to defaults': 'すべてのショートカットを初期設定に戻す',
+ 'Shortcuts reset to defaults': 'ショートカットを初期設定に戻しました',
+ 'Recording shortcut — press any key combo with Ctrl, {osKey}, Shift, or Alt (Esc to cancel)':
+ 'ショートカットを記録中 — Ctrl・{osKey}・Shift・Altを組み合わせたキーを押してください(Escでキャンセル)',
+ 'Cancel (Esc)': 'キャンセル (Esc)',
+ 'Release to apply': '離して適用',
+ 'Combine the next key press with the {osKey} (OS) modifier key':
+ '次に押すキーに {osKey} (OS) 修飾キーを組み合わせます',
+ '{shortcut} conflicts with {commands}. Reassign anyway?':
+ '{shortcut} は「{commands}」と重複しています。上書きしますか?',
+ 'Replace': '置き換え',
+ 'Assigned {shortcut}': '{shortcut} を割り当てました',
+ 'Hold': '長押し',
+ 'Hold key > 250ms to temporarily activate and revert on release':
+ 'キーを250ms以上長押しすると一時的に切り替わり、離すと元のツールに戻ります',
+ 'Press keys...': 'キーを入力...',
+ 'Click and press a key combination to rebind': 'クリックしてキーの組み合わせを押すと変更できます',
+ 'Unbind shortcut': 'ショートカットを解除',
+ 'Reset to default ({shortcut})': '初期値({shortcut})に戻す',
+ 'Unassigned': '未割り当て',
+
+ // Shortcut Categories & Group Badges
+ 'Tools': 'ツール',
+ 'Sub Tools': 'サブツール',
+ 'Menu': 'メニュー',
+ 'Canvas View': 'キャンバス表示',
+ 'Layer': 'レイヤー',
+ 'Edit': '編集',
+ 'Custom Group': 'カスタムグループ',
+ 'Pen': 'ペン',
+ 'Sketch': '鉛筆・スケッチ',
+ 'Brush': 'ブラシ',
+ 'Blend': '色混ぜ',
+ 'Natural Paint': '厚塗り・リアル画材',
+ 'Texture & FX': '質感・エフェクト',
+ 'Background': '背景',
+ 'Clothing': '衣装・レース',
+ 'Effect': '効果',
+
+ // Shortcut Commands (DEFAULT_COMMANDS + dynamic sub tool templates)
+ 'Brush Tool': 'ブラシツール',
+ 'Switch to brush (hold > 250ms for temporary switch)':
+ 'ブラシに切り替え(250ms以上長押しで一時切り替え)',
+ 'Decoration Tool': 'デコレーションツール',
+ 'Switch to Decoration tool group (Background, Clothing, Effect)':
+ 'デコレーションツールグループ(背景・衣装・効果)に切り替え',
+ 'Eraser Tool': '消しゴムツール',
+ 'Switch to eraser (hold > 250ms for temporary switch)':
+ '消しゴムに切り替え(250ms以上長押しで一時切り替え)',
+ 'Eyedropper Tool': 'スポイトツール',
+ 'Sample color from canvas (hold > 250ms for temporary switch)':
+ 'キャンバスから色を取得(250ms以上長押しで一時切り替え)',
+ 'Liquify Tool': 'ゆがみツール',
+ 'Warp pixels with liquify brush': 'ゆがみブラシでピクセルを変形',
+ 'Rectangle Selection': '長方形選択',
+ 'Rectangular marquee selection': '長方形の選択範囲を作成',
+ 'Lasso Selection': '投げなわ選択',
+ 'Freehand lasso selection': 'フリーハンドで選択範囲を作成',
+ 'Magic Wand': '自動選択',
+ 'Contiguous color area selection': '近似色の連続領域を選択',
+ 'Fill Bucket': '塗りつぶし',
+ 'Flood fill enclosed regions': '閉領域を塗りつぶし',
+ 'Gradient Tool': 'グラデーションツール',
+ 'Draw linear, radial, and interactive mesh gradients':
+ '線形・放射状・インタラクティブメッシュグラデーションを描画',
+ 'Retouch Tool': 'レタッチツール',
+ 'Smudge, Blur, Dodge, Burn, and Clone Stamp brush':
+ '指先・ぼかし・覆い焼き・焼き込み・コピースタンプブラシ',
+ 'Geometric Shapes': '図形ツール',
+ 'Draw lines, rectangles, ellipses, triangles, polygons, stars, and arrows':
+ '直線・長方形・楕円・三角形・多角形・星・矢印を描画',
+ 'Bézier Pen Tool': 'ベジェ曲線ペン',
+ 'Plot true cubic Bézier curves with editable anchor handles':
+ '編集可能なアンカーハンドル付きの3次ベジェ曲線を描画',
+ 'Text Tool': 'テキストツール',
+ 'Place and edit manga typography': 'テキストの配置と編集',
+ 'Manga Frame Tool': 'コマ枠ツール',
+ 'Create panel borders': '漫画のコマ枠を作成',
+ 'Speech Balloon': 'フキダシ',
+ 'Draw parametric speech balloons': 'パラメトリックなフキダシを作成',
+ 'Vector Edit Tool': '線修正ツール',
+ 'Pinch, simplify, and adjust vector strokes': 'ベクター線のつまみ・単純化・線幅調整',
+ '3D Object & Camera Tool': '3Dオブジェクト・カメラツール',
+ 'Manipulate 3D models, lighting, camera, and poses on the canvas':
+ 'キャンバス上で3Dモデル・光源・カメラ・ポーズを操作',
+ 'Selection Pen': '選択ペン',
+ 'Paint freehand selection mask strokes': 'ブラシのように描いて選択範囲を作成',
+ 'Object Tool': 'オブジェクトツール',
+ 'Select and manipulate vector, balloon, and frame objects':
+ 'ベクター線・フキダシ・コマ枠オブジェクトを選択して操作',
+ 'Previous Sub Tool': '前のサブツール',
+ 'Switch to the previous sub tool in the active group':
+ '現在のグループ内の前のサブツールに切り替え',
+ 'Next Sub Tool': '次のサブツール',
+ 'Switch to the next sub tool in the active group':
+ '現在のグループ内の次のサブツールに切り替え',
+ 'Previous Instrument / Tool': '前のツール',
+ 'Switch to the previous instrument on the tool bar': 'ツールバーの前のツールに切り替え',
+ 'Next Instrument / Tool': '次のツール',
+ 'Switch to the next instrument on the tool bar': 'ツールバーの次のツールに切り替え',
+ 'Previous Sub Tool Group': '前のサブツールグループ',
+ 'Switch to the previous sub tool group tab': '前のサブツールグループタブに切り替え',
+ 'Next Sub Tool Group': '次のサブツールグループ',
+ 'Switch to the next sub tool group tab': '次のサブツールグループタブに切り替え',
+ 'Decrease Brush Size': 'ブラシサイズを小さく',
+ 'Step brush diameter down': 'ブラシサイズを1段階小さくする',
+ 'Increase Brush Size': 'ブラシサイズを大きく',
+ 'Step brush diameter up': 'ブラシサイズを1段階大きくする',
+ 'Swap Colors': '描画色と背景色を入れ替え',
+ 'Swap primary and secondary colors': 'メインカラーとサブカラーを入れ替え',
+ 'Default Colors': '描画色を初期設定に戻す',
+ 'Reset primary/secondary colors to black & white': 'メインカラーを黒、サブカラーを白にリセット',
+ 'Transparent Ink Mode': '透明色モード切替',
+ 'Toggle drawing with transparent color': '透明色での描画(消しゴム化)を切り替え',
+ 'New Canvas': '新規キャンバス',
+ 'Create a new document': '新しいドキュメントを作成',
+ 'Open File': 'ファイルを開く',
+ 'Open image, PSD, or CSP file': '画像、PSD、またはCSPファイルを開く',
+ 'Save': '保存',
+ 'Save active document': '現在のドキュメントを保存',
+ 'Save As': '別名で保存',
+ 'Save document to a new file': '別のファイル名で保存',
+ 'Open application preferences': '環境設定ダイアログを開く',
+ 'Toggle Palettes': 'パレットの表示/非表示',
+ 'Show or hide docked UI palettes': 'ドッキングされたパレットの表示を切り替え',
+ 'Toggle Quick Brush Panel': 'クイックブラシパネル切替',
+ 'Show or hide the floating Quick-Access Brush Panel':
+ 'フローティングのクイックブラシパネルの表示を切り替え',
+ 'Toggle Left Panel': '左パネルの表示/非表示',
+ 'Show or hide the left tool panel': '左側のツールパネルの表示を切り替え',
+ 'Toggle Soft Proof': 'カラープロファイルプレビュー切替',
+ 'Preview CMYK/print soft proofing': 'CMYK・印刷向けのソフトプルーフを切り替え',
+ 'Toggle Gamut Warning': '色域外警告切替',
+ 'Highlight out-of-gamut colors': '印刷色域外の色をハイライト表示',
+ 'Toggle Animation Timeline': 'タイムライン表示切替',
+ 'Show or hide frame animation timeline': 'アニメーションタイムラインの表示を切り替え',
+ 'Add Animation Cel': '新規アニメーションセル',
+ 'Insert a new animation cel at current frame': '現在のフレームに新しいアニメーションセルを追加',
+ 'Zoom In': 'ズームイン',
+ 'Increase canvas magnification': 'キャンバスを拡大表示',
+ 'Zoom Out': 'ズームアウト',
+ 'Decrease canvas magnification': 'キャンバスを縮小表示',
+ 'Reset Zoom & Fit': '全体表示(フィッティング)',
+ 'Fit and center canvas in viewport': 'キャンバスをビューポートに合わせて中央表示',
+ 'Reset Zoom to 100%': '100%表示',
+ 'Reset canvas zoom level to 100% (actual pixels)': '表示倍率を100%(等倍)にリセット',
+ 'Reset Rotation': '回転をリセット',
+ 'Reset canvas angle to 0 deg': 'キャンバスの回転角度を0°にリセット',
+ 'Flip View Horizontally': '表示を左右反転',
+ 'Non-destructive horizontal canvas mirror': 'キャンバスデータを変更せず表示のみ左右反転',
+ 'Flip View Vertically': '表示を上下反転',
+ 'Non-destructive vertical canvas mirror': 'キャンバスデータを変更せず表示のみ上下反転',
+ 'Value Check (Live B/W)': '明度チェック(白黒表示)',
+ '1-click non-destructive live B/W tonal value check on main canvas':
+ 'メインキャンバスを非破壊でリアルタイム白黒表示して明度を確認',
+ 'Cycle Navigator B/W / Split View': 'ナビゲーター白黒/分割表示切替',
+ 'Cycle Navigator preview between Color, Live B/W, and Color | B/W Split View':
+ 'ナビゲーター表示を「カラー」「白黒」「カラー|白黒分割」で切り替え',
+ 'Straight Ruler': '直線定規',
+ 'Toggle interactive straight ruler overlay': '直線定規オーバーレイの表示を切り替え',
+ 'Toggle Perspective Ruler': 'パース定規の表示切替',
+ 'Add or toggle 2-point perspective ruler': '2点透視パース定規を追加または表示切替',
+ 'Toggle Perspective Snapping': 'パース定規へのスナップ切替',
+ 'Enable or disable brush snapping to perspective guides':
+ 'パース定規ガイドへのブラシスナップを有効/無効化',
+ 'New Raster Layer': '新規ラスターレイヤー',
+ 'Add transparent raster layer': '透明なラスターレイヤーを追加',
+ 'Duplicate Layer': 'レイヤーを複製',
+ 'Clone active layer': '現在のレイヤーを複製',
+ 'Group Selected Layers': '選択レイヤーをフォルダー化',
+ 'Place selected layers in a folder': '選択中のレイヤーをフォルダーにまとめる',
+ 'Undo': '元に戻す',
+ 'Undo last canvas action': '直前の操作を取り消す',
+ 'Redo': 'やり直す',
+ 'Redo previously undone action': '取り消した操作をやり直す',
+ 'Cut': '切り取り',
+ 'Cut active selection or layer to clipboard': '選択範囲またはレイヤーをクリップボードに切り取り',
+ 'Copy': 'コピー',
+ 'Copy active selection or layer to clipboard': '選択範囲またはレイヤーをクリップボードにコピー',
+ 'Paste': '貼り付け',
+ 'Paste clipboard contents into a new layer': 'クリップボードの内容を新規レイヤーとして貼り付け',
+ 'Move Selection to New Layer': '選択範囲を新規レイヤーへ移動',
+ 'Cut selected section and paste into a new layer':
+ '選択部分を切り取って新しいレイヤーに貼り付け',
+ 'Clear / Delete Layer': '消去/レイヤー削除',
+ 'Clear active selection or delete selected layer': '選択範囲を消去、または選択中のレイヤーを削除',
+ 'Free Transform': '自由変形',
+ 'Scale, rotate, or move layer/selection': 'レイヤーや選択範囲の拡大・縮小・回転・移動',
+ 'Puppet Warp': 'パペットワープ',
+ 'Place joint pins to smoothly bend limbs, tilt head, or adjust folds':
+ 'ピンを打って手足の曲げや顔の傾き、衣類のしわを滑らかに変形',
+ 'Cage Transform': 'ケージ変形',
+ 'Warp artwork smoothly inside an editable polygon cage':
+ '編集可能な多角形ケージ内で画像を滑らかにワープ変形',
+ 'Select All': 'すべて選択',
+ 'Select entire canvas': 'キャンバス全体を選択',
+ 'Deselect': '選択を解除',
+ 'Clear current selection marquee': '現在の選択範囲を解除',
+ 'Invert Selection': '選択範囲を反転',
+ 'Invert active selection mask': '現在の選択範囲マスクを反転',
+ 'Invert Colors': '階調の反転',
+ 'Invert pixel colors on active raster layer': 'アクティブなラスターレイヤーの色を反転',
+ 'Hue / Saturation': '色相・彩度・明度',
+ 'Open Hue & Saturation tonal correction': '色相・彩度・明度の色調補正を開く',
+ 'Group: {name}': 'グループ: {name}',
+ 'Open custom sub tool group "{name}" ({count} sub tool)':
+ 'カスタムサブツールグループ「{name}」を開く({count}個のサブツール)',
+ 'Open custom sub tool group "{name}" ({count} sub tools)':
+ 'カスタムサブツールグループ「{name}」を開く({count}個のサブツール)',
+ 'Directly open custom sub tool "{name}" (hold > 250ms for temporary switch)':
+ 'カスタムサブツール「{name}」を直接開く(250ms以上長押しで一時切り替え)',
+ 'Directly open {name} sub tool (hold > 250ms for temporary switch)':
+ 'サブツール「{name}」を直接開く(250ms以上長押しで一時切り替え)',
+
+ // =========================================================================
+ // Settings Modal — Modifier Keys Tab
+ // =========================================================================
+ 'Modifier Key Settings': '修飾キー設定',
+ 'Configure hold-to-act keys, mouse buttons, stylus barrel buttons, and scroll wheel':
+ '長押しキー、マウスボタン、ペンサイドスイッチ、マウスホイールの動作を設定します',
+ 'Modifier keys reset to defaults': '修飾キー設定を初期設定に戻しました',
+ 'Mouse Wheel': 'マウスホイール',
+ 'Action when scrolling wheel over the canvas viewport': 'キャンバス上でホイールを回したときの動作',
+ 'Pan / Hand Tool': '手のひらツール(移動)',
+ 'Rotate Canvas': 'キャンバス回転',
+ 'Scrubby Zoom Drag': 'スクラブズーム(ドラッグ拡大縮小)',
+ 'Eyedropper (Sample Color)': 'スポイト(色取得)',
+ 'Brush Size & Hardness Drag': 'ブラシサイズ・硬さ調整ドラッグ',
+ 'Straight Line / Angle Snap': '直線描画/角度スナップ',
+ 'Temporary Eraser': '一時消しゴム',
+ 'Quick Palette Popover': 'クイックパレット表示',
+ 'Swap Primary / Secondary Color': 'メイン/サブカラー入替',
+ 'Zoom In / Out': 'ズームイン/アウト',
+ 'Scroll / Pan Canvas': 'キャンバスをスクロール/移動',
+ 'Adjust Brush Size': 'ブラシサイズ変更',
+ 'Space + Drag': 'Space + ドラッグ',
+ 'Hold Space while dragging on canvas': 'Spaceキーを押しながらキャンバスをドラッグ',
+ 'Shift': 'Shift',
+ 'Hold Shift while clicking or dragging': 'Shiftキーを押しながらクリック/ドラッグ',
+ 'Ctrl': 'Ctrl',
+ 'Hold Ctrl / Cmd while clicking or dragging': 'Ctrl / Cmdキーを押しながらクリック/ドラッグ',
+ 'Alt': 'Alt',
+ 'Hold Alt while clicking or hovering': 'Altキーを押しながらクリック/ホバー',
+ 'Ctrl + Space + Drag': 'Ctrl + Space + ドラッグ',
+ 'Hold Ctrl + Space and drag': 'Ctrl + Spaceを押しながらドラッグ',
+ 'Shift + Space + Drag': 'Shift + Space + ドラッグ',
+ 'Hold Shift + Space and drag': 'Shift + Spaceを押しながらドラッグ',
+ 'Ctrl + Alt + Drag': 'Ctrl + Alt + ドラッグ',
+ 'Interactive brush size (horizontal) & hardness (vertical)':
+ '左右ドラッグでブラシサイズ、上下ドラッグで硬さを調整',
+ 'Shift + Alt + Drag': 'Shift + Alt + ドラッグ',
+ 'Alternate brush size / modifier drag combo': '予備のブラシサイズ/修飾ドラッグ割り当て',
+ 'Right Click': '右クリック',
+ 'Secondary mouse button on canvas': 'キャンバス上での右クリック',
+ 'Middle Click': '中クリック',
+ 'Middle mouse button / wheel press': 'マウスの中ボタン/ホイール押し込み',
+ 'Stylus Barrel Button 1': 'ペンサイドスイッチ 1',
+ 'Lower stylus side button (or mouse side btn 1)': 'スタイラスの下側ボタン(またはマウス戻るボタン)',
+ 'Stylus Barrel Button 2': 'ペンサイドスイッチ 2',
+ 'Upper stylus side button (or mouse side btn 2)': 'スタイラスの上側ボタン(またはマウス進むボタン)',
+
+ // =========================================================================
+ // Settings Modal — About & Updates Tab + Community Links (SocialIcons.tsx)
+ // =========================================================================
+ 'v{version} · Collaborative Drawing Studio · by Sora':
+ 'v{version} · 共同制作対応ペイントスタジオ · by Sora',
+ 'Updates': 'アップデート',
+ 'Keep Ink Studio up to date with the latest desktop releases':
+ 'Ink Studioを最新のデスクトップリリースに保ちます',
+ 'Current version: v{version}': '現在のバージョン: v{version}',
+ 'Checking for updates...': 'アップデートを確認中...',
+ 'Up to date': '最新バージョンです',
+ 'Update v{version} available': 'アップデート v{version} が利用可能です',
+ 'Downloading update... {percent}%': 'アップデートをダウンロード中... {percent}%',
+ 'Update ready — restarting...': 'アップデートの準備完了 — 再起動しています...',
+ 'Failed to check for updates': 'アップデートの確認に失敗しました',
+ 'Check for Updates': 'アップデートを確認',
+ 'View Update': '詳細を表示',
+ 'View Progress': '進捗を表示',
+ 'Automatically check for updates on startup': '起動時にアップデートを自動確認する',
+ 'What\'s New in v{version}': 'v{version} の新機能',
+ 'Collaborative Drawing Studio supporting layered PSD/CSP workflows, GPU tile compositing, stylus pressure dynamics, vector inking, and real-time multiplayer drawing.':
+ 'レイヤーPSD/CSPワークフロー、GPUタイル合成、筆圧ダイナミクス、ベクターペン入れ、リアルタイム共同制作に対応したデジタルイラスト・漫画制作スタジオです。',
+ 'Discord': 'Discord',
+ 'Discord Community': 'Discord コミュニティ',
+ 'Join Ink Studio on Discord': 'Ink Studio の Discord に参加',
+ 'X (Twitter)': 'X (Twitter)',
+ 'Follow @inkstudio_app on X (Twitter)': 'X (Twitter) で @inkstudio_app をフォロー',
+ 'GitHub': 'GitHub',
+ 'GitHub Repository': 'GitHub リポジトリ',
+ 'Ink Studio on GitHub': 'GitHub で Ink Studio を見る',
+ 'Website': '公式サイト',
+ 'Ink Studio Website': 'Ink Studio 公式サイト',
+ 'Visit Ink Studio Website': 'Ink Studio 公式サイトを開く',
+
+ // =========================================================================
+ // Appearance Studio Drawer, Look Presets, Pigments & Theme Engine
+ // =========================================================================
+ 'Appearance Studio': '外観スタジオ',
+ 'Appearance categories': '外観カテゴリー',
+ 'Surface': 'サーフェス',
+ 'Chrome': 'クローム',
+ 'Controls': '操作パーツ',
+ 'Workspace': 'ワークスペース',
+ 'Workspace & Bars': 'ワークスペース・バー',
+
+ // Look Presets & Descriptions
+ 'Graphite Atelier': 'グラファイト・アトリエ',
+ 'Neutral charcoal dark studio calibrated for color-accurate painting':
+ '正確な色判断のために調整されたニュートラルなチャコールダークテーマ',
+ 'Obsidian OLED': 'オブシディアン OLED',
+ 'Deep low-glare neutral dark surfaces for late-night sessions':
+ '夜間作業でも目に優しい深みのある低反射ダークサーフェス',
+ 'Studio Neutral 18': 'スタジオニュートラル 18%',
+ 'Studio Neutral 18%': 'スタジオニュートラル 18%',
+ 'Achromatic mid-grey studio tone for unbiased value and color judgment':
+ '明度や彩度の錯覚を抑える無彩色ミドルグレー(18%)の基準環境',
+ 'Warm Paper Light': 'ウォームペーパー(ライト)',
+ 'Low-glare cotton drafting paper for comfortable daylight work':
+ '日中作業に心地よい、まぶしさを抑えたコットン画用紙調ライトテーマ',
+ 'Daylight Crisp': 'デイライト・クリスプ',
+ 'High-clarity neutral daylight studio with refined machined contrast':
+ '明瞭なコントラストを備えたニュートラルな昼光色ライトスタジオ',
+ 'Sumi Sepia': '墨セピア',
+ 'Warm ink-stone dark atelier with subtle organic tone':
+ '硯の墨のような温かみのあるダークアトリエテーマ',
+
+ // Accent Pigments & Modern Accents
+ 'Accent Pigment': 'アクセントカラー',
+ 'Neutral Graphite': 'ニュートラル・グラファイト',
+ 'Strictly achromatic monochrome accent for zero color bias':
+ '色覚への影響を完全に排除する無彩色モノクロアクセント',
+ 'Vermilion Seal': '朱印',
+ 'Restrained cinnabar stamp pigment': '落ち着いた落款・朱肉調のアクセント',
+ 'Prussian Blue': 'プルシアンブルー',
+ 'Composed architectural studio blue': '知性的で落ち着いたスタジオブルー',
+ 'Matcha Celadon': '抹茶青磁',
+ 'Calm mineral botanical green': '目に優しい穏やかなボタニカルグリーン',
+ 'Yellow Ochre': '黄土(イエローオーカー)',
+ 'Warm earth dial amber': '温かみのあるアースアンバー',
+ 'Smoked Plum': 'スモークプラム',
+ 'Muted mineral violet pigment': 'くすみのある落ち着いたバイオレット',
+ 'Neutral': 'ニュートラル',
+ 'Vermilion': '朱色',
+ 'Prussian': 'プルシャンブルー',
+ 'Matcha': '抹茶',
+ 'Ochre': '黄土',
+ 'Plum': 'プラム',
+ 'Blue': 'ブルー',
+ 'Green': 'グリーン',
+ 'Orange': 'オレンジ',
+ 'Purple': 'パープル',
+ 'Burgundy': 'バーガンディ',
+
+ // Curated Appearance Mixes
+ 'Kyoto Sumi': '京都・墨',
+ 'Architect Slate': 'アーキテクト・スレート',
+ 'Botanical Linen': 'ボタニカル・リネン',
+ 'Nocturne Ochre': 'ノクターン・オーカー',
+ 'Calibration 18%': 'キャリブレーション 18%',
+ 'Gallery Daylight': 'ギャラリー・デイライト',
+ 'Smoked Atelier': 'スモークド・アトリエ',
+ 'Washi Seal': '和紙・朱印',
+ 'Midnight Celadon': 'ミッドナイト青磁',
+ 'Drafting Ochre': '製図オーカー',
+
+ // Appearance Controls, Sliders, Matte, Chrome, Typography, Tokens & Sharing
+ 'Drag to float Appearance Studio over canvas': 'ドラッグして外観スタジオをキャンバス上にフロート表示',
+ 'Drag to move · Double-click to re-dock right': 'ドラッグで移動 · ダブルクリックで右端に再ドック',
+ 'Dock to Right Edge': '右端にドッキング',
+ 'Close Appearance Studio (Esc)': '外観スタジオを閉じる (Esc)',
+ 'Undo last tweak ({count} available)': '直前の変更を戻す(残り {count} 回)',
+ 'No tweaks to undo yet': '戻せる変更はまだありません',
+ 'Compare': '比較',
+ 'Original': '変更前',
+ 'Hold to temporarily compare with original look': '長押しで変更前の外観と一時的に比較',
+ 'Mix': 'ミックス',
+ 'Cycle curated harmonious look combinations': '厳選された調和テーマの組み合わせを順に切り替え',
+ 'Look Mix: {name}': 'テーマミックス: {name}',
+ 'Reset appearance to Graphite Atelier defaults': '外観をグラファイト・アトリエの初期状態に戻す',
+ 'Appearance reset to Graphite Atelier': '外観を「グラファイト・アトリエ」にリセットしました',
+ 'Surface Brightness': 'サーフェス明度',
+ 'Contrast & Seams': 'コントラスト・境界線',
+ 'Surface Warmth': '色温度(暖色/寒色)',
+ 'Cool Slate': '寒色スレート',
+ 'Neutral 0': 'ニュートラル 0',
+ 'Warm Sumi': '暖色・墨',
+ 'Snap surface tint to strictly achromatic neutral 0': '色味を完全な無彩色(ニュートラル 0)にスナップ',
+ '{n} Cool': '{n} 寒色',
+ '+{n} Warm': '+{n} 暖色',
+ 'Canvas Surround (Matte)': 'キャンバス周辺マット',
+ 'Canvas Surround Matte': 'キャンバス周辺マット',
+ 'Linked': '連動',
+ 'Follow active look surface luminance': '現在の外観プリセットの明度に連動',
+ 'Neutral dark charcoal matte (#161616)': 'ニュートラルなダークチャコールマット (#161616)',
+ 'Mid 18%': '中間18%',
+ '18% neutral grey matte for value judgment (#757575)': '明度判定用の18%ニュートラルグレーマット (#757575)',
+ 'Neutral light matte (#d4d4d4)': 'ニュートラルなライトマット (#d4d4d4)',
+ 'Custom surround hex color': '任意のHEXカラーを指定',
+ 'Pick Custom Canvas Matte Color': 'キャンバス周辺マット色を選択',
+ 'Custom Canvas Matte Hex': 'キャンバス周辺マットHEX値',
+ 'Pick Custom Accent Color': 'カスタムアクセントカラーを選択',
+ 'Custom Accent Pigment': 'カスタムアクセントカラー',
+ 'Custom Accent Hex': 'カスタムアクセントHEX値',
+ 'Panel Style': 'パネルスタイル',
+ 'Flat': 'フラット',
+ 'Hairline': 'ヘアライン',
+ 'Islands': 'アイランド',
+ 'Corner Radius': '角の丸み',
+ 'Border Crispness': '枠線の鮮明さ',
+ 'Floating Panel Opacity': 'フローティングパネル不透明度',
+ 'Interface Density': 'UI密度',
+ 'Compact': 'コンパクト',
+ 'Balanced': '標準',
+ 'Tablet': 'タブレット',
+ 'Typography': 'フォント・文字組み',
+ 'System': 'システム',
+ 'Humanist': 'ヒューマニスト',
+ 'Technical': 'テクニカル',
+ 'Icon Weight': 'アイコン線の太さ',
+ 'Thin 1.25': '細 1.25',
+ 'Regular 1.5': '標準 1.5',
+ 'Bold 1.85': '太 1.85',
+ 'Slider Style': 'スライダースタイル',
+ 'Bar Scrubber': 'バースクラバー',
+ 'Classic Track': 'クラシックトラック',
+ 'Brush List View': 'ブラシ一覧の表示',
+ 'Grid': 'グリッド',
+ 'Layer Thumbnails': 'レイヤーサムネイル',
+ 'Standard': '標準',
+ 'Large': '大',
+ 'Scrollbar Size': 'スクロールバーの幅',
+ 'Slim': 'スリム',
+ '5px minimalist scrollbar': '5pxの極細スクロールバー',
+ '9px balanced scrollbar': '9pxの標準スクロールバー',
+ 'Pen Display': '液タブ向け',
+ '13px stylus-friendly scrollbar': '13pxのペン操作しやすいスクロールバー',
+ '16px wide pen & touch scrollbar': '16pxの幅広ペン・タッチ向けスクロールバー',
+ 'Advanced & Share': '詳細トークン・テーマ共有',
+ 'WCAG Text Contrast': 'WCAG テキストコントラスト',
+ '· Muted {ratio}:1': '· 補助文字 {ratio}:1',
+ '{ratio}:1 Low': '{ratio}:1 低コントラスト',
+ 'Low contrast warning': '低コントラスト警告',
+ 'Custom Token Overrides': 'カスタムトークン上書き',
+ 'Clear all': 'すべてクリア',
+ 'Custom token overrides cleared': 'カスタムトークンの上書きを解除しました',
+ 'Canvas Matte': 'キャンバス周辺マット',
+ 'Panel Surface': 'パネル背景',
+ 'Control Surface': 'コントロール背景',
+ 'Border': '枠線',
+ 'Primary Text': 'メインテキスト',
+ 'Muted Text': '補助テキスト',
+ 'Accent': 'アクセント',
+ '{label} color picker': '{label} カラーピッカー',
+ '{label} color value': '{label} カラー値',
+ 'Reset {label}': '{label} をリセット',
+ 'Theme Sharing (.inktheme)': 'テーマの共有 (.inktheme)',
+ 'Export .inktheme': '.inktheme を書き出し',
+ 'Import .inktheme': '.inktheme を読み込み',
+ 'Copy Code': 'コードをコピー',
+ 'Paste Code': 'コードを貼り付け',
+ 'Paste Theme Code': 'テーマコードを貼り付け',
+ 'Paste INKTHEME1:... or JSON': 'INKTHEME1:... または JSON を貼り付け',
+ 'Ink Studio Theme': 'Ink Studio テーマ',
+ 'Save Theme As': 'テーマを別名で保存',
+ 'Exported {fileName}': '{fileName} を書き出しました',
+ 'Unable to export .inktheme file': '.inktheme ファイルの書き出しに失敗しました',
+ 'Theme code copied to clipboard': 'テーマコードをクリップボードにコピーしました',
+ 'Theme code ready to copy below': 'テーマコードを下部に生成しました',
+ 'Applied theme "{name}"': 'テーマ「{name}」を適用しました',
+ 'Applied theme "{name}" ({count} dial clamped)':
+ 'テーマ「{name}」を適用しました({count}項目を安全範囲内に補正)',
+ 'Imported theme "{name}"': 'テーマ「{name}」を読み込みました',
+ 'Imported theme "{name}" ({count} dial clamped)':
+ 'テーマ「{name}」を読み込みました({count}項目を安全範囲内に補正)',
+ 'Invalid theme code: {error}': '無効なテーマコード: {error}',
+ 'Import failed: {error}': '読み込みに失敗しました: {error}',
+ 'Failed to read .inktheme file': '.inktheme ファイルの読み込みに失敗しました',
+
+ // Theme Engine Validation Messages
+ 'Theme preset input is empty.': 'テーマプリセットが空です。',
+ 'Theme preset file exceeds maximum allowed size (64 KB).':
+ 'テーマプリセットのサイズが上限(64 KB)を超えています。',
+ 'Theme preset is not valid JSON.': 'テーマプリセットが有効なJSON形式ではありません。',
+ 'Theme preset root must be a JSON object.': 'テーマプリセットのルートはJSONオブジェクトである必要があります。',
+ 'Invalid theme format identifier. Expected "{expected}".':
+ 'テーマ形式IDが無効です。「{expected}」が必要です。',
+ 'Unsupported theme schema version: {version}. Expected version {expected}.':
+ '未対応のテーマスキーマバージョンです: {version}(対応バージョン: {expected})。',
+ 'Theme preset must include a non-empty "name" string.':
+ 'テーマプリセットには空でない "name" 文字列が必要です。',
+ 'Theme preset must include an "appearance" configuration object.':
+ 'テーマプリセットには "appearance" 設定オブジェクトが必要です。',
+ 'Invalid lookPreset "{value}".': '無効な lookPreset です: "{value}"。',
+ 'Invalid baseLookPreset "{value}".': '無効な baseLookPreset です: "{value}"。',
+ 'Invalid canvasMatteMode "{value}".': '無効な canvasMatteMode です: "{value}"。',
+ 'Invalid accent pigment "{value}".': '無効なアクセント設定です: "{value}"。',
+ 'Invalid cornerRadius "{value}".': '無効な cornerRadius です: "{value}"。',
+ 'Invalid chromeStyle "{value}".': '無効な chromeStyle です: "{value}"。',
+ 'Invalid density "{value}".': '無効な density です: "{value}"。',
+ 'Invalid fontProfile "{value}".': '無効な fontProfile です: "{value}"。',
+ 'Invalid iconStrokeWidth "{value}".': '無効な iconStrokeWidth です: "{value}"。',
+ 'Invalid sliderStyle "{value}".': '無効な sliderStyle です: "{value}"。',
+ 'Invalid brushListStyle "{value}".': '無効な brushListStyle です: "{value}"。',
+ 'Invalid layerThumbSize "{value}".': '無効な layerThumbSize です: "{value}"。',
+ 'Invalid scrollbarSize "{value}".': '無効な scrollbarSize です: "{value}"。',
+ 'Field "{field}" must be a finite number.': '項目 "{field}" は有限の数値である必要があります。',
+ 'Clamped "{field}" from {val} into [{min}, {max}].':
+ '項目 "{field}" の値 {val} を [{min}, {max}] の範囲内に収めました。',
+ 'Field "canvasMatteCustomHex" must be a valid hex color.':
+ '項目 "canvasMatteCustomHex" は有効なHEXカラーである必要があります。',
+ 'Field "customAccentHex" must be a valid hex color.':
+ '項目 "customAccentHex" は有効なHEXカラーである必要があります。',
+ 'Field "tokenOverrides" must be a plain key-value object.':
+ '項目 "tokenOverrides" はキーと値のオブジェクトである必要があります。',
+ 'Unknown or non-overridable token key "{key}".':
+ '未知または上書き不可のトークンキーです: "{key}"。',
+ 'Invalid or unsafe color value for token "{key}".':
+ 'トークン "{key}" に無効または安全でないカラー値が指定されています。',
+ 'Theme code input must be a string.': 'テーマコードは文字列である必要があります。',
+ 'Theme code is empty.': 'テーマコードが空です。',
+ 'Theme code exceeds maximum allowed size (64 KB).':
+ 'テーマコードのサイズが上限(64 KB)を超えています。',
+ 'Theme code is corrupted or not valid base64.':
+ 'テーマコードが破損しているか、有効なBase64ではありません。',
+ 'Unrecognized theme code. Expected "{prefix}..." or .inktheme JSON.':
+ '認識できないテーマコードです。「{prefix}...」または .inktheme JSON を入力してください。',
+
+ // =========================================================================
+ // Workspace & Bars Tab (WorkspaceAndBarsTab.tsx & workspace.ts)
+ // =========================================================================
+ 'Ink Studio Workspace': 'Ink Studio ワークスペース',
+ 'Save Workspace As': 'ワークスペースを別名で保存',
+ 'Workspace Archetypes': 'ワークスペース構成',
+ 'Reset current workspace to factory preset defaults':
+ '現在のワークスペースを初期プリセット状態にリセット',
+ 'Workspace reset to preset defaults': 'ワークスペースを初期配置にリセットしました',
+ 'Workspace: {name}': 'ワークスペース: {name}',
+ 'Atelier Default': 'アトリエ標準',
+ 'Default Illustration': 'イラスト(標準)',
+ 'Balanced Atelier layout with brushes left & color/layers right':
+ '左にブラシ、右にカラー・レイヤーを配置したバランスの良い標準レイアウト',
+ 'Photoshop Studio': 'Photoshop 風',
+ 'Slim left tool rail, right Color/Brushes/Layers stack & top Options Bar':
+ '左にスリムなツールバー、右にカラー・ブラシ・レイヤー、上部にオプションバーを配置',
+ 'Clip Studio': 'CLIP STUDIO 風',
+ 'Classic CSP SubTool / Property / Size left + Navigator / Color / Layers right':
+ '左にサブツール・プロパティ・サイズ、右にナビゲーター・カラー・レイヤーを配置した定番構成',
+ 'Manga Studio': '漫画制作',
+ 'Inking-first panels with dedicated Quick Access & Brush Size stack':
+ 'クイックアクセスとブラシサイズを常設したペン入れ重視の漫画向けレイアウト',
+ 'Minimalist Tablet': 'ミニマル(液タブ向け)',
+ 'Collapsed icon rails for maximum pen-display canvas space':
+ 'アイコンバー格納でキャンバス領域を最大化する液タブ向けレイアウト',
+ 'Left-Handed Mirror': '左手用ミラー配置',
+ 'Swaps left & right docks + floating brush HUD edge':
+ '左右のドックとフローティングブラシHUDの位置を反転します',
+ 'Left-Handed Workspace Mirror: ON': '左手用ミラー配置: ON',
+ 'Left-Handed Workspace Mirror: OFF': '左手用ミラー配置: OFF',
+ 'LH': '左手',
+ 'Palette Locks': 'パレットロック',
+ 'Lock All': 'すべてロック',
+ 'Unlock All': 'すべて解除',
+ 'All palette locks enabled': 'すべてのパレットをロックしました',
+ 'All palette locks disabled': 'すべてのパレットロックを解除しました',
+ 'Lock Width': '幅をロック',
+ 'Freeze dock column & side-by-side split widths': 'ドック列や左右分割の幅を固定します',
+ 'Lock Height': '高さをロック',
+ 'Freeze stacked row & bottom dock heights': '縦積みパネルや下部ドックの高さを固定します',
+ 'Lock Position / Move': '位置・移動をロック',
+ 'Prevent accidental tab dragging or panel undocking': '意図しないタブのドラッグや分離を防止します',
+ 'Saved Workspaces': '保存済みワークスペース',
+ '{count} saved': '{count}件保存済み',
+ 'New Workspace Name': '新しいワークスペース名',
+ 'e.g. Lineart, Coloring, 3D...': '例: ペン入れ、着彩、3D...',
+ 'Include active Appearance preset': '現在の外観テーマも一緒に保存',
+ 'Includes bundled Appearance theme': '外観テーマ同梱',
+ 'Saved workspace "{name}"': 'ワークスペース「{name}」を保存しました',
+ 'Saved workspace "{name}" (+ Appearance)': 'ワークスペース「{name}」(外観テーマ含む)を保存しました',
+ 'Loaded workspace "{name}"': 'ワークスペース「{name}」を読み込みました',
+ 'Renamed workspace to "{name}"': 'ワークスペース名を「{name}」に変更しました',
+ 'Deleted workspace "{name}"': 'ワークスペース「{name}」を削除しました',
+ 'Rename "{name}"': '「{name}」の名前を変更',
+ 'Export "{name}" as .inkworkspace': '「{name}」を .inkworkspace として書き出し',
+ 'Delete "{name}"': '「{name}」を削除',
+ 'Export .inkworkspace': '.inkworkspace を書き出し',
+ 'Import .inkworkspace': '.inkworkspace を読み込み',
+ 'Unable to export .inkworkspace file': '.inkworkspace ファイルの書き出しに失敗しました',
+ 'Imported workspace "{name}"': 'ワークスペース「{name}」を読み込みました',
+ 'Imported workspace "{name}" (+ Appearance)':
+ 'ワークスペース「{name}」(外観テーマ含む)を読み込みました',
+ 'Failed to read .inkworkspace file': '.inkworkspace ファイルの読み込みに失敗しました',
+ 'Focus Mode (Tab)': 'フォーカスモード (Tab)',
+ 'Toggle live Focus Mode preview': 'フォーカスモードのライブプレビューを切り替え',
+ 'Preview Focus': 'プレビュー',
+ 'Exit Focus': 'フォーカス終了',
+ 'Focus Mode Preview: ON (Tab to exit)': 'フォーカスモードプレビュー: ON(Tabで終了)',
+ 'Focus Mode Preview: OFF': 'フォーカスモードプレビュー: OFF',
+ 'Atelier HUD': 'アトリエ HUD',
+ 'Pure Canvas': 'ピュアキャンバス',
+ 'Focus Mode Preset: Atelier HUD': 'フォーカスモードプリセット: アトリエHUD',
+ 'Focus Mode Preset: Pure Canvas': 'フォーカスモードプリセット: ピュアキャンバス',
+ 'Brush Sliders HUD': 'ブラシスライダー HUD',
+ 'Quick Action Dock': 'クイックアクションドック',
+ 'Floating Color Wheel': 'フローティングカラーサークル',
+ 'Floating Tool Rail': 'フローティングツールバー',
+ 'Keep Quick Brush Panel': 'クイックブラシパネルを残す',
+ 'Hide Top Header Bar': '上部ヘッダーバーを隠す',
+ 'Auto-Fade While Drawing': '描画中に自動で薄く表示',
+ 'Dims floating HUDs during active strokes': 'ストローク描画中にフローティングHUDを半透明にします',
+ 'Reset HUD Positions': 'HUD の位置をリセット',
+ 'Focus HUD positions reset': 'フォーカス HUD の位置をリセットしました',
+ 'Bars & Chrome': 'バーとUI表示',
+ 'Contextual Tool Options Bar': 'ツールオプションバー',
+ 'Command Bar': 'コマンドバー',
+ 'Document Tab Bar': 'ドキュメントタブバー',
+ 'Status Bar': 'ステータスバー',
+ 'Quick-Access Brush Panel': 'クイックブラシパネル',
+ 'Status Bar Modules': 'ステータスバー項目',
+ 'Show all': 'すべて表示',
+ 'Tool & Stabilization': 'ツール・手ブレ補正',
+ 'Canvas Size & Color Mode': 'キャンバスサイズ・表現色',
+ 'Value Check (B/W) Toggle': '明度チェック(白黒)切替',
+ 'Stylus Pressure Meter': '筆圧メーター',
+ 'Rotation & Zoom Readout': '回転角・ズーム倍率',
+
+ // =========================================================================
+ // Performance Settings Tab & Performance Manager
+ // =========================================================================
+ 'Automatic Settings': '自動最適化',
+ 'Automatically tuned for your hardware: {summary}':
+ 'お使いの環境に自動調整済み: {summary}',
+ 'Custom settings active. Turn on to let Ink Studio tune RAM, GPU, and caches automatically.':
+ '手動設定が有効です。オンにするとRAM・GPU・キャッシュを環境に合わせて自動調整します。',
+ 'Automatic performance settings': 'パフォーマンス自動最適化',
+ 'Automatic optimization enabled ({summary})': '自動最適化を有効にしました({summary})',
+ 'Switched to "{mode}" mode': '「{mode}」モードに切り替えました',
+ 'Max Performance': '最大パフォーマンス',
+ 'Battery Saver': '省電力',
+ 'CPU Safe Mode': 'CPUセーフモード',
+ 'Battery': '省電力',
+ 'CPU Safe': 'CPUセーフ',
+ '{ram} RAM': 'RAM {ram}',
+ '{count} threads': '{count}スレッド',
+ 'Detecting...': '検出中...',
+ 'Refresh hardware & memory telemetry': 'ハードウェア・メモリ情報を再取得',
+ 'Memory Usage (Max RAM)': 'メモリ使用量(最大RAM)',
+ 'Maximum RAM in MB': '最大RAM割り当て (MB)',
+ 'Ideal range: {min} – {max}': '推奨範囲: {min} 〜 {max}',
+ 'Ideal: {min} – {max}': '推奨: {min} 〜 {max}',
+ 'RAM allocation percentage': 'RAM割り当て率',
+ 'Above 70% of system RAM may slow down other apps.':
+ 'システムRAMの70%を超えると他のアプリの動作が重くなる場合があります。',
+ 'In use: {tileMb} MB tiles · {undoSteps} undo · ~{vramMb} MB VRAM':
+ '使用中: タイル {tileMb} MB · 履歴 {undoSteps}回 · VRAM 約{vramMb} MB',
+ 'Measuring memory usage...': 'メモリ使用量を計測中...',
+ 'Offload inactive tiles & undo states and flush GPU texture cache':
+ '非アクティブなタイルと履歴を退避し、GPUテクスチャキャッシュを解放します',
+ 'Free Memory': 'メモリを解放',
+ '{mb} MB tiles': 'タイル {mb} MB',
+ '{n} undo steps': '履歴 {n}回分',
+ 'GPU cache': 'GPUキャッシュ',
+ '{mb} MB scratch': '仮想記憶 {mb} MB',
+ 'Freed {items}': '{items} を解放しました',
+ 'Memory caches are already clean': 'メモリキャッシュはすでに十分な空きがあります',
+ 'Graphics & Rendering': 'グラフィックス・描画',
+ 'Auto (GPU)': '自動 (GPU)',
+ 'WebGL2 GPU': 'WebGL2 GPU',
+ 'Canvas 2D (CPU)': 'Canvas 2D (CPU)',
+ 'Graphics Card': 'グラフィックボード',
+ 'Graphics Card Preference': '使用するGPUの優先設定',
+ 'High-Performance (Dedicated)': '高パフォーマンス(専用GPU)',
+ 'Power-Saving (Integrated)': '省電力(内蔵GPU)',
+ 'Graphics Adapter': 'グラフィックアダプター',
+ 'Dedicated': '専用GPU',
+ 'Integrated': '内蔵GPU',
+ 'Software': 'ソフトウェア',
+ 'GPU': 'GPU',
+ 'Restart Ink Studio to apply the OS-level GPU preference.':
+ 'OSレベルのGPU優先設定を反映するにはInk Studioの再起動が必要です。',
+ 'Restart': '再起動',
+ 'Restart failed: {message}': '再起動に失敗しました: {message}',
+ 'Please restart Ink Studio manually': 'Ink Studioを手動で再起動してください',
+ 'Advanced Settings': '詳細設定',
+ 'VRAM Cache, HiDPI, Undo, CPU Threads & Scratch Disk':
+ 'VRAMキャッシュ・HiDPI・履歴・CPUスレッド・仮想記憶ディスク',
+ 'GPU & Display': 'GPU・ディスプレイ',
+ 'GPU Brush Acceleration': 'GPUブラシアクセラレーション',
+ 'Baked Layer Stack Cache': 'レイヤースタックキャッシュ',
+ 'GPU Tile Cache (VRAM)': 'GPUタイルキャッシュ (VRAM)',
+ 'Low (32 MB)': '低 (32 MB)',
+ 'Balanced (64 MB)': '標準 (64 MB)',
+ 'High (128 MB)': '高 (128 MB)',
+ 'Ultra (256 MB)': '最高 (256 MB)',
+ '{count} slices': '{count} スライス',
+ 'Viewport Resolution (HiDPI)': 'ビューポート解像度 (HiDPI)',
+ 'Viewport Resolution Scaling': 'ビューポート解像度スケーリング',
+ 'Native Display DPI': 'ネイティブDPI(等倍)',
+ 'Capped 2× (Recommended)': '最大2×(推奨)',
+ 'Standard 1× (High FPS)': '標準 1×(高FPS)',
+ 'Performance 0.75×': '軽量 0.75×',
+ 'Zoom Texture Filtering': 'ズーム時のテクスチャ補間',
+ 'Canvas Texture Filtering': 'キャンバステクスチャ補間',
+ 'Auto (Crisp ≥200%)': '自動(200%以上でシャープ)',
+ 'Always Smooth': '常に滑らか(バイリニア)',
+ 'Always Sharp (Nearest)': '常にシャープ(ニアレスト)',
+ 'Desktop Graphics API': 'デスクトップ描画API',
+ 'Desktop Graphics API (ANGLE)': 'デスクトップ描画API (ANGLE)',
+ 'Auto (OS Default)': '自動(OS標準)',
+ 'WARP (Software)': 'WARP(ソフトウェア)',
+ 'Undo & Multi-Document Memory': '取り消し履歴・マルチドキュメントメモリ',
+ 'Undo History Limit': '取り消し回数の上限',
+ 'In-RAM Undo Steps': 'RAM内保持の履歴数',
+ 'In-RAM undo steps': 'RAM内保持の履歴数',
+ '{n} steps': '{n}回',
+ 'Offload Inactive Document Tabs': '非アクティブなタブをメモリから退避',
+ 'Granular Cache Purge': 'キャッシュの個別解放',
+ 'Tiles': 'タイル',
+ '3D & CPU': '3D・CPU処理',
+ '3D Preview Resolution': '3Dプレビュー解像度',
+ '3D Preview Resolution Cap': '3Dプレビュー解像度上限',
+ 'CPU Worker Threads': 'CPUワーカースレッド数',
+ 'CPU worker threads': 'CPUワーカースレッド数',
+ 'Auto ({cores})': '自動 ({cores})',
+ 'Native Rust Acceleration': 'ネイティブRust高速化',
+ 'Scratch Disk': '仮想記憶ディスク',
+ 'System Temp': 'システム一時フォルダー',
+ 'Browser In-Memory (IndexedDB / LZ4)': 'ブラウザー内メモリ(IndexedDB / LZ4)',
+ ' · {size} free': ' · 空き {size}',
+ 'Custom folder (optional, e.g. secondary SSD)': '任意のフォルダー(例: サブSSDなど)',
+ 'Unable to validate scratch disk directory': '仮想記憶ディスクのフォルダーを確認できませんでした',
+ 'Scratch disk location updated': '仮想記憶ディスクの場所を更新しました',
+ 'Scratch disk reset to system temporary folder':
+ '仮想記憶ディスクをシステムの一時フォルダーに戻しました',
+ 'Scratch Compression': '仮想記憶の圧縮方式',
+ 'Scratch Disk Compression': '仮想記憶ディスクの圧縮方式',
+ 'LZ4 Fast (Recommended)': 'LZ4 高速圧縮(推奨)',
+ 'Uncompressed': '無圧縮',
+ 'Auto (CPU Safe)': '自動(CPUセーフ)',
+ 'Auto (Balanced)': '自動(バランス)',
+ 'Auto (Compact RAM)': '自動(省RAM)',
+ 'Auto (Standard)': '自動(標準)',
+ 'Auto (Workstation)': '自動(ワークステーション)',
+ 'Auto (High GPU)': '自動(ハイスペックGPU)',
+ 'Dedicated GPU': '専用GPU',
+ '{ram} RAM · Canvas 2D CPU · 1× Scale': 'RAM {ram} · Canvas 2D CPU · 1×スケール',
+ '{ram} RAM · {gpu} · {pool} Cache': 'RAM {ram} · {gpu} · キャッシュ {pool}',
+
+ // =========================================================================
+ // Global Shortcut Listener & Tool Display Labels
+ // =========================================================================
+ 'Quick Brush Panel: Shown': 'クイックブラシパネル: 表示',
+ 'Quick Brush Panel: Hidden': 'クイックブラシパネル: 非表示',
+ 'Value Check (Live B/W): ON': '明度チェック(白黒表示): ON',
+ 'Value Check (Live B/W): OFF': '明度チェック(白黒表示): OFF',
+ 'Split View (Color | B/W)': '分割表示(カラー|白黒)',
+ 'Live B/W Tone': '白黒(明度表示)',
+ 'Navigator Preview: {mode}': 'ナビゲーター表示: {mode}',
+ 'Straight Ruler: ON': '直線定規: ON',
+ 'Straight Ruler: OFF': '直線定規: OFF',
+ '2-Point Perspective Ruler added to canvas': '2点透視パース定規をキャンバスに追加しました',
+ 'Perspective Ruler: Shown': 'パース定規: 表示',
+ 'Perspective Ruler: Hidden': 'パース定規: 非表示',
+ 'Perspective Snapping: ON': 'パース定規スナップ: ON',
+ 'Perspective Snapping: OFF': 'パース定規スナップ: OFF',
+ 'Sub Tool: {name}': 'サブツール: {name}',
+ 'Tool: {label}': 'ツール: {label}',
+ 'Group: {group} · {brush}': 'グループ: {group} · {brush}',
+ 'Group: {group}': 'グループ: {group}',
+ 'Transparent ink mode active': '透明色モードに切り替えました',
+ 'Color ink mode active': '描画色モードに切り替えました',
+ 'Importing Brush: {fileName}...': 'ブラシを読み込み中: {fileName}...',
+ 'Imported brush "{name}"': 'ブラシ「{name}」を読み込みました',
+ 'Failed to import brush file.': 'ブラシファイルの読み込みに失敗しました。',
+ 'Selection Eraser': '選択範囲消しゴム',
+ 'Shapes': '図形',
+ 'Bézier Pen': 'ベジェ曲線ペン',
+ 'Frame Border': 'コマ枠',
+ 'Object': 'オブジェクト',
+ 'Correct Line': '線修正',
+ '3D Object & Camera': '3Dオブジェクト・カメラ',
+
+ // =========================================================================
+ // Collaborative Drawing / Multiplayer (HostModal, Overlay, Toast, Landing, Hooks)
+ // =========================================================================
+ 'Collaborative Drawing': '共同制作',
+ 'Ink Studio Session': 'Ink Studio セッション',
+ 'Ink Studio Collab': 'Ink Studio 共同制作',
+ 'Collab Session': '共同制作セッション',
+ 'Collab Room': '共同制作ルーム',
+ 'Studio': 'スタジオ',
+ "{name}'s Studio": '{name} のスタジオ',
+ 'Close connection dialog': '接続ダイアログを閉じる',
+ 'Hosting active session': 'セッションをホスト中',
+ 'Connected as {role}': '{role} として接続中',
+ 'Reconnecting (attempt {count})...': '再接続中({count}回目)...',
+ 'Connecting...': '接続中...',
+ 'Host or join a live canvas session': 'ライブキャンバスセッションをホストまたは参加します',
+ 'Reconnecting to Session...': 'セッションに再接続中...',
+ 'Reconnecting...': '再接続中...',
+ 'Room: {room} (attempt {count})': 'ルーム: {room}({count}回目)',
+ 'Session state is preserved. Missed tiles and layer updates will catch up automatically.':
+ 'セッション状態は保持されています。未受信のタイルやレイヤー変更は自動的に同期されます。',
+ 'Cancel & Leave': 'キャンセルして退出',
+ 'Quick P2P Room Active (WebRTC)': 'クイックP2Pルーム稼働中 (WebRTC)',
+ 'Worldwide Cloudflare Tunnel Active': 'グローバルCloudflareトンネル稼働中',
+ 'Local Wi-Fi Server Active': 'ローカルWi-Fiサーバー稼働中',
+ 'Room: {room} — Android tablets & PCs can join worldwide with the short code below (up to {max} guests).':
+ 'ルーム「{room}」— 下のルームコードで世界中のPCやAndroidタブレットから参加できます(最大{max}名)。',
+ 'Room: {room} — anyone on any network can join via link in browser or desktop app.':
+ 'ルーム「{room}」— どのネットワークからでもリンク経由でブラウザーやデスクトップアプリから参加できます。',
+ 'Room: {room} (port {port})': 'ルーム: {room}(ポート {port})',
+ 'Quick P2P Room Code (Android & Desktop)': 'クイックP2Pルームコード(Android・PC)',
+ 'Copied': 'コピー済み',
+ 'Copied!': 'コピーしました!',
+ 'Copy Link': 'リンクをコピー',
+ 'Copy Local': 'ローカルをコピー',
+ 'Copy Invite Link / Code': '招待リンク/コードをコピー',
+ 'Room code copied.': 'ルームコードをコピーしました。',
+ 'Invite link copied.': '招待リンクをコピーしました。',
+ 'Local LAN link copied.': 'ローカルLANリンクをコピーしました。',
+ 'Failed to copy to clipboard.': 'クリップボードへのコピーに失敗しました。',
+ 'Code: {code}': 'コード: {code}',
+ 'Invite Link: {url}': '招待リンク: {url}',
+ 'Local LAN: {url}': 'ローカルLAN: {url}',
+ 'Share this Room Code with Android tablet or desktop users — no cloudflared required. Keep this app open while hosting.':
+ 'このルームコードをAndroidタブレットやPCの参加者に共有してください(cloudflared不要)。ホスト中はアプリを開いたままにしてください。',
+ 'Worldwide Invite Link (Browser or Desktop App)': 'グローバル招待リンク(ブラウザー/デスクトップアプリ)',
+ 'Local Wi-Fi Invite Link': 'ローカルWi-Fi招待リンク',
+ 'Local Wi-Fi Access': 'ローカルWi-Fi接続',
+ 'Share this link to open directly in a browser or paste it into the Join tab in the desktop app.':
+ 'このリンクを共有するとブラウザーで直接開けるほか、デスクトップアプリの「参加」タブに貼り付けて接続できます。',
+ 'Participants on Canvas ({count})': 'キャンバス上の参加者 ({count})',
+ 'Participants ({count})': '参加者 ({count})',
+ '{name} (You)': '{name}(自分)',
+ 'Host': 'ホスト',
+ 'Editor': '編集者',
+ 'Viewer': '閲覧者',
+ 'Viewer (Read-Only)': '閲覧者(閲覧のみ)',
+ 'Waiting for other artists to join...': '他のアーティストの参加を待っています...',
+ 'Follow {name}\'s camera': '{name} のカメラに追従',
+ 'Stop following {name}\'s camera': '{name} のカメラ追従を停止',
+ 'Follow camera': 'カメラに追従',
+ 'Following camera': 'カメラ追従中',
+ 'Click to follow {name}\'s camera in real time': 'クリックして {name} のカメラ視点にリアルタイム追従',
+ '{brush} · Click to follow': '{brush} · クリックして追従',
+ 'Try {name}\'s Brush': '{name} のブラシを試す',
+ 'Try Brush': 'ブラシを試す',
+ 'Role for {name}': '{name} の権限',
+ 'Kick {name}': '{name} を退出させる',
+ 'Ban {name}': '{name} をBANする',
+ 'Banned Peers ({count})': 'BAN済みユーザー ({count})',
+ 'Unban': 'BAN解除',
+ 'Stop Collaborative Session': '共同制作セッションを終了',
+ 'Stop Session': 'セッション終了',
+ 'Connected to Session': 'セッションに接続中',
+ 'Room: {room}': 'ルーム: {room}',
+ 'Connected via WebRTC P2P': 'WebRTC P2Pで接続中',
+ 'Host: {host}': 'ホスト: {host}',
+ 'Leave Session': 'セッションから退出',
+ 'Host Session': 'ホストする',
+ 'Join Session': '参加する',
+ 'Artist Nickname': 'アーティストニックネーム',
+ 'Your Nickname': 'ニックネーム',
+ 'Your name': '名前を入力',
+ 'Enter nickname...': 'ニックネームを入力...',
+ 'Room / Canvas Name': 'ルーム/キャンバス名',
+ 'Connection Mode': '接続方式',
+ 'Worldwide P2P (Room Code)': 'グローバル P2P(ルームコード)',
+ 'Recommended': '推奨',
+ 'Fast direct INK-XXXX code for PC & Android tablets · No setup':
+ 'PC・Androidタブレット向けの高速直接接続(INK-XXXXコード・設定不要)',
+ 'Web Link (Cloudflare Tunnel)': 'Webリンク(Cloudflareトンネル)',
+ 'Browser guests & up to 16 peers': 'ブラウザー参加者対応・最大16人',
+ 'Local Network (LAN)': 'ローカルネットワーク (LAN)',
+ 'Same Wi-Fi network': '同一Wi-Fiネットワーク内',
+ 'Local Port': 'ローカルポート',
+ 'Default is 30303. Works over local Wi-Fi or virtual LAN (Tailscale).':
+ '既定値は 30303 です。同一Wi-Fiや仮想LAN(Tailscale等)で利用できます。',
+ 'Generates a short Room Code (INK-XXXX-XXXXXX) with zero server setup or cloudflared download. Android tablets and desktop apps connect directly over WebRTC (up to {max} guests).':
+ 'サーバー設定やcloudflaredのダウンロードなしで短いルームコード(INK-XXXX-XXXXXX)を発行します。AndroidタブレットやデスクトップアプリからWebRTCで直接接続できます(最大{max}名)。',
+ 'Launches a Cloudflare HTTPS/WSS tunnel (HTTP/2 over port 443) so friends on any network can join in a browser or desktop app.':
+ 'CloudflareのHTTPS/WSSトンネル(ポート443・HTTP/2)を起動し、任意のネットワークからブラウザーやデスクトップアプリで参加できるようにします。',
+ 'Reachable only by devices on the same Wi-Fi network or virtual LAN (e.g. Tailscale).':
+ '同一Wi-Fiネットワーク、またはTailscaleなどの仮想LAN上のデバイスからのみ接続できます。',
+ 'Start Quick P2P Room instead': '代わりにクイックP2Pルームを開始',
+ 'Start Local Wi-Fi Server instead': '代わりにローカルWi-Fiサーバーを開始',
+ 'Opening Quick P2P Room...': 'クイックP2Pルームを作成中...',
+ 'Opening P2P Room...': 'P2Pルームを作成中...',
+ 'Starting Server...': 'サーバーを起動中...',
+ 'Start Room & Copy Code': 'ルーム作成&コードをコピー',
+ 'Start Server & Copy Link': 'サーバー起動&リンクをコピー',
+ 'Quick P2P hosting is unavailable in this context.':
+ '現在の環境ではクイックP2Pホストを利用できません。',
+ 'Failed to start server': 'サーバーの起動に失敗しました',
+ 'Room Code (INK-XXXX...) or Invite Link': 'ルームコード(INK-XXXX...)または招待リンク',
+ 'INK-7429-K8P2M9 or invite link (ws://, wss://, trycloudflare.com)':
+ 'INK-7429-K8P2M9 または招待リンク (ws://, wss://, trycloudflare.com)',
+ 'Room Passcode (if separate)': 'ルームパスコード(別入力の場合)',
+ 'Optional': '任意',
+ 'e.g. K8P2M9': '例: K8P2M9',
+ 'WebRTC P2P Room detected ({code})': 'WebRTC P2Pルームを検出しました ({code})',
+ 'Secure WebSocket (WSS) detected ({host})': 'セキュアWebSocket (WSS) を検出しました ({host})',
+ 'WebSocket (WS) detected ({host})': 'WebSocket (WS) を検出しました ({host})',
+ 'Paste an Android/PC P2P Room Code (INK-XXXX-XXXXXX), P2P invite link, or Cloudflare / LAN WebSocket URL.':
+ 'Android/PCのP2Pルームコード(INK-XXXX-XXXXXX)、P2P招待リンク、またはCloudflare/LANのWebSocket URLを貼り付けてください。',
+ 'Enter a room code (INK-XXXX) or invite link first.':
+ '先にルームコード(INK-XXXX)または招待リンクを入力してください。',
+ 'Join P2P Room': 'P2Pルームに参加',
+ 'Join Room': 'ルームに参加',
+
+ // Collab Room Overlay & Diagnostics Tooltip
+ 'Transport: WebRTC ({mode})': '通信方式: WebRTC ({mode})',
+ 'TURN relay': 'TURNリレー',
+ 'Transport: WebSocket': '通信方式: WebSocket',
+ 'Ping: {ms} ms': 'Ping: {ms} ms',
+ 'Ping: measuring...': 'Ping: 計測中...',
+ 'TX: {txRate} ({txMsgs} msg/s) · RX: {rxRate} ({rxMsgs} msg/s)':
+ '送信: {txRate} ({txMsgs} msg/s) · 受信: {rxRate} ({rxMsgs} msg/s)',
+ 'Tile queue: {queue} · Dropped ephemeral: {dropped}':
+ 'タイルキュー: {queue} · 一時パケット破棄: {dropped}',
+ 'Resyncing ({count})': '再同期中 ({count})',
+ 'OK ({count} healed)': '正常({count}回自動修復)',
+ 'Sync audit: {status}': '同期チェック: {status}',
+ 'Following {name}\'s camera': '{name} のカメラに追従中',
+ '· Pan/zoom to exit': '· 移動/ズームで解除',
+ 'Stop': '停止',
+ 'Expand Room Overlay': 'ルームオーバーレイを展開',
+ 'Minimize Room Overlay': 'ルームオーバーレイを最小化',
+ 'Room Settings & Invite Link': 'ルーム設定・招待リンク',
+ 'Share Brush': 'ブラシ共有',
+ 'Share your active brush (tip & texture) with everyone in the room':
+ '使用中のブラシ(先端画像・テクスチャ含む)をルーム全員に共有',
+ 'Share your current brush to chat': '現在のブラシをチャットに共有',
+ 'Trying {peerName}\'s {brushName}': '{peerName} の「{brushName}」を試用中',
+ 'Save this brush permanently to your Custom Brushes': 'このブラシをカスタムブラシに保存',
+ 'Dismiss grabbed brush banner': 'ブラシ試用バナーを閉じる',
+ 'Show Participants': '参加者一覧を表示',
+ 'Open Room Chat': 'ルームチャットを開く',
+ 'Chat': 'チャット',
+ 'No messages yet': 'メッセージはまだありません',
+ 'Chat with desktop & browser guests right here on the canvas.':
+ 'デスクトップやブラウザーの参加者とキャンバス上でチャットできます。',
+ 'Message room...': 'ルームにメッセージを送信...',
+ 'Send message': 'メッセージを送信',
+ 'Send message (Enter)': 'メッセージを送信 (Enter)',
+
+ // Clipboard Invite Toast & Web Landing Modal
+ 'Invitation Detected': '招待リンクを検出しました',
+ 'Room: "{name}"': 'ルーム: 「{name}」',
+ 'Connect': '接続',
+ 'Dismiss invitation': '招待通知を閉じる',
+ 'Dismiss': '閉じる',
+ 'Connecting to Canvas': 'キャンバスに接続',
+ 'Direct Encrypted WebRTC P2P': '暗号化 WebRTC P2P 直接接続',
+ 'Encrypted Worldwide Tunnel': '暗号化グローバル接続',
+ 'Choose a Nickname': 'ニックネームを入力',
+ 'Join as "{name}"': '「{name}」として参加',
+ 'Join in Browser': 'ブラウザーで参加',
+ 'Play as Guest': 'ゲストとして参加',
+ 'Open in Ink Studio App': 'Ink Studioアプリで開く',
+ 'Supports graphic tablets, stylus pressure, and real-time synchronization.':
+ 'ペンタブレット・筆圧感知・リアルタイム同期に対応しています。',
+
+ // Multiplayer & Collab Sync Hook Toasts & Messages
+ 'Host disconnected — the P2P room has ended. Your canvas remains open locally.':
+ 'ホストが切断されたためP2Pルームは終了しました。キャンバスはローカルに保持されています。',
+ 'Unable to reconnect to collaborative session': '共同制作セッションに再接続できませんでした',
+ 'Reconnected to collaborative session': '共同制作セッションに再接続しました',
+ 'Access denied': 'アクセスが拒否されました',
+ 'Your role was changed to Viewer (read-only)': '権限が「閲覧者(閲覧のみ)」に変更されました',
+ 'Your role was changed to Editor': '権限が「編集者」に変更されました',
+ 'You have been banned from this room by the host': 'ホストによってこのルームからBANされました',
+ 'You were removed from this room by the host': 'ホストによってこのルームから退出させられました',
+ '{name} was banned': '{name} がBANされました',
+ '{name} was kicked': '{name} が退出させられました',
+ 'You are banned from this room': 'このルームへの参加は制限されています',
+ '{name} joined the canvas': '{name} がキャンバスに参加しました',
+ 'Connected to room "{name}"': 'ルーム「{name}」に接続しました',
+ '{name} left the canvas': '{name} がキャンバスから退出しました',
+ 'Shared brush "{name}"': 'ブラシ「{name}」を共有しました',
+ '{peerName} shared "{brushName}" brush': '{peerName} がブラシ「{brushName}」を共有しました',
+ 'Host ended the P2P room. Your canvas remains open locally.':
+ 'ホストがP2Pルームを終了しました。キャンバスはローカルに保持されています。',
+ 'Host connection interrupted. Reconnecting to P2P room...':
+ 'ホストとの接続が途切れました。P2Pルームに再接続しています...',
+ 'Connection lost. Reconnecting...': '接続が切断されました。再接続しています...',
+ 'Downloading Cloudflare Tunnel (first time)...': 'Cloudflareトンネルをダウンロード中(初回のみ)...',
+ 'Starting Worldwide Tunnel...': 'グローバル接続トンネルを起動中...',
+ 'Starting Local Server...': 'ローカルサーバーを起動中...',
+ 'Worldwide invite link copied to clipboard.':
+ 'グローバル招待リンクをクリップボードにコピーしました。',
+ 'Local Wi-Fi invite link copied to clipboard.':
+ 'ローカルWi-Fi招待リンクをクリップボードにコピーしました。',
+ 'Room created: {url}': 'ルームを作成しました: {url}',
+ 'Connection error': '接続エラー',
+ 'Failed to start host: {error}': 'ホストの開始に失敗しました: {error}',
+ 'Connecting to P2P signaling...': 'P2Pシグナリングに接続中...',
+ 'Quick P2P room ready! Code {code} copied.':
+ 'クイックP2Pルームの準備が完了しました!コード {code} をコピーしました。',
+ 'Quick P2P room ready: {code}': 'クイックP2Pルームの準備が完了しました: {code}',
+ 'P2P connection error': 'P2P接続エラー',
+ 'Failed to start P2P room: {error}': 'P2Pルームの作成に失敗しました: {error}',
+ 'Collaborative session stopped': '共同制作セッションを終了しました',
+ 'Failed to connect: {error}': '接続に失敗しました: {error}',
+ 'Failed to join P2P room: {error}': 'P2Pルームへの参加に失敗しました: {error}',
+ 'Invalid room code or link. Enter an INK-XXXX code, P2P link, or wss:// / ws:// URL.':
+ '無効なルームコードまたはリンクです。INK-XXXXコード、P2Pリンク、または wss:// / ws:// URLを入力してください。',
+ 'Left the collaborative session': '共同制作セッションから退出しました',
+ 'Only the Host can change participant roles': '参加者の権限を変更できるのはホストのみです',
+ 'Only the Host can kick participants': '参加者を退出させられるのはホストのみです',
+ 'Kicked {name} from the room': '{name} をルームから退出させました',
+ 'Only the Host can ban participants': '参加者をBANできるのはホストのみです',
+ 'Banned {name} from the room': '{name} をルームからBANしました',
+ 'Only the Host can unban participants': 'BANを解除できるのはホストのみです',
+ 'Unbanned {id}': '{id} のBANを解除しました',
+ 'Trying {peerName}\'s "{brushName}" brush': '{peerName} のブラシ「{brushName}」を試用しています',
+ 'Remote Vector Stroke': 'リモートベクター描画',
+ 'Canvas resized remotely to {width} × {height} px':
+ 'キャンバスサイズがリモートで {width} × {height} px に変更されました',
+ 'participant': '参加者',
+ 'Stopped following {name}': '{name} のカメラ追従を停止しました',
+ 'Couldn\'t fetch that participant\'s brush yet — try again in a moment':
+ '参加者のブラシをまだ取得できませんでした。少し待ってからもう一度お試しください',
+ 'Shared "{name}" brush with the room': 'ブラシ「{name}」をルームに共有しました',
+ 'Saved "{name}" to Custom Brushes': '「{name}」をカスタムブラシに保存しました',
+ 'Grabbed from collaborative drawing session': '共同制作セッションから取得したブラシ',
+ 'Shared': '共有',
+ 'Please create or open a canvas before hosting a session.':
+ 'セッションをホストする前にキャンバスを作成または開いてください。',
+ 'Viewers have read-only access': '閲覧者は読み取り専用です',
+ 'Viewers cannot lock or unlock layers': '閲覧者はレイヤーのロックを変更できません',
+ 'Layer not found': 'レイヤーが見つかりません',
+ 'Viewers cannot delete layers': '閲覧者はレイヤーを削除できません',
+ 'Only the Host can manage room permissions': 'ルーム権限を管理できるのはホストのみです',
+ 'Viewer mutation rejected': '閲覧者からの変更は拒否されました',
+ 'You do not have permission to delete this layer': 'このレイヤーを削除する権限がありません',
+ 'Selected layers cannot be deleted': '選択中のレイヤーは削除できません',
+ 'Deleted {deleted} layer(s); protected {protected} other user layer(s)':
+ '{deleted}枚のレイヤーを削除しました(他のユーザーのレイヤー{protected}枚は保護されました)',
+ 'Deleted {count} layers': '{count}枚のレイヤーを削除しました',
+ 'Grouped layers into folder': 'レイヤーをフォルダーにまとめました',
+ 'Cannot modify this layer': 'このレイヤーは変更できません',
+ 'Cannot rename this layer': 'このレイヤーの名前は変更できません',
+ 'Cannot modify lock on this layer': 'このレイヤーのロック状態は変更できません',
+ 'Cannot toggle owner lock on this layer': 'このレイヤーのオーナーロックを切り替えられません',
+ 'Unlocked "{name}" for collaboration': '「{name}」の共同編集ロックを解除しました',
+ 'Owner': 'オーナー',
+ 'Locked "{name}" to {owner}': '「{name}」を {owner} 専用にロックしました',
+ 'Cannot clear this layer': 'このレイヤーは消去できません',
+
+ // Contextual homonym disambiguations
+ 'appearanceTab::Chrome': 'UIスタイル',
+ 'chromeStyle::Flat': 'フラット',
+ 'shortcut::Replace': '上書き',
+};
diff --git a/src/i18n/ja/workspace.ts b/src/i18n/ja/workspace.ts
new file mode 100644
index 0000000..aecff61
--- /dev/null
+++ b/src/i18n/ja/workspace.ts
@@ -0,0 +1,778 @@
+import { TranslationDictionary } from '../types';
+
+export const JA_WORKSPACE: TranslationDictionary = {
+ // =========================================================================
+ // Workspace Panel Titles & Short Titles (src/types/workspace.ts)
+ // =========================================================================
+ 'Tool': 'ツール',
+ 'Sub Tool': 'サブツール',
+ 'Tool Property': 'ツールプロパティ',
+ 'Brush Size': 'ブラシサイズ',
+ 'Navigator': 'ナビゲーター',
+ 'References': 'リファレンス',
+ 'Info': '情報',
+ 'Color Wheel': 'カラーサークル',
+ 'Color Sliders': 'カラースライダー',
+ 'Color Sets': 'カラーセット',
+ 'Color History': 'カラーヒストリー',
+ 'History': 'ヒストリー',
+ 'Quick Access': 'クイックアクセス',
+ 'Auto Action': 'オートアクション',
+
+ // Narrow icon-strip / tab short labels
+ 'panelShort::Tool': 'ツール',
+ 'panelShort::Sub': 'サブ',
+ 'panelShort::Prop': 'プロパティ',
+ 'panelShort::Size': 'サイズ',
+ 'panelShort::Nav': 'ナビ',
+ 'panelShort::Refs': '参照',
+ 'panelShort::Info': '情報',
+ 'panelShort::Color': 'カラー',
+ 'panelShort::Sliders': 'スライダー',
+ 'panelShort::Sets': 'セット',
+ 'panelShort::Recent': '履歴',
+ 'panelShort::Layer': 'レイヤー',
+ 'panelShort::Hist': '履歴',
+ 'panelShort::Quick': 'クイック',
+ 'panelShort::Actions': 'アクション',
+
+ // =========================================================================
+ // Workspace Presets & Command Catalog (src/types/workspace.ts, workspacePresets.ts)
+ // =========================================================================
+ 'Default Illustration': 'イラスト(標準)',
+ 'Photoshop Studio': 'Photoshop 風',
+ 'Clip Studio': 'CLIP STUDIO 風',
+ 'Manga Studio': '漫画制作',
+ 'Minimalist Tablet': 'ミニマル(液タブ向け)',
+ 'Balanced Atelier layout with brushes left & color/layers right':
+ '左にブラシ、右にカラー・レイヤーを配置したバランスの良い標準レイアウト',
+ 'Slim left tool rail, right Color/Brushes/Layers stack & top Options Bar':
+ '左にスリムなツールバー、右にカラー・ブラシ・レイヤー、上部にオプションバーを配置',
+ 'Classic CSP SubTool / Property / Size left + Navigator / Color / Layers right':
+ '左にサブツール・プロパティ・サイズ、右にナビゲーター・カラー・レイヤーを配置した定番構成',
+ 'Inking-first panels with dedicated Quick Access & Brush Size stack':
+ 'クイックアクセスとブラシサイズを常設したペン入れ重視の漫画向けレイアウト',
+ 'Collapsed icon rails for maximum pen-display canvas space':
+ 'アイコンバー格納でキャンバス領域を最大化する液タブ向けレイアウト',
+
+ // Command catalog labels & shortLabels
+ 'Flip Horizontal': '左右反転',
+ 'Flip H': '左右反転',
+ 'Flip Vertical': '上下反転',
+ 'Flip V': '上下反転',
+ 'Value Check (Live B/W)': '明度チェック(白黒表示)',
+ 'Value': '明度',
+ 'Clear Layer': 'レイヤーを消去',
+ 'Merge Down': '下のレイヤーと結合',
+ 'Merge': '結合',
+ 'New Layer': '新規レイヤー',
+ 'New Lyr': '新規',
+ 'Duplicate Layer': 'レイヤーを複製',
+ 'Dup Lyr': '複製',
+ 'Free Transform': '自由変形',
+ 'Transf': '変形',
+ 'Desel': '解除',
+ 'Reset Zoom': '表示倍率をリセット',
+ 'Fit': '全体',
+ 'Reset Zoom to 100%': '100%表示',
+ '100%': '100%',
+ 'Reset Rotation': '回転をリセット',
+ '0°': '0°',
+ 'Swap Colors': '描画色と背景色を入れ替え',
+ 'Swap': '入替',
+ 'Transparent Ink': '透明色',
+ 'Transp': '透明',
+ 'Pick': 'スポイト',
+ 'Lasso Selection': '投げなわ選択',
+ 'Toggle Fullscreen': 'フルスクリーン切替',
+ 'Full': '全画面',
+ 'Focus Mode (Hide Palettes)': 'フォーカスモード(パレット非表示)',
+ 'Focus': '集中',
+ 'Quick Brush Panel': 'クイックブラシパネル',
+ 'Ink Black': '墨黒',
+ 'Paper White': '紙白',
+ 'Favorites': 'お気に入り',
+
+ // Workspace bundle validation (src/utils/workspacePresets.ts)
+ 'Workspace file is empty.': 'ワークスペースファイルが空です。',
+ 'Workspace file exceeds maximum allowed size (256 KB).':
+ 'ワークスペースファイルが最大サイズ(256 KB)を超えています。',
+ 'Workspace file is not valid JSON.': 'ワークスペースファイルの JSON 形式が正しくありません。',
+ 'Workspace file root must be a JSON object.':
+ 'ワークスペースファイルのルートは JSON オブジェクトである必要があります。',
+ 'Invalid workspace format identifier. Expected "{expected}".':
+ 'ワークスペースの形式識別子が無効です。「{expected}」が必要です。',
+ 'Unsupported workspace schema version: {version}. Expected version {expected}.':
+ '未対応のワークスペーススキーマバージョンです: {version}(対応バージョン: {expected})。',
+ 'Workspace file must include a non-empty "name" string.':
+ 'ワークスペースファイルには空でない「name」文字列が必要です。',
+ 'Workspace file contains no valid dock or floating panels.':
+ 'ワークスペースファイルに有効なドックまたはフローティングパネルが含まれていません。',
+ 'Bundled "appearance" field must be an object.':
+ '同梱の「appearance」フィールドはオブジェクトである必要があります。',
+ 'Invalid bundled appearance: {error}': '同梱の外観設定が無効です: {error}',
+
+ // =========================================================================
+ // Dock Workspace & Floating Panel Window (DockWorkspace.tsx, FloatingPanelWindow.tsx)
+ // =========================================================================
+ 'Panel': 'パネル',
+ 'Palette Dock Options': 'パレットドック設定',
+ 'Panel Options': 'パネル設定',
+ '{title} — Drag tab to move, split side-by-side, or detach':
+ '{title} — タブをドラッグして移動・左右分割・切り離し',
+ '{title} — Drag tab to split or dock': '{title} — タブをドラッグして分割またはドッキング',
+ '{title} (Click to pop out — position locked)': '{title}(クリックでポップアウト・位置ロック中)',
+ '{title} (Click to pop out, drag to move or detach)':
+ '{title}(クリックでポップアウト・ドラッグで移動または切り離し)',
+ '{title} (Position locked)': '{title}(位置ロック中)',
+ '{title} Floating Panel': '{title} フローティングパネル',
+ 'Expand {title}': '{title}を展開',
+ 'Hide {title}': '{title}を隠す',
+ 'Close {title}': '{title}を閉じる',
+ 'Detach {title}': '{title}を切り離す',
+ 'Detach Tool panel': 'ツールパネルを切り離す',
+ 'Detach & Float Palette': '切り離してフローティング表示',
+ 'Detach & Float Tool Panel': 'ツールパネルを切り離してフローティング表示',
+ 'Reattach {title} to dock': '{title}をドックに戻す',
+ 'Reattach to Dock': 'ドックに戻す',
+ 'Expand Panel': 'パネルを展開',
+ 'Collapse Panel': 'パネルを折りたたむ',
+ 'Hide / Collapse Panel': 'パネルを折りたたむ',
+ 'Close Palette': 'パレットを閉じる',
+ 'Close Panel': 'パネルを閉じる',
+ 'Dismiss Popover (Esc)': 'ポップオーバーを閉じる (Esc)',
+ 'Collapse Dock Strip': 'ドックストリップを格納',
+ 'Collapse Dock Column to Icon Strip': 'ドック列をアイコン表示に格納',
+ 'Expand Dock Column': 'ドック列を展開',
+ 'Expand & Pin Column': '列を展開して固定',
+ 'Collapse Bottom Dock': '下部ドックを折りたたむ',
+ 'Expand Bottom Dock': '下部ドックを展開',
+ 'Move to Left Dock': '左ドックへ移動',
+ 'Move to Right Dock': '右ドックへ移動',
+ 'Move to Bottom Dock': '下部ドックへ移動',
+ 'Move to New Column': '新しい列へ移動',
+ 'Dock to Left': '左ドックに格納',
+ 'Dock to Right': '右ドックに格納',
+ 'Dock to Bottom': '下部ドックに格納',
+ 'Dock to Strip': 'アイコンバーに格納',
+ 'Dock Left Edge': '左端にドッキング',
+ 'Dock Right Edge': '右端にドッキング',
+ 'New Left Column': '新しい左列を作成',
+ 'New Right Column': '新しい右列を作成',
+ 'Add as Tab': 'タブとして追加',
+ 'Group with {title}': '「{title}」とタブ統合',
+ 'Split Left': '左に分割',
+ 'Split Right': '右に分割',
+ 'Split Side-by-Side Left': '左側に並列分割',
+ 'Split Side-by-Side Right': '右側に並列分割',
+ 'Side-by-Side with Above': '上の段と並列配置',
+ 'Side-by-Side with Below': '下の段と並列配置',
+ 'Stack Above': '上に積む',
+ 'Stack Below': '下に積む',
+ 'Drop to create new Left Dock column': 'ドロップして左ドックに新しい列を作成',
+ 'Drop to create new Right Dock column': 'ドロップして右ドックに新しい列を作成',
+ 'Drop to dock beneath the canvas': 'ドロップしてキャンバス下部にドッキング',
+ 'Drag outside to float': '外側にドラッグしてフローティング化',
+ 'Release to float': '離してフローティング表示',
+ 'Drag to move or dock — Double-click to collapse/expand':
+ 'ドラッグで移動・ドッキング — ダブルクリックで折りたたみ / 展開',
+ 'Position locked': '位置ロック中',
+ 'Position locked — Double-click to collapse/expand':
+ '位置ロック中 — ダブルクリックで折りたたみ / 展開',
+ 'Width locked': '幅ロック中',
+ 'Height locked': '高さロック中',
+ 'Size locked': 'サイズロック中',
+ 'Drag to resize': 'ドラッグしてサイズ変更',
+ 'Drag to resize width': 'ドラッグして幅を変更',
+ 'Drag to resize height': 'ドラッグして高さを変更',
+ 'Drag to resize dock column': 'ドラッグしてドック列の幅を変更',
+ 'Drag to resize Bottom Dock height': 'ドラッグして下部ドックの高さを変更',
+ 'Drag to resize side-by-side palettes': 'ドラッグして左右パレットの幅を変更',
+ 'Drag to resize stacked palettes': 'ドラッグして上下パレットの高さを変更',
+
+ // =========================================================================
+ // Welcome Screen & Community Links (WelcomeScreen.tsx, SocialIcons.tsx)
+ // =========================================================================
+ 'Ink Studio · Free & Open Source': 'Ink Studio · 無料・オープンソース',
+ 'Studio Workspace': 'スタジオワークスペース',
+ 'Welcome back, {name}': 'おかえりなさい、{name}さん',
+ 'New Canvas': '新規キャンバス',
+ 'Open File': 'ファイルを開く',
+ 'Quick-Start Canvases': 'クイックスタートキャンバス',
+ 'Quick-Start Sheets': 'クイック作成テンプレート',
+ '1-click canvas': 'ワンクリック作成',
+ 'Custom...': 'カスタム...',
+ 'Size, DPI & mode': 'サイズ・解像度・表現色',
+ 'Illustration 4K': 'イラスト 4K',
+ 'Manga B4': '漫画原稿 B4',
+ 'Webtoon': 'Webtoon',
+ 'Square Study': '正方形スタディ',
+ 'Pinned Projects': 'ピン留めした作品',
+ 'Recent Projects': '最近の作品',
+ 'Pinned': 'ピン留め中',
+ 'Pin {title}': '「{title}」をピン留め',
+ 'Unpin {title}': '「{title}」のピン留めを解除',
+ 'Pinned "{title}"': '「{title}」をピン留めしました',
+ 'Unpinned "{title}"': '「{title}」のピン留めを解除しました',
+ 'Remove {title}': '「{title}」を削除',
+ 'Removed "{title}"': '「{title}」をリストから削除しました',
+ 'Removed from list': 'リストから削除しました',
+ 'Deleted "{title}"': '「{title}」を削除しました',
+ 'Search projects...': '作品を検索...',
+ 'Search recent documents': '最近の作品を検索',
+ 'Clear search': '検索をクリア',
+ 'Clear Filter': 'フィルターをクリア',
+ '{n} file': '{n}件のファイル',
+ '{n} files': '{n}件のファイル',
+ 'Your drafting table is clear': '作業机はまだ真っ白です',
+ 'Pick a quick-start sheet above or open an existing .ink, .psd, or image file.':
+ '上のクイック作成テンプレートを選ぶか、既存の .ink / .psd / 画像ファイルを開いてください。',
+ 'No projects matching "{query}"': '「{query}」に一致する作品が見つかりません',
+ 'Try a different filename or clear the search filter.':
+ '別のファイル名で検索するか、検索フィルターをクリアしてください。',
+ 'Community and project links': 'コミュニティ・プロジェクトリンク',
+ 'Community and support links': 'コミュニティ・サポートリンク',
+ 'Issues': '不具合報告',
+ 'Discord': 'Discord',
+ 'Discord Community': 'Discord コミュニティ',
+ 'Join Ink Studio on Discord': 'Ink Studio の Discord に参加',
+ 'X (Twitter)': 'X (Twitter)',
+ 'Follow @inkstudio_app on X (Twitter)': 'X (Twitter) で @inkstudio_app をフォロー',
+ 'GitHub': 'GitHub',
+ 'GitHub Repository': 'GitHub リポジトリ',
+ 'Ink Studio on GitHub': 'GitHub で Ink Studio を見る',
+ 'Website': '公式サイト',
+ 'Ink Studio Website': 'Ink Studio 公式サイト',
+ 'Visit Ink Studio Website': 'Ink Studio 公式サイトを開く',
+ 'Report a bug or request a feature on GitHub': 'GitHub で不具合報告や機能リクエストを送る',
+
+ // =========================================================================
+ // New Canvas Modal (NewCanvasModal.tsx)
+ // =========================================================================
+ 'Close new canvas dialog': '新規キャンバスダイアログを閉じる',
+ 'Close (Esc)': '閉じる (Esc)',
+ 'Document Name': 'ファイル名',
+ 'Dimensions': 'キャンバスサイズ',
+ 'Width ({unit})': '幅 ({unit})',
+ 'Height ({unit})': '高さ ({unit})',
+ 'Aspect ratio locked': '縦横比を固定中',
+ 'Lock aspect ratio': '縦横比を固定',
+ 'Portrait orientation': '縦向き(ポートレート)',
+ 'Landscape orientation': '横向き(ランドスケープ)',
+ 'Large canvas ({mp} MP) — may increase memory usage.':
+ '大きなキャンバス({mp} MP)です — メモリ使用量が増える場合があります。',
+ 'Resolution (DPI)': '解像度 (DPI)',
+ 'Custom DPI': 'カスタム DPI',
+ 'Screen': 'スクリーン',
+ 'Draft': '下書き',
+ 'Print': '印刷用',
+ 'Manga / Hi-Res': '漫画・高解像度',
+ 'Hi-Res': '高解像度',
+ 'Color Mode': '表現色',
+ 'Grayscale': 'グレースケール',
+ 'Monochrome': 'モノクロ',
+ 'MONO': 'モノクロ',
+ 'Screentone Frequency': '基本トーン線数',
+ 'Pick custom background color': 'カスタム背景色を選択',
+ 'Custom background color picker': 'カスタム背景色ピッカー',
+ 'Custom background hex color': 'カスタム背景色の16進カラーコード',
+ 'to create': 'で作成',
+ 'Create Canvas': 'キャンバスを作成',
+
+ // New Canvas presets, tabs & swatches
+ 'Illustration': 'イラスト',
+ 'Manga': '漫画',
+ 'Illustration & Screen': 'イラスト・画面用',
+ 'Commercial Manga & Print': '商業漫画・印刷用',
+ '--Shueisha--': '--集英社--',
+ 'Webtoon & Mobile': 'Webtoon・モバイル',
+ 'Full HD (1080p)': 'フルHD(1080p)',
+ '4K Ultra HD': '4K Ultra HD',
+ 'A4 Print (300 DPI)': 'A4 印刷用(300 DPI)',
+ 'Square (1:1)': '正方形(1:1)',
+ 'Classic Photo (3:2)': 'クラシック写真(3:2)',
+ 'Ultrawide (21:9)': 'ウルトラワイド(21:9)',
+ 'Shueisha A (Shonen Jump)': '集英社 A判(少年ジャンプ)',
+ 'Shueisha B (Young Jump)': '集英社 B判(ヤングジャンプ)',
+ 'Manga B5 Commercial': '漫画 B5 商業誌用',
+ 'Manga B5 Draft': '漫画 B5 下書き・Web用',
+ 'Webtoon Episode': 'Webtoon エピソード',
+ 'Mobile Story (9:16)': 'モバイルストーリー(9:16)',
+ 'Custom Size': 'カスタムサイズ',
+ 'White': '白',
+ 'Warm': 'クリーム',
+ 'Dark': 'ダーク',
+ 'Black': '黒',
+
+ // =========================================================================
+ // Resize Canvas Modal & Overlay (ResizeCanvasModal.tsx, CanvasResizeOverlay.tsx)
+ // =========================================================================
+ 'Resize Canvas': 'キャンバスサイズを変更',
+ 'Apply Crop & Resize': '切り抜き・サイズ変更を適用',
+ 'Apply Resize / Crop (Enter)': '切り抜き・サイズ変更を適用 (Enter)',
+ 'Drag to move panel · Double-click to reset position':
+ 'ドラッグでパネルを移動 · ダブルクリックで位置をリセット',
+ 'Collapse panel': 'パネルを折りたたむ',
+ 'Hide panel while cropping on canvas': 'キャンバス上で切り抜き中はパネルを隠す',
+ 'Canvas Bounds': 'キャンバス領域',
+ 'Scale Content': '画像解像度を変更',
+ 'Crop or expand directly on canvas without distorting pixels.':
+ 'ピクセルを変形せず、キャンバス上で直接切り抜き・拡張します。',
+ 'Resamples and scales all artwork to new dimensions.':
+ 'すべての描画内容を新しいサイズに合わせて拡大・縮小(リサンプリング)します。',
+ 'Current': '現在',
+ 'New Dimensions': '変更後サイズ',
+ 'Width (px)': '幅 (px)',
+ 'Height (px)': '高さ (px)',
+ 'Swap Width and Height': '幅と高さを入れ替え',
+ 'Swap Width and Height (Landscape ⇄ Portrait)': '幅と高さを入れ替え(横長 ⇄ 縦長)',
+ 'Keep Aspect Ratio': '縦横比を固定',
+ 'Ratio Free': '比率フリー',
+ 'Keep aspect ratio locked (Shift also locks while dragging)':
+ '縦横比を固定します(ハンドル操作中は Shift でも固定可能)',
+ 'Aspect ratio free (hold Shift while dragging handles to lock)':
+ '縦横比フリー(ハンドルをドラッグ中に Shift で固定)',
+ 'Free': 'フリー',
+ 'Crop Frame & Anchor': '切り抜き枠・基準点',
+ 'Custom Crop': 'カスタム切り抜き',
+ 'Drag handles on canvas to crop or expand. Drag inside to move, or drag outside to draw a new crop.':
+ 'キャンバス上のハンドルをドラッグして切り抜き・拡張できます。枠内ドラッグで移動、枠外ドラッグで新規作成します。',
+ 'Crop X (px)': '切り抜き X (px)',
+ 'Crop Y (px)': '切り抜き Y (px)',
+ 'Reset crop box to current canvas dimensions': '切り抜き枠を現在のキャンバスサイズに戻す',
+ 'Reset crop frame to original canvas': '切り抜き枠を元のキャンバスサイズに戻す',
+ 'Cycle crop composition guide grid': '切り抜き構図ガイドグリッドを切り替え',
+ 'Grid: {mode}': 'ガイド: {mode}',
+ 'Crop guide: {mode} (click to cycle)': '切り抜きガイド: {mode}(クリックで切り替え)',
+ 'Thirds': '三分割',
+ 'Golden': '黄金比',
+ 'Rule of Thirds': '三分割法',
+ 'Golden Ratio': '黄金比',
+ 'No Grid': 'ガイドなし',
+ 'Snap crop frame to active selection bounds': '選択範囲の境界に切り抜き枠を合わせる',
+ 'Manual DPI:': '手動 DPI:',
+ 'Ratio:': '比率:',
+ 'Top Center': '上中央',
+ 'Middle Left': '左中央',
+ 'Middle Right': '右中央',
+ 'Bottom Center': '下中央',
+ 'Drag to reposition canvas frame · Double-click to apply':
+ 'ドラッグでキャンバス枠を移動 · ダブルクリックで確定',
+ 'Resample': 'リサンプル',
+ 'Resize': 'サイズ変更',
+ 'Show Panel': 'パネルを表示',
+ 'Show Resize Canvas settings panel': 'キャンバスサイズ変更パネルを表示',
+ 'Hide Resize Canvas settings panel': 'キャンバスサイズ変更パネルを隠す',
+
+ // =========================================================================
+ // Delete / Close / Confirm / First-Time Modals
+ // =========================================================================
+ 'Delete Document': 'ドキュメントを削除',
+ 'Select action': '操作を選択',
+ 'Remove from Recent List': '最近のリストから削除',
+ 'Removes entry from the studio. Keeps the file intact on disk.':
+ 'スタジオの一覧からのみ削除します。ディスク上のファイルはそのまま残ります。',
+ 'Permanently Delete from Disk': 'ディスクから完全に削除',
+ 'Erases file permanently from storage. Cannot be undone.':
+ 'ストレージからファイルを完全に消去します。この操作は元に戻せません。',
+ 'Cancel (Esc)': 'キャンセル (Esc)',
+ 'Confirm changes...': '変更の確認...',
+ 'Cancel close': '終了をキャンセル',
+ 'There are {count} canvases with unsaved changes.':
+ '未保存の変更があるキャンバスが {count} 枚あります。',
+ 'Do you want to confirm these changes before closing?':
+ '終了する前にこれらの変更を確認しますか?',
+ '{name} has been changed. Do you want to save it?':
+ '「{name}」は変更されています。保存しますか?',
+ 'Are you sure you want to close Ink Studio?': 'Ink Studio を終了してもよろしいですか?',
+ 'Discard changes': '変更を破棄',
+ 'Do Not Save': '保存しない',
+ 'Artist Profile': 'アーティストプロフィール',
+ 'Display Name': '表示名',
+ 'Artist': 'アーティスト',
+ 'Configures session metadata. Editable anytime in Preferences.':
+ 'セッションのメタデータに使用されます。環境設定からいつでも変更できます。',
+
+ // =========================================================================
+ // Crash Recovery Modal (CrashRecoveryModal.tsx)
+ // =========================================================================
+ 'Restore Unsaved Session': '未保存セッションの復元',
+ 'WAL Protected': 'WAL 保護済み',
+ 'Close recovery dialog': '復元ダイアログを閉じる',
+ 'Ink Studio detected an unexpected shutdown. Your progress can be restored from the recovery journal below.':
+ 'Ink Studio が予期せず終了したことを検出しました。以下のリカバリジャーナルから作業内容を復元できます。',
+ 'Sessions': 'セッション一覧',
+ 'Session {n}': 'セッション {n}',
+ 'Untitled Document': '名称未設定ドキュメント',
+ 'Document preview': 'ドキュメントプレビュー',
+ 'No Snapshot Preview': 'スナップショットのプレビューなし',
+ 'Canvas Size': 'キャンバスサイズ',
+ 'Resolution': '解像度',
+ 'Layer Tree': 'レイヤー構成',
+ '{n} Layer': '{n} レイヤー',
+ '{n} Layers': '{n} レイヤー',
+ 'Terminated At': '異常終了時刻',
+ 'Unknown': '不明',
+ 'Previous PID': '前回の PID',
+ 'WAL journal entries intact': 'WAL ジャーナルは正常に保持されています',
+ 'Discard All Sessions': 'すべてのセッションを破棄',
+ 'Discard All Sessions ({count})': 'すべてのセッションを破棄 ({count})',
+ 'Permanently discard all unsaved sessions': '未保存セッションをすべて完全に破棄',
+ 'Permanently discard all {count} unsaved sessions':
+ '未保存セッション {count} 件をすべて完全に破棄',
+ 'Discarding All...': 'すべて破棄中...',
+ 'Discard & Start Fresh': '破棄して新規開始',
+ 'Discarding...': '破棄中...',
+ 'Restore Session': 'セッションを復元',
+ 'Restoring Canvas...': 'キャンバスを復元中...',
+ 'colorMode::color': 'カラー',
+ 'colorMode::grayscale': 'グレースケール',
+ 'colorMode::monochrome': 'モノクロ',
+
+ // =========================================================================
+ // About Modal, Update Modal, Update Toast, Changelog & Updater Service
+ // =========================================================================
+ 'About Ink Studio': 'Ink Studio について',
+ 'Close about dialog': 'バージョン情報ダイアログを閉じる',
+ "Drawing software that doesn't charge you rent.": '月額家賃を取らないお絵描きソフト。',
+ "Built by Sora because paying a monthly subscription just to draw lines on a screen got old. It opens PSD and CSP files, loads .sut brushes, handles layers, manga tools, and multiplayer, and mostly behaves itself when you aren't looking.":
+ '画面に線を引くだけで毎月サブスク代を払うのにうんざりした Sora が開発しました。PSD・CSP ファイルの読み込みや .sut ブラシ、レイヤー、漫画制作ツール、マルチプレイに対応しており、見ていないところでもだいたいお行儀よく動きます。',
+ 'No accounts, no telemetry, no forced AI slop, no cloud launcher eating your RAM. Hit Ctrl+S anyway. All software is held together by spite and duct tape.':
+ 'アカウント登録なし、テレメトリなし、押し付けがましいAI機能なし、メモリを食い潰すクラウドランチャーもなし。それでも Ctrl+S はこまめにどうぞ。世のソフトウェアはみな意地とガムテープでできています。',
+ 'Build': 'ビルド',
+ 'Desktop': 'デスクトップ',
+ 'Web': 'Web',
+ 'License': 'ライセンス',
+ 'Stack': '技術構成',
+ "What's New in v{version}": 'v{version} の新機能',
+ 'Updates': 'アップデート',
+ 'Check for Ink Studio updates': 'Ink Studio のアップデートを確認',
+ 'Report a Bug': '不具合を報告',
+ 'Copy version info': 'バージョン情報をコピー',
+ 'Copied': 'コピー済み',
+ 'Copied version info': 'バージョン情報をコピーしました',
+ 'Failed to copy version info': 'バージョン情報のコピーに失敗しました',
+ '© 2026 Sora · Provided as-is, no warranty.': '© 2026 Sora · 現状有姿・無保証で提供されます。',
+
+ // Changelog headings
+ 'changelog::New': '新機能',
+ 'changelog::Improvements': '改善',
+ 'changelog::Bug Fixes': '不具合修正',
+ 'changelog::Other': 'その他',
+ 'changelog::Added': '追加',
+ 'changelog::Changed': '変更',
+ 'changelog::Fixed': '修正',
+ 'changelog::Changes': '変更点',
+ 'changelog::Fixes': '修正',
+
+ // Update Modal & Toast & Updater Service
+ 'Software Update': 'ソフトウェアアップデート',
+ 'Version Update': 'バージョンアップデート',
+ 'Close update modal': 'アップデートダイアログを閉じる',
+ 'Checking for updates...': 'アップデートを確認中...',
+ 'Current version: v{version}': '現在のバージョン: v{version}',
+ 'Ink Studio is up to date': 'Ink Studio は最新バージョンです',
+ 'v{version} is the latest available version.': 'v{version} が現在利用可能な最新バージョンです。',
+ 'Check Again': '再確認',
+ 'Release Notes': 'リリースノート',
+ 'Bug fixes and performance improvements.': '不具合の修正とパフォーマンスの改善を行いました。',
+ 'Skip This Version': 'このバージョンをスキップ',
+ 'Later': 'あとで',
+ 'Download & Install': 'ダウンロードしてインストール',
+ 'Confirm Restart Before Installing': 'インストール前の再起動確認',
+ 'Active Work Detected': '作業中のデータがあります',
+ 'You have unsaved changes and an active multiplayer session — save your work before installing, because Ink Studio will restart.':
+ '未保存の変更と進行中のマルチプレイセッションがあります。インストール時に Ink Studio が再起動するため、事前に作業内容を保存してください。',
+ 'You have unsaved changes — save your work before installing, because Ink Studio will restart.':
+ '未保存の変更があります。インストール時に Ink Studio が再起動するため、事前に作業内容を保存してください。',
+ 'You have an active multiplayer session — save your work before installing, because Ink Studio will restart.':
+ 'マルチプレイセッションが進行中です。インストール時に Ink Studio が再起動するため、事前に作業内容を保存してください。',
+ 'Save First': '先に保存する',
+ 'Install & Restart Anyway': 'このままインストールして再起動',
+ 'Downloading update...': 'アップデートをダウンロード中...',
+ 'Installing update & restarting...': 'アップデートをインストールして再起動中...',
+ 'Please keep Ink Studio open until the update completes.':
+ 'アップデートが完了するまで Ink Studio を閉じずにお待ちください。',
+ 'Update check failed': 'アップデートの確認に失敗しました',
+ 'Unable to reach the update server.': 'アップデートサーバーに接続できませんでした。',
+ 'Installed version: v{version}': 'インストール済みバージョン: v{version}',
+ 'Retry': '再試行',
+ 'Update Available': 'アップデート利用可能',
+ 'A new version of Ink Studio is ready to install':
+ 'Ink Studio の新しいバージョンをインストールできます',
+ 'View & Install': '詳細を見てインストール',
+ 'Dismiss update notification': 'アップデート通知を閉じる',
+ 'Dismiss notification': '通知を閉じる',
+ 'Update v{version} is available': 'アップデート v{version} が利用可能です',
+ 'Unable to check for updates': 'アップデートを確認できませんでした',
+ 'Update check failed: {message}': 'アップデートの確認に失敗しました: {message}',
+ 'No pending update found. Please check for updates again.':
+ '適用可能なアップデートが見つかりません。もう一度確認してください。',
+ 'Update installed — please restart Ink Studio to apply it':
+ 'アップデートをインストールしました — 適用するには Ink Studio を再起動してください',
+ 'Failed to download and install update': 'アップデートのダウンロード・インストールに失敗しました',
+ 'Update failed: {message}': 'アップデートに失敗しました: {message}',
+
+ // =========================================================================
+ // Focus Mode HUDs (src/components/focus/*)
+ // =========================================================================
+ 'Focus Mode HUD Settings': 'フォーカスモード HUD 設定',
+ 'Focus Mode HUD Options': 'フォーカスモード HUD オプション',
+ 'Focus Mode HUDs': 'フォーカスモード HUD',
+ 'Customize Focus Mode HUDs': 'フォーカスモード HUD をカスタマイズ',
+ 'Close Focus HUD Options': 'フォーカス HUD 設定を閉じる',
+ 'Atelier HUD': 'アトリエ HUD',
+ 'Pure Canvas': 'ピュアキャンバス',
+ 'Tool Rail': 'ツールレール',
+ 'Brush Sliders HUD': 'ブラシスライダー HUD',
+ 'Quick Action Dock': 'クイックアクションドック',
+ 'Floating Color Wheel': 'フローティングカラーサークル',
+ 'Hide Top Header Bar': '上部ヘッダーバーを隠す',
+ 'Auto-Fade While Drawing': '描画中に自動で薄く表示',
+ 'Reset HUD Positions': 'HUD の位置をリセット',
+ 'Focus HUD positions reset': 'フォーカス HUD の位置をリセットしました',
+ 'Exit Focus': 'フォーカス終了',
+ 'Exit Focus Mode (Tab)': 'フォーカスモードを終了 (Tab)',
+
+ // Focus Tool Rail
+ 'Focus Tool Rail': 'フォーカスツールレール',
+ 'Drag to move Tool Rail · Double-click to snap back':
+ 'ドラッグでツールレールを移動 · ダブルクリックで元の位置に戻す',
+ 'Brush (B)': 'ブラシ (B)',
+ 'Eraser (E)': '消しゴム (E)',
+ 'Eyedropper (I)': 'スポイト (I)',
+ 'Fill (G)': '塗りつぶし (G)',
+ 'Gradient (Shift+G)': 'グラデーション (Shift+G)',
+ 'Marquee (M)': '長方形選択 (M)',
+ 'Lasso (L)': '投げなわ選択 (L)',
+ 'Bézier Pen (P)': 'ベクターペン (P)',
+ 'Shapes (U)': '図形 (U)',
+ 'Liquify (J)': 'ゆがみ (J)',
+ 'Retouch (S)': 'レタッチ (S)',
+ 'Transform (Ctrl+T)': '自由変形 (Ctrl+T)',
+ 'Primary: {color}': '描画色: {color}',
+ 'Primary color swatch': '描画色スウォッチ',
+ 'Secondary: {color} (X to swap)': '背景色: {color}(X キーで入れ替え)',
+ 'Swap colors': '描画色と背景色を入れ替え',
+
+ // Focus Brush Sliders HUD
+ 'Focus Brush Controls': 'フォーカスブラシコントロール',
+ 'Drag to move Brush Controls · Double-click to snap back':
+ 'ドラッグでブラシコントロールを移動 · ダブルクリックで元の位置に戻す',
+ 'Expand Brush Controls': 'ブラシコントロールを展開',
+ 'Collapse Brush Controls': 'ブラシコントロールを折りたたむ',
+ 'Brush Opacity': 'ブラシ不透明度',
+ 'Brush Flow': 'インク量',
+ 'Flow / Ink': 'インク量',
+ 'Tool Strength': 'ツールの強さ',
+ 'Undo (Ctrl+Z)': '元に戻す (Ctrl+Z)',
+ 'Redo (Ctrl+Y)': 'やり直す (Ctrl+Y)',
+ 'Brush Tool': 'ブラシツール',
+ 'Eraser Tool': '消しゴムツール',
+
+ // Focus Quick Action Dock
+ 'Focus Quick Actions': 'フォーカスクイックアクション',
+ 'Drag to move Quick Action Dock · Double-click to recenter':
+ 'ドラッグでクイックアクションドックを移動 · ダブルクリックで中央に戻す',
+ 'Customize Quick Action Dock': 'クイックアクションドックをカスタマイズ',
+ 'Customize Focus Quick Actions': 'フォーカスクイックアクションをカスタマイズ',
+ 'Customize Quick Actions': 'クイックアクションをカスタマイズ',
+ 'Reset to default focus actions': '初期のフォーカスアクションに戻す',
+ 'Close customize popover': 'カスタマイズポップオーバーを閉じる',
+ 'Active ({count})': '表示中 ({count})',
+ 'Move left': '左へ移動',
+ 'Move right': '右へ移動',
+ 'Available Commands': '追加可能なコマンド',
+
+ // Focus Floating Color Card
+ 'Focus Color Wheel': 'フォーカスカラーサークル',
+ 'Drag to move Color Wheel · Double-click to snap back':
+ 'ドラッグでカラーサークルを移動 · ダブルクリックで元の位置に戻す',
+ 'Expand Color Wheel': 'カラーサークルを展開',
+ 'Collapse Color Wheel': 'カラーサークルを折りたたむ',
+ 'Hide Floating Color Wheel': 'フローティングカラーサークルを隠す',
+ 'Hide Color Wheel in Focus Mode': 'フォーカスモード中のカラーサークルを非表示にする',
+ 'Primary Color: {color}': '描画色: {color}',
+ 'Select Primary Color': '描画色を選択',
+ 'Secondary Color: {color}': '背景色: {color}',
+ 'Select Secondary Color': '背景色を選択',
+ 'Swap Primary & Secondary Colors (X)': '描画色と背景色を入れ替え (X)',
+ 'Pick recent color {color}': '最近使った色 {color} を選択',
+
+ // =========================================================================
+ // Canvas Viewport HUD (CanvasViewportHud.tsx)
+ // =========================================================================
+ 'Size {size}px': 'サイズ {size}px',
+ 'Hard {value}%': '硬さ {value}%',
+ 'Quick Palette': 'クイックパレット',
+ 'Export Chapter Slices (.zip)': 'チャプター画像をスライス書き出し (.zip)',
+ 'Export Slices': 'スライス書き出し',
+ 'Exit Webtoon Studio Mode': 'Webtoon スタジオモードを終了',
+ 'Exit Webtoon': 'Webtoon 終了',
+ 'Drop 3D model (.glb, .gltf, .obj) to load':
+ '3Dモデル(.glb / .gltf / .obj)をドロップして読み込み',
+ 'Drop image to import as layer': '画像をドロップしてレイヤーとして読み込み',
+ 'Drop 3D model (.glb, .gltf, .obj) or image':
+ '3Dモデル(.glb / .gltf / .obj)または画像をドロップ',
+
+ // =========================================================================
+ // Document Lifecycle, App Close, File Dialogs, Save Manager & External Drop
+ // =========================================================================
+ 'Failed to close window': 'ウィンドウを閉じられませんでした',
+ 'File': 'ファイル',
+ 'Save dialog is not available in this environment':
+ 'この環境では保存ダイアログを使用できません',
+ 'Save dialog was not available': '保存ダイアログを開けませんでした',
+ 'Export Image As': '画像を別名で書き出し',
+ 'Ink Studio & Image Files': 'Ink Studio・画像ファイル',
+ 'Ink Studio Project': 'Ink Studio プロジェクト',
+ 'Ink Studio Project (*.ink)': 'Ink Studio プロジェクト (*.ink)',
+ 'Photoshop Document with Layers': 'Photoshop ドキュメント(レイヤー付き)',
+ 'Photoshop Document with Layers (*.psd)': 'Photoshop ドキュメント(レイヤー付き)(*.psd)',
+ 'PNG Image': 'PNG 画像',
+ 'PNG Image (*.png)': 'PNG 画像 (*.png)',
+ 'JPEG Image': 'JPEG 画像',
+ 'JPEG Image (*.jpg, *.jpeg)': 'JPEG 画像 (*.jpg, *.jpeg)',
+ 'WebP Image': 'WebP 画像',
+ 'WebP Image (*.webp)': 'WebP 画像 (*.webp)',
+ 'Encoding {format}...': '{format} 形式でエンコード中...',
+ 'Export complete': '書き出しが完了しました',
+ 'Legacy .sora format is read-only. Save as .ink instead.':
+ '旧 .sora 形式は読み取り専用です。代わりに .ink 形式で保存してください。',
+ 'No valid file handle or disk path to save to': '保存先のファイルパスが見つかりません',
+ 'Write permission denied for file handle': 'ファイルへの書き込み権限がありません',
+
+ // .ink Serialization & Parsing (inkSerialize.ts, inkParse.ts)
+ 'Preparing project metadata...': 'プロジェクトのメタデータを準備中...',
+ 'Generating preview thumbnail...': 'プレビューサムネイルを生成中...',
+ 'Saving tiles ({done}/{total})...': 'タイルを保存中 ({done}/{total})...',
+ 'Saving layer masks ({done}/{total})...': 'レイヤーマスクを保存中 ({done}/{total})...',
+ 'Saving time-lapse frames ({done}/{total})...':
+ 'タイムラプスフレームを保存中 ({done}/{total})...',
+ 'Finalizing .ink archive...': '.ink アーカイブを作成中...',
+ 'Saved successfully': '保存が完了しました',
+ 'Invalid .ink project: expected binary ZIP container':
+ '無効な .ink プロジェクトです: ZIP コンテナ形式ではありません',
+ 'Unpacking {label} container...': '{label} コンテナを展開中...',
+ 'Unsafe archive path in {label} file: "{name}"':
+ '{label} ファイル内に安全でないアーカイブパスが含まれています: 「{name}」',
+ 'Invalid {label} project: missing manifest.json':
+ '無効な {label} プロジェクトです: manifest.json が見つかりません',
+ 'Invalid {label} project: manifest.json exceeds size limit':
+ '無効な {label} プロジェクトです: manifest.json がサイズ上限を超えています',
+ 'Invalid {label} dimensions: {width}x{height}':
+ '{label} のキャンバスサイズが無効です: {width}×{height}',
+ 'Invalid {label} manifest: missing layers array':
+ '無効な {label} マニフェストです: layers 配列が見つかりません',
+ 'Invalid {label} project: tile count {count} exceeds limit':
+ '無効な {label} プロジェクトです: タイル数 {count} が上限を超えています',
+ 'Invalid tile coordinates in {label} archive: {path}':
+ '{label} アーカイブ内のタイル座標が無効です: {path}',
+ 'Loading tiles ({done}/{total})...': 'タイルを読み込み中 ({done}/{total})...',
+ 'Invalid {label} project: time-lapse frame count {count} exceeds limit':
+ '無効な {label} プロジェクトです: タイムラプスフレーム数 {count} が上限を超えています',
+ 'Unsafe time-lapse frame path in {label} archive: "{path}"':
+ '{label} アーカイブ内に安全でないタイムラプスパスが含まれています: 「{path}」',
+ 'Invalid {label} project: time-lapse frame "{path}" exceeds 8 MB size limit':
+ '無効な {label} プロジェクトです: タイムラプスフレーム「{path}」が 8 MB の上限を超えています',
+ 'Loading time-lapse frames ({done}/{total})...':
+ 'タイムラプスフレームを読み込み中 ({done}/{total})...',
+ 'Project loaded': 'プロジェクトを読み込みました',
+
+ // Document Lifecycle Manager toasts, progress & dialogs
+ 'layer': 'レイヤー',
+ 'Viewers have read-only access': '閲覧者は読み取り専用です',
+ 'Cannot delete the only raster layer': '最後のラスターレイヤーは削除できません',
+ 'Deleted layer "{name}"': 'レイヤー「{name}」を削除しました',
+ 'Copied layer "{name}"': 'レイヤー「{name}」をコピーしました',
+ 'Clipboard is empty': 'クリップボードが空です',
+ 'Pasted into "{name}"': '「{name}」に貼り付けました',
+ 'Paste "{name}"': '「{name}」を貼り付け',
+ 'Pasted "{name}" from file': 'ファイルから「{name}」を貼り付けました',
+ 'Paste Image Failed': '画像の貼り付けに失敗しました',
+ 'Failed to paste image from file: {error}': 'ファイルからの画像貼り付けに失敗しました: {error}',
+ 'Switched to {name}': '「{name}」に切り替えました',
+ 'Created {name}': '「{name}」を作成しました',
+ 'Crop / Resize Canvas ({width} × {height})': 'キャンバス切り抜き・サイズ変更 ({width} × {height})',
+ 'Resize Canvas ({width} × {height})': 'キャンバスサイズ変更 ({width} × {height})',
+ 'Canvas resized to {width} × {height} px': 'キャンバスサイズを {width} × {height} px に変更しました',
+ 'Saved to {name}': '「{name}」に保存しました',
+ 'Saved as {name}': '「{name}」として保存しました',
+ 'Save Failed': '保存に失敗しました',
+ 'Failed to save file.': 'ファイルの保存に失敗しました。',
+ 'Exported image to {name}': '「{name}」に画像を書き出しました',
+ 'Export Failed': '書き出しに失敗しました',
+ 'Failed to export image.': '画像の書き出しに失敗しました。',
+ 'Loading {name}...': '「{name}」を読み込み中...',
+ 'Importing Brush: {name}...': 'ブラシ「{name}」を読み込み中...',
+ 'Imported brush "{name}"': 'ブラシ「{name}」を読み込みました',
+ 'Failed to import brush file.': 'ブラシファイルの読み込みに失敗しました。',
+ 'Importing Color Set: {name}...': 'カラーセット「{name}」を読み込み中...',
+ 'Imported color set "{name}" ({count} colors)':
+ 'カラーセット「{name}」({count}色)を読み込みました',
+ 'Failed to import color set file.': 'カラーセットファイルの読み込みに失敗しました。',
+ 'Importing 3D model "{name}" into 3D stage...':
+ '3Dモデル「{name}」を3Dステージへ読み込み中...',
+ 'Migrating time-lapse to local storage ({count} frame)...':
+ 'タイムラプスをローカルストレージへ移行中 ({count} フレーム)...',
+ 'Migrating time-lapse to local storage ({count} frames)...':
+ 'タイムラプスをローカルストレージへ移行中 ({count} フレーム)...',
+ 'Migrating time-lapse to local storage ({done}/{total})...':
+ 'タイムラプスをローカルストレージへ移行中 ({done}/{total})...',
+ 'Opened {name}': '「{name}」を開きました',
+ 'Opened {name} — time-lapse resumed': '「{name}」を開きました — タイムラプス録画を再開',
+ 'Opened {name} — time-lapse resumed ({count} frames)':
+ '「{name}」を開きました — タイムラプス録画を再開({count} フレーム)',
+ 'Migrated legacy {name} (read-only) — save as .ink':
+ '旧形式「{name}」を読み込みました(読み取り専用)— .ink で保存してください',
+ 'Imported "{name}" (Notice: {notice})': '「{name}」を読み込みました(注意: {notice})',
+ 'Imported "{name}" with {count} CSP import notices — check inspector':
+ '「{name}」を読み込みました(CSP読み込み注意: {count}件 — インスペクターで確認)',
+ 'Could Not Open File': 'ファイルを開けませんでした',
+ 'Could not open "{name}".': '「{name}」を開けませんでした。',
+ 'Unsupported or corrupted file.': '未対応の形式、またはファイルが破損しています。',
+ 'File could not be read.': 'ファイルを読み込めませんでした。',
+ 'Permission denied to open "{title}"': '「{title}」を開く権限がありません',
+ 'Cannot reopen "{title}" directly — select the file to open':
+ '「{title}」を直接開き直せません — 開くファイルを選択してください',
+ 'Session restored from crash': 'クラッシュ前のセッションを復元しました',
+ 'Restored "{name}" ({strokes} strokes, {mutations} mutations recovered)':
+ '「{name}」を復元しました({strokes} ストローク・{mutations} 操作を復旧)',
+ 'Recovery Failed': '復元に失敗しました',
+ 'Failed to restore crashed session.': 'クラッシュ前のセッションの復元に失敗しました。',
+ 'Crashed session discarded': 'クラッシュ前のセッションを破棄しました',
+ 'Discarded all {count} crashed sessions': 'クラッシュ前のセッション {count} 件をすべて破棄しました',
+ 'Discarded {discarded} of {total} crashed sessions':
+ 'クラッシュ前のセッション {total} 件中 {discarded} 件を破棄しました',
+ 'Page reload blocked to protect unsaved artwork':
+ '未保存の作品を保護するため、ページの再読み込みをブロックしました',
+ 'Page reload is disabled in Ink Studio': 'Ink Studio ではページの再読み込みが無効になっています',
+
+ // External File Drop (useExternalFileDrop.ts)
+ ', ': '、',
+ '{count} skipped': '{count}件スキップ',
+ 'max {max} per drop': '1回のドロップ上限 {max}件',
+ 'Imported {count} image as layer': '{count}枚の画像をレイヤーとして読み込みました',
+ 'Imported {count} image as layer ({notes})':
+ '{count}枚の画像をレイヤーとして読み込みました({notes})',
+ 'Imported {count} images as layers': '{count}枚の画像をレイヤーとして読み込みました',
+ 'Imported {count} images as layers ({notes})':
+ '{count}枚の画像をレイヤーとして読み込みました({notes})',
+ 'Imported "{name}" as layer': '「{name}」をレイヤーとして読み込みました',
+ '3D model exceeds 250 MB limit.': '3Dモデルが 250 MB の上限を超えています。',
+ 'Image exceeds 100 MB limit.': '画像が 100 MB の上限を超えています。',
+ 'Failed to read dropped 3D model file.': 'ドロップされた3Dモデルファイルを読み込めませんでした。',
+ 'Failed to import dropped 3D model.': 'ドロップされた3Dモデルの読み込みに失敗しました。',
+ 'Failed to read dropped image file.': 'ドロップされた画像ファイルを読み込めませんでした。',
+ 'Failed to import dropped image.': 'ドロップされた画像の読み込みに失敗しました。',
+ 'Unsupported file type. Drop .glb, .gltf, .obj 3D models or PNG, JPG, WebP, GIF, BMP, SVG images.':
+ '未対応のファイル形式です。.glb / .gltf / .obj の3Dモデル、または PNG / JPG / WebP / GIF / BMP / SVG 画像をドロップしてください。',
+ 'Unsupported file type. Drop a .glb, .gltf, or .obj 3D model.':
+ '未対応のファイル形式です。.glb / .gltf / .obj の3Dモデルをドロップしてください。',
+ 'Unsupported file type. Drop PNG, JPG, WebP, GIF, BMP, or SVG images.':
+ '未対応のファイル形式です。PNG / JPG / WebP / GIF / BMP / SVG 画像をドロップしてください。',
+
+ // Contextual homonym disambiguations
+ 'dpiPreset::Screen': '画面用',
+ 'aspectRatio::Free': 'フリー',
+};
diff --git a/src/i18n/types.ts b/src/i18n/types.ts
new file mode 100644
index 0000000..35e3265
--- /dev/null
+++ b/src/i18n/types.ts
@@ -0,0 +1,17 @@
+export type AppLanguage = 'auto' | 'en' | 'ja';
+
+export type ResolvedLanguage = 'en' | 'ja';
+
+export type TranslationParams = Record<string, string | number | boolean | null | undefined>;
+
+export type TranslationDictionary = Record<string, string>;
+
+export interface ImeKeyboardEventLike {
+ isComposing?: boolean;
+ keyCode?: number;
+ key?: string;
+ nativeEvent?: {
+ isComposing?: boolean;
+ keyCode?: number;
+ };
+}
diff --git a/src/index.css b/src/index.css
index f30b4cb..e509864 100644
--- a/src/index.css
+++ b/src/index.css
@@ -103,8 +103,8 @@
--ui-control-height: 26px;
--ui-row-height: 28px;
--ui-options-bar-height: 32px;
- --ui-font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
- --ui-font-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, ui-monospace, monospace;
+ --ui-font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "BIZ UDPGothic", "Meiryo", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
+ --ui-font-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "BIZ UDGothic", "Yu Gothic", "Meiryo", ui-monospace, monospace;
--ui-icon-stroke: 1.5;
--ui-scrollbar-size: 9px;
--ui-floating-opacity: 0.96;
@@ -141,6 +141,13 @@
color-scheme: light;
}
+:root[lang="ja"] body,
+:root[lang="ja"] #root {
+ line-height: 1.45;
+ word-break: normal;
+ overflow-wrap: anywhere;
+}
+
@layer base {
* {
box-sizing: border-box;
diff --git a/src/main.tsx b/src/main.tsx
index 1898734..1ba3ece 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,6 +1,8 @@
import React, { Component, ErrorInfo, ReactNode } from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
+import { markIntentionalReload } from "./utils/reloadGuard";
+import { t } from "./i18n";
import "./index.css";
interface Props {
@@ -31,18 +33,19 @@ class ErrorBoundary extends Component<Props, State> {
return (
<div className="flex flex-col items-center justify-center w-screen h-screen bg-[#1e1e1e] text-[#cccccc] p-8 text-center font-sans select-none">
<div className="bg-[#252525] border border-red-500/40 rounded-lg p-6 max-w-lg shadow-2xl">
- <h2 className="text-lg font-bold text-red-400 mb-2">Graphics Editor Encountered an Error</h2>
+ <h2 className="text-lg font-bold text-red-400 mb-2">{t('Graphics Editor Encountered an Error')}</h2>
<p className="text-xs text-[#888888] mb-4 font-mono break-all">
- {this.state.error?.message || "An unexpected error occurred."}
+ {this.state.error?.message || t('An unexpected error occurred.')}
</p>
<button
onClick={() => {
this.setState({ hasError: false, error: null });
+ markIntentionalReload();
window.location.reload();
}}
className="px-4 py-1.5 bg-blue-600 hover:bg-blue-500 text-white rounded text-xs font-medium transition-colors"
>
- Reload Editor
+ {t('Reload Editor')}
</button>
</div>
</div>
diff --git a/src/services/bake3DService.ts b/src/services/bake3DService.ts
index 641e95b..24fc623 100644
--- a/src/services/bake3DService.ts
+++ b/src/services/bake3DService.ts
@@ -4,6 +4,7 @@ import { documentStore } from '../utils/documentStore';
import { performanceManager } from '../utils/performanceManager';
import { multiplayerService } from './multiplayerService';
import { applyScreentoneCPU } from '../utils/screentoneEngine';
+import { t, td } from '../i18n';
export interface Bake3DOptions {
scene: THREE.Scene;
@@ -156,8 +157,8 @@ export function createSafeWebGLRenderer(
throw new Error(
lastError instanceof Error
- ? `WebGL initialization failed: ${lastError.message}`
- : 'Unable to initialize a valid WebGL context for 3D rendering.'
+ ? t('WebGL initialization failed: {message}', { message: lastError.message })
+ : t('Unable to initialize a valid WebGL context for 3D rendering.')
);
}
@@ -345,7 +346,7 @@ export async function bake3DToRasterLayer(options: Bake3DOptions): Promise<Bake3
camera,
dimensions,
activeRenderer,
- layerName = '3D Layer',
+ layerName = t('3D Layer'),
opacity = 1,
blendMode = 'normal',
disposeOnComplete = true,
@@ -420,7 +421,7 @@ export async function bake3DToRasterLayer(options: Bake3DOptions): Promise<Bake3
if (!reusedActiveRenderer) {
disposeThreeResources(null, offscreenRenderer);
}
- throw new Error('Unable to create 2D canvas context for 3D rasterization');
+ throw new Error(t('Unable to create 2D canvas context for 3D rasterization'));
}
ctx.drawImage(offscreenRenderer.domElement, 0, 0, targetWidth, targetHeight);
@@ -874,7 +875,8 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
// Group Folder Name Resolution
const rawModelName = modelName || baseLayerName || 'Model';
const cleanModelName = rawModelName.replace(/\.[^/.]+$/, '').trim();
- const folderName = targetFolderName?.trim() || `3D Extraction [${cleanModelName}]`;
+ const folderName =
+ targetFolderName?.trim() || t('3D Extraction [{name}]', { name: td(cleanModelName) });
const folderId = `folder-lt-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
// 5. Posterize Diffuse Lighting into 1 to 4 Mutually Exclusive Manga Screentone Shadow Tiers
@@ -899,7 +901,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[0] ?? 0.45,
frequency: toneFrequencies?.[0] ?? 60,
angle: toneAngles?.[0] ?? 45,
- name: '3D Tone (Deep)',
+ name: t('3D Tone (Deep)'),
});
} else if (resolvedToneCount === 2) {
tierConfigs.push(
@@ -909,7 +911,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[0] ?? 0.20,
frequency: toneFrequencies?.[0] ?? 60,
angle: toneAngles?.[0] ?? 45,
- name: '3D Tone 1 (Light)',
+ name: t('3D Tone 1 (Light)'),
},
{
minLum: -1.0,
@@ -917,7 +919,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[1] ?? 0.45,
frequency: toneFrequencies?.[1] ?? 60,
angle: toneAngles?.[1] ?? 45,
- name: '3D Tone 2 (Deep)',
+ name: t('3D Tone 2 (Deep)'),
}
);
} else if (resolvedToneCount === 3) {
@@ -928,7 +930,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[0] ?? 0.15,
frequency: toneFrequencies?.[0] ?? 60,
angle: toneAngles?.[0] ?? 45,
- name: '3D Tone 1 (Light)',
+ name: t('3D Tone 1 (Light)'),
},
{
minLum: 0.25,
@@ -936,7 +938,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[1] ?? 0.30,
frequency: toneFrequencies?.[1] ?? 60,
angle: toneAngles?.[1] ?? 45,
- name: '3D Tone 2 (Mid)',
+ name: t('3D Tone 2 (Mid)'),
},
{
minLum: -1.0,
@@ -944,7 +946,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[2] ?? 0.50,
frequency: toneFrequencies?.[2] ?? 60,
angle: toneAngles?.[2] ?? 45,
- name: '3D Tone 3 (Deep)',
+ name: t('3D Tone 3 (Deep)'),
}
);
} else {
@@ -956,7 +958,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[0] ?? 0.10,
frequency: toneFrequencies?.[0] ?? 60,
angle: toneAngles?.[0] ?? 45,
- name: '3D Tone 1 (Light)',
+ name: t('3D Tone 1 (Light)'),
},
{
minLum: 0.35,
@@ -964,7 +966,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[1] ?? 0.25,
frequency: toneFrequencies?.[1] ?? 60,
angle: toneAngles?.[1] ?? 45,
- name: '3D Tone 2 (Mid-Light)',
+ name: t('3D Tone 2 (Mid-Light)'),
},
{
minLum: 0.18,
@@ -972,7 +974,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[2] ?? 0.40,
frequency: toneFrequencies?.[2] ?? 60,
angle: toneAngles?.[2] ?? 45,
- name: '3D Tone 3 (Mid-Deep)',
+ name: t('3D Tone 3 (Mid-Deep)'),
},
{
minLum: -1.0,
@@ -980,7 +982,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
density: toneDensities?.[3] ?? 0.55,
frequency: toneFrequencies?.[3] ?? 60,
angle: toneAngles?.[3] ?? 45,
- name: '3D Tone 4 (Deep)',
+ name: t('3D Tone 4 (Deep)'),
}
);
}
@@ -1074,7 +1076,7 @@ export async function bake3DToLineAndTone(options: Bake3DLTOptions): Promise<Bak
const lineDataUrl = previewOnly ? '' : lineCanvas.toDataURL('image/png');
const lineLayer: LayerItem = {
id: `raster-lt-line-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`,
- name: '3D Outline',
+ name: t('3D Outline'),
type: 'raster',
visible: true,
opacity: 1,
diff --git a/src/services/updaterService.ts b/src/services/updaterService.ts
index 7d4990c..71203ee 100644
--- a/src/services/updaterService.ts
+++ b/src/services/updaterService.ts
@@ -3,6 +3,7 @@ import { version as PACKAGE_VERSION } from '../../package.json';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
import { uiStoreActions, useUiStore } from '../stores/useUiStore';
import { updaterStoreActions, useUpdaterStore } from '../stores/useUpdaterStore';
+import { t } from '../i18n';
export interface CheckForUpdatesOptions {
silent?: boolean;
@@ -115,7 +116,7 @@ export async function checkForUpdates(
});
if (!silent && !modalCurrentlyOpen) {
- uiStoreActions.showToast(`Update v${update.version} is available`);
+ uiStoreActions.showToast(t('Update v{version} is available', { version: update.version }));
}
return true;
@@ -134,12 +135,12 @@ export async function checkForUpdates(
});
if (!silent) {
- uiStoreActions.showToast('Ink Studio is up to date');
+ uiStoreActions.showToast(t('Ink Studio is up to date'));
}
return false;
} catch (err: unknown) {
- const message = formatErrorMessage(err, 'Unable to check for updates');
+ const message = formatErrorMessage(err, t('Unable to check for updates'));
if (silent) {
console.warn('[Updater] Silent update check failed:', err);
@@ -153,7 +154,7 @@ export async function checkForUpdates(
status: 'error',
errorMessage: message,
});
- uiStoreActions.showToast(`Update check failed: ${message}`);
+ uiStoreActions.showToast(t('Update check failed: {message}', { message }));
}
return false;
@@ -173,7 +174,7 @@ export async function downloadAndInstallUpdate(): Promise<boolean> {
}
if (!pendingUpdate) {
- const message = 'No pending update found. Please check for updates again.';
+ const message = t('No pending update found. Please check for updates again.');
useUpdaterStore.setState({
status: 'error',
errorMessage: message,
@@ -254,18 +255,18 @@ export async function downloadAndInstallUpdate(): Promise<boolean> {
await relaunch();
} catch (relaunchErr: unknown) {
console.warn('[Updater] Automatic relaunch did not complete:', relaunchErr);
- uiStoreActions.showToast('Update installed — please restart Ink Studio to apply it');
+ uiStoreActions.showToast(t('Update installed — please restart Ink Studio to apply it'));
}
return true;
} catch (err: unknown) {
- const message = formatErrorMessage(err, 'Failed to download and install update');
+ const message = formatErrorMessage(err, t('Failed to download and install update'));
console.warn('[Updater] Download/install failed:', err);
useUpdaterStore.setState({
status: 'error',
errorMessage: message,
});
- uiStoreActions.showToast(`Update failed: ${message}`);
+ uiStoreActions.showToast(t('Update failed: {message}', { message }));
return false;
} finally {
isDownloadInFlight = false;
diff --git a/src/stores/useDocumentStore.ts b/src/stores/useDocumentStore.ts
index 963c3e1..16f29f9 100644
--- a/src/stores/useDocumentStore.ts
+++ b/src/stores/useDocumentStore.ts
@@ -1,6 +1,7 @@
import {
CanvasDimensions,
CanvasColorMode,
+ DocumentStateDelta,
DocumentTab,
SoftProofSettings,
DEFAULT_SOFT_PROOF_SETTINGS,
@@ -52,9 +53,41 @@ const createInitialDocumentState = (): DocumentStoreState => ({
activeLockedAxis: null,
});
+export type DocumentHistoryRecorder = (
+ label: string,
+ delta: DocumentStateDelta
+) => void;
+
+export interface DocumentMutationHistoryOptions {
+ recordHistory?: boolean;
+ label?: string;
+ coalesceKey?: string;
+}
+
+let activeRulerHistoryRecorder: DocumentHistoryRecorder | null = null;
+let suppressRulerHistoryDepth = 0;
+
+function cloneRulerValue<T>(val: T): T {
+ if (val === null || val === undefined) return val;
+ return JSON.parse(JSON.stringify(val));
+}
+
export const useDocumentStore = createStore<DocumentStoreState>(createInitialDocumentState);
export const documentStoreActions = {
+ setRulerHistoryRecorder(recorder: DocumentHistoryRecorder | null): void {
+ activeRulerHistoryRecorder = recorder;
+ },
+
+ runWithoutRulerHistory<T>(fn: () => T): T {
+ suppressRulerHistoryDepth += 1;
+ try {
+ return fn();
+ } finally {
+ suppressRulerHistoryDepth = Math.max(0, suppressRulerHistoryDepth - 1);
+ }
+ },
+
setDocuments(updater: DocumentTab[] | ((prev: DocumentTab[]) => DocumentTab[])): void {
useDocumentStore.setState((prev) => ({
documents: typeof updater === 'function' ? updater(prev.documents) : updater,
@@ -76,11 +109,39 @@ export const documentStoreActions = {
});
},
- setDimensions(dimensions: CanvasDimensions): void {
- useDocumentStore.setState({ dimensions });
+ /**
+ * Updates active canvas dimensions. When `syncDocId` is provided (e.g. during canvas resize,
+ * undo/redo, or remote resize), also updates that document tab's `dimensions` atomically so
+ * `Ctrl+S`, tab switching, and recovery checkpoints never observe stale pre-resize dimensions.
+ */
+ setDimensions(dimensions: CanvasDimensions, syncDocId?: string | null): void {
+ const normalized: CanvasDimensions = {
+ width: dimensions.width,
+ height: dimensions.height,
+ ...(dimensions.dpi !== undefined ? { dpi: dimensions.dpi } : {}),
+ };
+ if (syncDocId) {
+ useDocumentStore.setState((prev) => ({
+ dimensions: normalized,
+ documents: prev.documents.map((d) =>
+ d.id === syncDocId ? { ...d, dimensions: normalized } : d
+ ),
+ }));
+ return;
+ }
+ useDocumentStore.setState({ dimensions: normalized });
},
- setColorMode(colorMode: CanvasColorMode): void {
+ setColorMode(colorMode: CanvasColorMode, syncDocId?: string | null): void {
+ if (syncDocId) {
+ useDocumentStore.setState((prev) => ({
+ colorMode,
+ documents: prev.documents.map((d) =>
+ d.id === syncDocId ? { ...d, colorMode } : d
+ ),
+ }));
+ return;
+ }
useDocumentStore.setState({ colorMode });
},
@@ -145,10 +206,14 @@ export const documentStoreActions = {
updater:
| PerspectiveRuler
| null
- | ((prev: PerspectiveRuler | null) => PerspectiveRuler | null)
+ | ((prev: PerspectiveRuler | null) => PerspectiveRuler | null),
+ options?: DocumentMutationHistoryOptions
): void {
+ const before = useDocumentStore.getState().perspectiveRuler;
+ let nextValue: PerspectiveRuler | null = before;
useDocumentStore.setState((prev) => {
const next = typeof updater === 'function' ? updater(prev.perspectiveRuler) : updater;
+ nextValue = next;
if (prev.activeDocumentId) {
return {
perspectiveRuler: next,
@@ -159,16 +224,42 @@ export const documentStoreActions = {
}
return { perspectiveRuler: next };
});
+
+ if (
+ options?.recordHistory !== false &&
+ suppressRulerHistoryDepth === 0 &&
+ activeRulerHistoryRecorder &&
+ before !== nextValue
+ ) {
+ const label =
+ options?.label ||
+ (!before && nextValue
+ ? 'Add Perspective Ruler'
+ : before && !nextValue
+ ? 'Remove Perspective Ruler'
+ : 'Edit Perspective Ruler');
+ activeRulerHistoryRecorder(label, {
+ beforePerspectiveRuler: cloneRulerValue(before),
+ afterPerspectiveRuler: cloneRulerValue(nextValue),
+ coalesceKey:
+ options?.coalesceKey ??
+ (before && nextValue ? 'perspective-ruler' : undefined),
+ });
+ }
},
setStraightRuler(
updater:
| StraightRuler
| null
- | ((prev: StraightRuler | null) => StraightRuler | null)
+ | ((prev: StraightRuler | null) => StraightRuler | null),
+ options?: DocumentMutationHistoryOptions
): void {
+ const before = useDocumentStore.getState().straightRuler;
+ let nextValue: StraightRuler | null = before;
useDocumentStore.setState((prev) => {
const next = typeof updater === 'function' ? updater(prev.straightRuler) : updater;
+ nextValue = next;
if (prev.activeDocumentId) {
return {
straightRuler: next,
@@ -179,6 +270,34 @@ export const documentStoreActions = {
}
return { straightRuler: next };
});
+
+ if (
+ options?.recordHistory !== false &&
+ suppressRulerHistoryDepth === 0 &&
+ activeRulerHistoryRecorder &&
+ before !== nextValue
+ ) {
+ const label =
+ options?.label ||
+ (!before && nextValue
+ ? 'Enable Straight Ruler'
+ : before && !nextValue
+ ? 'Remove Straight Ruler'
+ : before?.enabled !== nextValue?.enabled
+ ? nextValue?.enabled
+ ? 'Enable Straight Ruler'
+ : 'Disable Straight Ruler'
+ : 'Edit Straight Ruler');
+ activeRulerHistoryRecorder(label, {
+ beforeStraightRuler: cloneRulerValue(before),
+ afterStraightRuler: cloneRulerValue(nextValue),
+ coalesceKey:
+ options?.coalesceKey ??
+ (before && nextValue && before.enabled === nextValue.enabled
+ ? 'straight-ruler'
+ : undefined),
+ });
+ }
},
toggleStraightRuler(centerX?: number, centerY?: number): StraightRuler {
@@ -189,7 +308,9 @@ export const documentStoreActions = {
const next: StraightRuler = prev
? { ...prev, enabled: !prev.enabled }
: createDefaultStraightRuler(cx, cy);
- documentStoreActions.setStraightRuler(next);
+ documentStoreActions.setStraightRuler(next, {
+ label: next.enabled ? 'Enable Straight Ruler' : 'Disable Straight Ruler',
+ });
return next;
},
diff --git a/src/stores/useUiStore.ts b/src/stores/useUiStore.ts
index ff61353..3a55a79 100644
--- a/src/stores/useUiStore.ts
+++ b/src/stores/useUiStore.ts
@@ -1,10 +1,16 @@
import {
+ AppLanguage,
AppSettings,
ModernAccentColor,
loadAppSettings,
reconcileAppearanceSettings,
saveAppSettings,
} from '../types/settings';
+import {
+ sanitizeAppLanguage,
+ setLanguagePreference,
+ t,
+} from '../i18n';
import {
AccentPigmentId,
AppearanceConfig,
@@ -192,6 +198,7 @@ function readStoredNumber(key: string, fallback: number): number {
const createInitialUiState = (): UiStoreState => {
const initialSettings = loadAppSettings();
+ setLanguagePreference(initialSettings.language);
performanceManager.applySettings(initialSettings);
void applyInterfaceScale(initialSettings.interfaceScale);
applyAppearanceToDocument(initialSettings.appearance, {
@@ -303,14 +310,31 @@ export const uiStoreActions = {
updateAppSettings(newSettings: AppSettings): void {
const prevSettings = useUiStore.getState().appSettings;
const reconciled = reconcileAppearanceSettings(prevSettings, newSettings);
- performanceManager.applySettings(reconciled);
- void applyInterfaceScale(reconciled.interfaceScale);
- applyAppearanceToDocument(reconciled.appearance, {
- themePreset: reconciled.themePreset,
- legacyAccent: reconciled.modernAccent,
+ const validLanguage = sanitizeAppLanguage(reconciled.language);
+ const nextSettings: AppSettings = { ...reconciled, language: validLanguage };
+ setLanguagePreference(validLanguage);
+ performanceManager.applySettings(nextSettings);
+ void applyInterfaceScale(nextSettings.interfaceScale);
+ applyAppearanceToDocument(nextSettings.appearance, {
+ themePreset: nextSettings.themePreset,
+ legacyAccent: nextSettings.modernAccent,
});
- useUiStore.setState({ appSettings: reconciled });
- saveAppSettings(reconciled);
+ useUiStore.setState({ appSettings: nextSettings });
+ saveAppSettings(nextSettings);
+ },
+
+ setLanguage(language: AppLanguage, options: { persist?: boolean } = {}): void {
+ const prevSettings = useUiStore.getState().appSettings;
+ const validLanguage = sanitizeAppLanguage(language);
+ setLanguagePreference(validLanguage);
+ const nextSettings: AppSettings = {
+ ...prevSettings,
+ language: validLanguage,
+ };
+ useUiStore.setState({ appSettings: nextSettings });
+ if (options.persist !== false) {
+ saveAppSettings(nextSettings);
+ }
},
updateAppearance(
@@ -533,8 +557,8 @@ export const uiStoreActions = {
title: options.title,
message: options.message,
detail: options.detail,
- confirmLabel: options.confirmLabel ?? (variant === 'danger' ? 'Delete' : 'OK'),
- cancelLabel: options.cancelLabel ?? 'Cancel',
+ confirmLabel: options.confirmLabel ?? (variant === 'danger' ? t('Delete') : t('OK')),
+ cancelLabel: options.cancelLabel ?? t('Cancel'),
preview: options.preview ?? null,
},
});
@@ -546,7 +570,7 @@ export const uiStoreActions = {
.confirmDialog({
...options,
variant: 'alert',
- confirmLabel: options.confirmLabel ?? 'OK',
+ confirmLabel: options.confirmLabel ?? t('OK'),
})
.then(() => undefined);
},
diff --git a/src/types/editor.ts b/src/types/editor.ts
index 5d86bb9..08f3876 100644
--- a/src/types/editor.ts
+++ b/src/types/editor.ts
@@ -781,7 +781,11 @@ export type HistoryActionType =
| 'pen'
| 'filter'
| 'auto-action'
- | 'layer';
+ | 'layer'
+ | 'canvas-resize'
+ | 'selection'
+ | 'ruler'
+ | 'animation';
export type LiquifyMode =
| 'push'
@@ -1204,6 +1208,21 @@ export interface LayerTreeDelta {
afterActiveLayerId?: string;
}
+export interface DocumentStateDelta {
+ beforeDimensions?: CanvasDimensions;
+ afterDimensions?: CanvasDimensions;
+ beforePerspectiveRuler?: PerspectiveRuler | null;
+ afterPerspectiveRuler?: PerspectiveRuler | null;
+ beforeStraightRuler?: StraightRuler | null;
+ afterStraightRuler?: StraightRuler | null;
+ beforeAnimationTimeline?: AnimationTimeline | null;
+ afterAnimationTimeline?: AnimationTimeline | null;
+ beforeSelection?: CanvasSelection | null;
+ afterSelection?: CanvasSelection | null;
+ /** Optional key to coalesce rapid continuous drags (e.g. ruler handle drag, animation slider). */
+ coalesceKey?: string;
+}
+
export interface HistoryItem extends HistoryItemMeta {
imageData?: ImageData;
beforeImageData?: ImageData | null;
@@ -1217,6 +1236,7 @@ export interface HistoryItem extends HistoryItemMeta {
after: VectorStroke[];
};
layerTreeDelta?: LayerTreeDelta;
+ documentStateDelta?: DocumentStateDelta;
peerId?: string | number;
strokeId?: string;
isMaskEdit?: boolean;
diff --git a/src/types/settings.ts b/src/types/settings.ts
index 83fb8b0..2c98aad 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -12,6 +12,13 @@ import {
DEFAULT_INTERFACE_SCALE,
clampInterfaceScale,
} from '../utils/interfaceScale';
+import {
+ AppLanguage,
+ DEFAULT_APP_LANGUAGE,
+ sanitizeAppLanguage,
+} from '../i18n';
+
+export type { AppLanguage };
export type { AppearanceConfig };
export { DEFAULT_APPEARANCE_CONFIG };
@@ -209,9 +216,10 @@ export type Preview3DMaxResolution = 1024 | 1920 | 2560;
export type PerformancePresetId = 'battery' | 'balanced' | 'maximum' | 'compatibility';
export interface AppSettings {
- // User Profile
+ // User Profile & Language
userName: string;
hasPromptedName: boolean;
+ language: AppLanguage;
// Appearance & Theme
themePreset: ThemePreset;
@@ -280,6 +288,7 @@ export interface AppSettings {
export const DEFAULT_APP_SETTINGS: AppSettings = {
userName: '',
hasPromptedName: true,
+ language: DEFAULT_APP_LANGUAGE,
themePreset: 'modern',
modernAccent: 'neutral',
modernCustomColor: DEFAULT_ACCENT_HEX,
@@ -469,6 +478,7 @@ export function loadAppSettings(): AppSettings {
const storedNickname = localStorage.getItem(NICKNAME_STORAGE_KEY) || '';
if (raw) {
const parsed = JSON.parse(raw);
+ const validLanguage: AppLanguage = sanitizeAppLanguage(parsed.language);
const validTheme: ThemePreset = 'modern';
const validAccent: ModernAccentColor = [
'neutral',
@@ -633,6 +643,7 @@ export function loadAppSettings(): AppSettings {
...parsed,
userName: parsed.userName !== undefined ? parsed.userName : storedNickname,
hasPromptedName: parsed.hasPromptedName !== undefined ? parsed.hasPromptedName : true,
+ language: validLanguage,
themePreset: validTheme,
modernAccent: validAccent,
modernCustomColor: validCustomColor,
diff --git a/src/utils/__tests__/canvasResizeSaveAndUndo.test.tsx b/src/utils/__tests__/canvasResizeSaveAndUndo.test.tsx
new file mode 100644
index 0000000..151a220
--- /dev/null
+++ b/src/utils/__tests__/canvasResizeSaveAndUndo.test.tsx
@@ -0,0 +1,1314 @@
+import React, { act, useCallback, useEffect, useRef } from 'react';
+import { createRoot, Root } from 'react-dom/client';
+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
+import {
+ AnimationTimeline,
+ CanvasDimensions,
+ DocumentStateDelta,
+ DocumentTab,
+ LayerItem,
+} from '../../types/editor';
+import type { PerspectiveRuler, StraightRuler } from '../../types/perspective';
+import type { ResizeCanvasOptions } from '../../types/settings';
+import {
+ SparseTileGrid,
+ InMemoryScratchDiskDriver,
+ TileMemoryManager,
+ TILE_SIZE,
+ pixelToTileCoord,
+} from '../tileEngine';
+import { documentStore } from '../documentStore';
+import {
+ documentStoreActions,
+ uiStoreActions,
+ useDocumentStore,
+ useUiStore,
+} from '../../stores';
+import { serializeInkProject, parseInkProject } from '../saveManager';
+import { hydratePagedTilesForLayers } from '../saveManager/exportGridPrep';
+import { useLayerManager } from '../../hooks/useLayerManager';
+import {
+ useDrawingHistory,
+ useSelectionTools,
+ type PushHistoryStepFn,
+} from '../../hooks/drawing';
+import { useDocumentLifecycle } from '../../components/DocumentLifecycleManager';
+import { ResizeCanvasModal } from '../../components/ResizeCanvasModal';
+import { createLayerTreeSnapshotDelta } from '../../hooks/layerManager/layerTreeOps';
+import { createDefaultAnimationTimeline, setFrameCel } from '../animationEngine';
+
+// ---------------------------------------------------------------------------
+// Minimal DOM shim for React 19 createRoot tests without jsdom dependency
+// ---------------------------------------------------------------------------
+
+class MiniText {
+ nodeType = 3;
+ nodeName = '#text';
+ parentNode: MiniEl | null = null;
+ ownerDocument: MiniDoc;
+ private _data: string;
+ constructor(data: string, doc: MiniDoc) {
+ this._data = String(data);
+ this.ownerDocument = doc;
+ }
+ get data() {
+ return this._data;
+ }
+ set data(v: string) {
+ this._data = String(v);
+ }
+ get nodeValue() {
+ return this._data;
+ }
+ set nodeValue(v: string) {
+ this._data = String(v);
+ }
+ get textContent() {
+ return this._data;
+ }
+ set textContent(v: string) {
+ this._data = String(v);
+ }
+}
+
+class MiniComment {
+ nodeType = 8;
+ nodeName = '#comment';
+ parentNode: MiniEl | null = null;
+ ownerDocument: MiniDoc;
+ data: string;
+ constructor(data: string, doc: MiniDoc) {
+ this.data = data;
+ this.ownerDocument = doc;
+ }
+}
+
+class MiniEl extends EventTarget {
+ nodeType = 1;
+ tagName: string;
+ nodeName: string;
+ namespaceURI: string;
+ ownerDocument: MiniDoc;
+ parentNode: MiniEl | null = null;
+ childNodes: Array<MiniEl | MiniText | MiniComment> = [];
+ attrs = new Map<string, string>();
+ style: Record<string, string> = {};
+ className = '';
+ type = '';
+ disabled = false;
+ width = 0;
+ height = 0;
+ isContentEditable = false;
+
+ constructor(tag: string, doc: MiniDoc, ns = 'http://www.w3.org/1999/xhtml') {
+ super();
+ this.tagName = ns === 'http://www.w3.org/1999/xhtml' ? tag.toUpperCase() : tag;
+ this.nodeName = this.tagName;
+ this.namespaceURI = ns;
+ this.ownerDocument = doc;
+ }
+
+ getContext() {
+ return null;
+ }
+
+ get firstChild() {
+ return this.childNodes[0] ?? null;
+ }
+
+ get textContent(): string {
+ return this.childNodes.map((c) => ('textContent' in c ? c.textContent : '')).join('');
+ }
+ set textContent(v: string) {
+ this.childNodes = [];
+ if (v !== '') this.appendChild(new MiniText(v, this.ownerDocument));
+ }
+
+ appendChild<T extends MiniEl | MiniText | MiniComment>(child: T): T {
+ if (child.parentNode) child.parentNode.removeChild(child);
+ child.parentNode = this;
+ this.childNodes.push(child);
+ return child;
+ }
+
+ removeChild<T extends MiniEl | MiniText | MiniComment>(child: T): T {
+ const idx = this.childNodes.indexOf(child);
+ if (idx >= 0) {
+ this.childNodes.splice(idx, 1);
+ child.parentNode = null;
+ }
+ return child;
+ }
+
+ insertBefore<T extends MiniEl | MiniText | MiniComment>(
+ node: T,
+ ref: MiniEl | MiniText | MiniComment | null
+ ): T {
+ if (node.parentNode) node.parentNode.removeChild(node);
+ node.parentNode = this;
+ const idx = ref ? this.childNodes.indexOf(ref) : -1;
+ if (idx >= 0) this.childNodes.splice(idx, 0, node);
+ else this.childNodes.push(node);
+ return node;
+ }
+
+ setAttribute(k: string, v: string) {
+ this.attrs.set(k, String(v));
+ if (k === 'type') this.type = String(v);
+ if (k === 'disabled') this.disabled = true;
+ }
+ getAttribute(k: string): string | null {
+ return this.attrs.get(k) ?? null;
+ }
+ removeAttribute(k: string) {
+ this.attrs.delete(k);
+ if (k === 'disabled') this.disabled = false;
+ }
+ setAttributeNS(_ns: string | null, k: string, v: string) {
+ this.attrs.set(k, String(v));
+ }
+ removeAttributeNS(_ns: string | null, k: string) {
+ this.attrs.delete(k);
+ }
+ contains(target: unknown): boolean {
+ if (target === this) return true;
+ for (const c of this.childNodes) {
+ if (c === target) return true;
+ if (c instanceof MiniEl && c.contains(target)) return true;
+ }
+ return false;
+ }
+ blur() {}
+ focus() {}
+}
+
+interface MiniDoc {
+ nodeType: number;
+ nodeName: string;
+ documentElement: MiniEl;
+ body: MiniEl;
+ activeElement: MiniEl;
+ defaultView: Record<string, unknown>;
+ createElement: (tag: string) => MiniEl;
+ createElementNS: (ns: string, tag: string) => MiniEl;
+ createTextNode: (text: string) => MiniText;
+ createComment: (text: string) => MiniComment;
+ addEventListener: EventTarget['addEventListener'];
+ removeEventListener: EventTarget['removeEventListener'];
+ dispatchEvent: EventTarget['dispatchEvent'];
+}
+
+function installMiniDom() {
+ const docTarget = new EventTarget();
+ const winTarget = new EventTarget();
+
+ const doc = {
+ nodeType: 9,
+ nodeName: '#document',
+ documentElement: null as unknown as MiniEl,
+ body: null as unknown as MiniEl,
+ activeElement: null as unknown as MiniEl,
+ defaultView: null as unknown as Record<string, unknown>,
+ createElement(tag: string) {
+ return new MiniEl(tag, doc);
+ },
+ createElementNS(ns: string, tag: string) {
+ return new MiniEl(tag, doc, ns);
+ },
+ createTextNode(text: string) {
+ return new MiniText(text, doc);
+ },
+ createComment(text: string) {
+ return new MiniComment(text, doc);
+ },
+ addEventListener: docTarget.addEventListener.bind(docTarget),
+ removeEventListener: docTarget.removeEventListener.bind(docTarget),
+ dispatchEvent: docTarget.dispatchEvent.bind(docTarget),
+ } as unknown as MiniDoc;
+
+ doc.documentElement = new MiniEl('html', doc);
+ doc.body = new MiniEl('body', doc);
+ doc.documentElement.appendChild(doc.body);
+ doc.activeElement = doc.body;
+
+ class MockIFrame extends MiniEl {}
+ const win: Record<string, unknown> = {
+ document: doc,
+ Node: MiniEl,
+ Element: MiniEl,
+ HTMLElement: MiniEl,
+ HTMLInputElement: MiniEl,
+ HTMLIFrameElement: MockIFrame,
+ SVGElement: MiniEl,
+ Event,
+ CustomEvent,
+ KeyboardEvent: Event,
+ MouseEvent: Event,
+ PointerEvent: Event,
+ addEventListener: winTarget.addEventListener.bind(winTarget),
+ removeEventListener: winTarget.removeEventListener.bind(winTarget),
+ dispatchEvent: winTarget.dispatchEvent.bind(winTarget),
+ requestAnimationFrame: (cb: FrameRequestCallback) => {
+ cb(0);
+ return 1;
+ },
+ cancelAnimationFrame: () => {},
+ };
+ doc.defaultView = win;
+
+ const prev = {
+ window: (globalThis as any).window,
+ document: (globalThis as any).document,
+ Node: (globalThis as any).Node,
+ Element: (globalThis as any).Element,
+ HTMLElement: (globalThis as any).HTMLElement,
+ HTMLIFrameElement: (globalThis as any).HTMLIFrameElement,
+ IS_REACT_ACT_ENVIRONMENT: (globalThis as any).IS_REACT_ACT_ENVIRONMENT,
+ };
+
+ (globalThis as any).window = win;
+ (globalThis as any).document = doc;
+ (globalThis as any).Node = MiniEl;
+ (globalThis as any).Element = MiniEl;
+ (globalThis as any).HTMLElement = MiniEl;
+ (globalThis as any).HTMLIFrameElement = MockIFrame;
+ (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true;
+
+ return {
+ doc,
+ win,
+ cleanup() {
+ (globalThis as any).window = prev.window;
+ (globalThis as any).document = prev.document;
+ (globalThis as any).Node = prev.Node;
+ (globalThis as any).Element = prev.Element;
+ (globalThis as any).HTMLElement = prev.HTMLElement;
+ (globalThis as any).HTMLIFrameElement = prev.HTMLIFrameElement;
+ (globalThis as any).IS_REACT_ACT_ENVIRONMENT = prev.IS_REACT_ACT_ENVIRONMENT;
+ },
+ };
+}
+
+function makeKeyEvent(
+ key: string,
+ mods: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean; altKey?: boolean } = {}
+): KeyboardEvent {
+ const ev = new Event('keydown', { bubbles: true, cancelable: true }) as KeyboardEvent;
+ Object.defineProperty(ev, 'key', { value: key });
+ Object.defineProperty(ev, 'ctrlKey', { value: Boolean(mods.ctrlKey) });
+ Object.defineProperty(ev, 'metaKey', { value: Boolean(mods.metaKey) });
+ Object.defineProperty(ev, 'shiftKey', { value: Boolean(mods.shiftKey) });
+ Object.defineProperty(ev, 'altKey', { value: Boolean(mods.altKey) });
+ return ev;
+}
+
+function writeGridPixel(
+ grid: SparseTileGrid,
+ layerId: string,
+ x: number,
+ y: number,
+ rgba: [number, number, number, number]
+): void {
+ const tx = pixelToTileCoord(x);
+ const ty = pixelToTileCoord(y);
+ const lx = x - tx * TILE_SIZE;
+ const ly = y - ty * TILE_SIZE;
+ const tile = grid.getOrCreateTile(layerId, tx, ty, 'color-32bit', 0);
+ const off = (ly * TILE_SIZE + lx) * 4;
+ tile.data![off] = rgba[0];
+ tile.data![off + 1] = rgba[1];
+ tile.data![off + 2] = rgba[2];
+ tile.data![off + 3] = rgba[3];
+}
+
+function readGridPixel(
+ grid: SparseTileGrid,
+ layerId: string,
+ x: number,
+ y: number
+): [number, number, number, number] {
+ const tx = pixelToTileCoord(x);
+ const ty = pixelToTileCoord(y);
+ const lx = x - tx * TILE_SIZE;
+ const ly = y - ty * TILE_SIZE;
+ const tile = grid.getTile(layerId, tx, ty, 0);
+ if (!tile || !tile.data) return [0, 0, 0, 0];
+ const off = (ly * TILE_SIZE + lx) * 4;
+ return [tile.data[off], tile.data[off + 1], tile.data[off + 2], tile.data[off + 3]];
+}
+
+// ---------------------------------------------------------------------------
+// 1. Tile Engine Resize Correctness (Overhang Clamp, Premultiplied Alpha, Paged Tiles)
+// ---------------------------------------------------------------------------
+
+describe('Tile Engine Resize & Hydration Correctness', () => {
+ it('clamps edge-tile overhang pixels beyond oldDims on tile-aligned canvas expansion', () => {
+ const grid = new SparseTileGrid();
+ grid.setLayerFormat('layer-1', 'color-32bit');
+
+ // Valid pixel inside old 100x100 canvas
+ writeGridPixel(grid, 'layer-1', 20, 30, [255, 0, 0, 255]);
+ // Stray overhang pixel inside tile (0,0) beyond old 100x100 bounds
+ writeGridPixel(grid, 'layer-1', 150, 50, [0, 255, 0, 255]);
+
+ // Expand canvas to 300x300 with offset (0, 0) (tile-aligned fast path!)
+ grid.resizeLayerInGrid(
+ 'layer-1',
+ { width: 100, height: 100, dpi: 300 },
+ { width: 300, height: 300, dpi: 300 },
+ {
+ scaleContent: false,
+ offsetX: 0,
+ offsetY: 0,
+ isBackground: false,
+ backgroundColor: '#ffffff',
+ targetFormat: 'color-32bit',
+ }
+ );
+
+ expect(readGridPixel(grid, 'layer-1', 20, 30)).toEqual([255, 0, 0, 255]);
+ // Overhang pixel must NOT leak into newly expanded area
+ expect(readGridPixel(grid, 'layer-1', 150, 50)).toEqual([0, 0, 0, 0]);
+ });
+
+ it('uses premultiplied-alpha bilinear interpolation on scaled resize (no dark fringes)', () => {
+ const grid = new SparseTileGrid();
+ grid.setLayerFormat('layer-1', 'color-32bit');
+
+ // Bright white pixel at (0,0), transparent black [0,0,0,0] at (1,0)
+ writeGridPixel(grid, 'layer-1', 0, 0, [255, 255, 255, 255]);
+ writeGridPixel(grid, 'layer-1', 0, 1, [255, 255, 255, 255]);
+
+ grid.resizeLayerInGrid(
+ 'layer-1',
+ { width: 2, height: 2, dpi: 300 },
+ { width: 4, height: 4, dpi: 300 },
+ {
+ scaleContent: true,
+ offsetX: 0,
+ offsetY: 0,
+ isBackground: false,
+ backgroundColor: '#ffffff',
+ targetFormat: 'color-32bit',
+ }
+ );
+
+ // Sample transitional semi-transparent pixel near the boundary between white and transparent
+ const mid = readGridPixel(grid, 'layer-1', 1, 1);
+ expect(mid[3]).toBeGreaterThan(0);
+ // Without premultiplication, RGB would darken toward gray (~128); with premultiplication it stays pure white!
+ expect(mid[0]).toBeGreaterThanOrEqual(250);
+ expect(mid[1]).toBeGreaterThanOrEqual(250);
+ expect(mid[2]).toBeGreaterThanOrEqual(250);
+ });
+
+ it('hydrates paged-to-disk tiles before resize so large canvases never lose paged artwork', async () => {
+ const grid = new SparseTileGrid();
+ const driver = new InMemoryScratchDiskDriver();
+ const mm = new TileMemoryManager(grid, {
+ budgetMb: 64,
+ sessionId: 'paged-resize-test',
+ driver,
+ });
+ grid.setMemoryManager(mm);
+ grid.setLayerFormat('layer-1', 'color-32bit');
+
+ writeGridPixel(grid, 'layer-1', 40, 50, [10, 180, 240, 255]);
+ const tile = grid.getTile('layer-1', 0, 0, 0)!;
+ // Simulate tile paged out to scratch disk
+ await driver.writeTiles(mm.getSessionId(), [
+ { layerId: 'layer-1', tileX: 0, tileY: 0, data: tile.data! },
+ ]);
+ tile.data = null;
+ tile.isPagedToDisk = true;
+
+ const layers: LayerItem[] = [
+ {
+ id: 'layer-1',
+ name: 'Art',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ },
+ ];
+
+ await hydratePagedTilesForLayers(grid, layers, false);
+ expect(tile.data).not.toBeNull();
+ expect(readGridPixel(grid, 'layer-1', 40, 50)).toEqual([10, 180, 240, 255]);
+
+ grid.resizeLayerInGrid(
+ 'layer-1',
+ { width: 200, height: 200, dpi: 300 },
+ { width: 150, height: 150, dpi: 300 },
+ {
+ scaleContent: false,
+ offsetX: -10,
+ offsetY: -20,
+ isBackground: false,
+ backgroundColor: '#ffffff',
+ targetFormat: 'color-32bit',
+ }
+ );
+
+ expect(readGridPixel(grid, 'layer-1', 30, 30)).toEqual([10, 180, 240, 255]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// 2. End-to-End Resize -> .ink Save Round-Trip & Full Ctrl+Z / Ctrl+Y Integration
+// ---------------------------------------------------------------------------
+
+describe('Canvas Resize .ink Save Sync & Broad Ctrl+Z / Ctrl+Y Integration', () => {
+ let dom: ReturnType<typeof installMiniDom>;
+ let root: Root | null = null;
+ let container: MiniEl;
+
+ beforeEach(() => {
+ dom = installMiniDom();
+ container = dom.doc.createElement('div');
+ dom.doc.body.appendChild(container);
+ documentStoreActions.setRulerHistoryRecorder(null);
+ documentStoreActions.setDocuments([]);
+ documentStoreActions.setActiveDocumentId(null);
+ documentStoreActions.setPerspectiveRuler(null, { recordHistory: false });
+ documentStoreActions.setStraightRuler(null, { recordHistory: false });
+ documentStoreActions.setAnimationTimeline(null);
+ uiStoreActions.setResizeCanvasModalOpen(false);
+ });
+
+ afterEach(() => {
+ if (root) {
+ act(() => {
+ root!.unmount();
+ });
+ root = null;
+ }
+ documentStoreActions.setRulerHistoryRecorder(null);
+ documentStoreActions.setDocuments([]);
+ documentStoreActions.setActiveDocumentId(null);
+ uiStoreActions.setResizeCanvasModalOpen(false);
+ dom.cleanup();
+ vi.restoreAllMocks();
+ });
+
+ it('syncs documents[activeId].dimensions on resize, saves exact cropped .ink with zero transparent borders, and fully undoes/redoes resize without wiping prior strokes', async () => {
+ const docId = 'doc-resize-save-test';
+ const origDims: CanvasDimensions = { width: 400, height: 300, dpi: 300 };
+ const session = documentStore.getOrCreateSession(docId);
+ const grid = session.tileGrid;
+ grid.clearAll();
+
+ // Seed background + artwork layer
+ grid.fillLayerSolidColor('layer-bg', 400, 300, '#ffffff', 'color-32bit');
+ grid.setLayerFormat('layer-1', 'color-32bit');
+ grid.markLayerIngested('layer-1');
+ writeGridPixel(grid, 'layer-1', 150, 120, [200, 30, 40, 255]); // Inside crop
+ writeGridPixel(grid, 'layer-1', 350, 250, [20, 40, 220, 255]); // Outside crop (cropped away!)
+
+ const initialMask = dom.doc.createElement('canvas') as unknown as HTMLCanvasElement;
+ initialMask.width = 400;
+ initialMask.height = 300;
+
+ const initialLayers: LayerItem[] = [
+ {
+ id: 'layer-1',
+ name: 'Painting',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ maskCanvas: initialMask,
+ maskEnabled: true,
+ maskVersion: 1,
+ },
+ {
+ id: 'layer-bg',
+ name: 'Background',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ },
+ ];
+
+ const initialTab: DocumentTab = {
+ id: docId,
+ name: 'Portrait.ink',
+ dimensions: { ...origDims },
+ colorMode: 'color',
+ layers: initialLayers,
+ activeLayerId: 'layer-1',
+ isDirty: false,
+ };
+
+ documentStoreActions.setDimensions(origDims);
+ documentStoreActions.setColorMode('color');
+ documentStoreActions.setDocumentName('Portrait.ink');
+ documentStoreActions.setDocuments([initialTab]);
+ documentStoreActions.setActiveDocumentId(docId);
+
+ const perspRuler: PerspectiveRuler = {
+ id: 'pr-1',
+ type: '1-point',
+ enabled: true,
+ locked: false,
+ snapEnabled: true,
+ vps: [{ id: 'vp1', x: 200, y: 150, label: 'VP1', color: '#3b82f6' }],
+ horizonAngle: 0,
+ guideRayCount: 12,
+ grid: { enabled: false, density: 12, plane: 'ground', opacity: 0.3 },
+ };
+ const straightRuler: StraightRuler = {
+ enabled: true,
+ x: 180,
+ y: 140,
+ angle: 15,
+ locked: false,
+ snapEnabled: true,
+ };
+ documentStoreActions.setPerspectiveRuler(perspRuler, { recordHistory: false });
+ documentStoreActions.setStraightRuler(straightRuler, { recordHistory: false });
+
+ interface HarnessApi {
+ layerMgr: ReturnType<typeof useLayerManager>;
+ history: ReturnType<typeof useDrawingHistory>;
+ selectionTools: ReturnType<typeof useSelectionTools>;
+ docLifecycle: ReturnType<typeof useDocumentLifecycle>;
+ }
+ let api!: HarnessApi;
+
+ const Harness: React.FC = () => {
+ const dims = useDocumentStore((s) => s.dimensions);
+ const colorMode = useDocumentStore((s) => s.colorMode);
+ const activeDocId = useDocumentStore((s) => s.activeDocumentId);
+ const pushHistoryStepRef = useRef<PushHistoryStepFn | null>(null);
+ const dimensionsRef = useRef(dims);
+ dimensionsRef.current = dims;
+ const colorModeRef = useRef(colorMode);
+ colorModeRef.current = colorMode;
+
+ const layerMgr = useLayerManager({
+ dimensions: dims,
+ activeSessionId: activeDocId,
+ tileGrid: grid,
+ pushHistoryStepRef,
+ });
+
+ // Seed initial layers on mount
+ const seededRef = useRef(false);
+ if (!seededRef.current) {
+ seededRef.current = true;
+ layerMgr.loadDocument(
+ { name: 'Portrait.ink', dimensions: origDims, colorMode: 'color', layers: initialLayers },
+ docId,
+ true
+ );
+ }
+
+ const activeLayerIdRef = useRef(layerMgr.activeLayerId);
+ activeLayerIdRef.current = layerMgr.activeLayerId;
+ const layersRef = useRef<LayerItem[] | undefined>(layerMgr.layers);
+ layersRef.current = layerMgr.layers;
+ const onApplyLayerTreeDeltaRef = useRef(layerMgr.applyLayerTreeDelta);
+ onApplyLayerTreeDeltaRef.current = layerMgr.applyLayerTreeDelta;
+ const onUpdateMaskThumbnailRef = useRef<((id: string) => void) | undefined>(undefined);
+ const isDrawingRef = useRef(false);
+ const lastStrokeEndRef = useRef(null);
+ const abortActiveStrokeRef = useRef(() => {});
+
+ const stablePush = useCallback<PushHistoryStepFn>((...args) => {
+ pushHistoryStepRef.current?.(...args);
+ }, []);
+
+ const selectionTools = useSelectionTools({
+ dimensions: dims,
+ colorMode,
+ layers: layerMgr.layers,
+ activeLayer: layerMgr.activeLayer,
+ activeLayerId: layerMgr.activeLayerId,
+ selectedLayerIds: layerMgr.selectedLayerIds,
+ tileGrid: grid,
+ updateLayerThumbnail: layerMgr.updateLayerThumbnail,
+ pushHistoryStep: stablePush,
+ showToast: vi.fn(),
+ });
+
+ const handleApplyDocumentStateDelta = useCallback(
+ (delta: DocumentStateDelta, direction: 'undo' | 'redo') => {
+ const aid = useDocumentStore.getState().activeDocumentId;
+ if (delta.beforeDimensions !== undefined || delta.afterDimensions !== undefined) {
+ const targetDims = direction === 'undo' ? delta.beforeDimensions : delta.afterDimensions;
+ if (targetDims) {
+ documentStoreActions.setDimensions({ ...targetDims }, aid);
+ }
+ }
+ if (delta.beforePerspectiveRuler !== undefined || delta.afterPerspectiveRuler !== undefined) {
+ const target =
+ direction === 'undo' ? delta.beforePerspectiveRuler : delta.afterPerspectiveRuler;
+ documentStoreActions.setPerspectiveRuler(target ?? null, { recordHistory: false });
+ }
+ if (delta.beforeStraightRuler !== undefined || delta.afterStraightRuler !== undefined) {
+ const target =
+ direction === 'undo' ? delta.beforeStraightRuler : delta.afterStraightRuler;
+ documentStoreActions.setStraightRuler(target ?? null, { recordHistory: false });
+ }
+ if (delta.beforeSelection !== undefined || delta.afterSelection !== undefined) {
+ const target = direction === 'undo' ? delta.beforeSelection : delta.afterSelection;
+ selectionTools.restoreSelectionFromHistory(target ?? null);
+ }
+ },
+ [selectionTools.restoreSelectionFromHistory]
+ );
+
+ const onApplyDocumentStateDeltaRef = useRef(handleApplyDocumentStateDelta);
+ onApplyDocumentStateDeltaRef.current = handleApplyDocumentStateDelta;
+
+ const history = useDrawingHistory({
+ activeSessionId: activeDocId,
+ tileGrid: grid,
+ activeLayerId: layerMgr.activeLayerId,
+ activeLayerLocked: false,
+ dimensions: dims,
+ dimensionsRef,
+ activeLayerIdRef,
+ colorModeRef,
+ layersRef,
+ onUpdateLayerThumbnail: layerMgr.updateLayerThumbnail,
+ onApplyLayerTreeDeltaRef,
+ onApplyDocumentStateDeltaRef,
+ onUpdateMaskThumbnailRef,
+ isDrawingRef,
+ lastStrokeEndRef,
+ abortActiveStrokeRef,
+ });
+
+ pushHistoryStepRef.current = history.pushHistoryStep;
+
+ const docLifecycle = useDocumentLifecycle({
+ layers: layerMgr.layers,
+ activeLayer: layerMgr.activeLayer,
+ activeLayerId: layerMgr.activeLayerId,
+ getEffectiveOpacity: layerMgr.getEffectiveOpacity,
+ isLayerEffectivelyVisible: layerMgr.isLayerEffectivelyVisible,
+ setActiveLayerId: layerMgr.setActiveLayerId,
+ resetToNewCanvas: layerMgr.resetToNewCanvas,
+ setDefaultToneFrequency: layerMgr.setDefaultToneFrequency,
+ clearDocument: layerMgr.clearDocument,
+ loadDocument: layerMgr.loadDocument,
+ switchDocumentSession: layerMgr.switchDocumentSession,
+ resizeCanvas: layerMgr.resizeCanvas,
+ copyLayer: layerMgr.copyLayer,
+ pasteLayer: layerMgr.pasteLayer,
+ onDeselectAfterPaste: () => selectionTools.handleDeselect(false),
+ getSelection: () => selectionTools.selection,
+ clearSelectionWithoutHistory: () => selectionTools.handleDeselect(false),
+ flushPendingHistoryTasks: history.flushPendingHistoryTasks,
+ deleteLayer: layerMgr.deleteLayer,
+ pasteLayerFromFile: layerMgr.pasteLayerFromFile,
+ resetZoomAndCenter: vi.fn(),
+ resetHistory: history.resetHistory,
+ pushHistoryStep: history.pushHistoryStep,
+ showToast: vi.fn(),
+ });
+
+ api = { layerMgr, history, selectionTools, docLifecycle };
+ return null;
+ };
+
+ root = createRoot(container as unknown as HTMLElement);
+ act(() => {
+ root!.render(<Harness />);
+ });
+
+ // 1. Simulate a pre-resize brush stroke committed to history
+ act(() => {
+ const snap = grid.snapshotLayerTiles('layer-1');
+ writeGridPixel(grid, 'layer-1', 160, 130, [50, 210, 90, 255]);
+ const strokeDeltas = grid.computeFullLayerDeltasFromSnapshot(snap, 'layer-1');
+ api.history.pushHistoryStep(
+ 'brush',
+ 'Brush Stroke',
+ null,
+ null,
+ 'layer-1',
+ { x: 160, y: 130, width: 1, height: 1 },
+ strokeDeltas
+ );
+ });
+ expect(readGridPixel(grid, 'layer-1', 160, 130)).toEqual([50, 210, 90, 255]);
+
+ // Set an active selection before resizing
+ act(() => {
+ api.selectionTools.setSelection({
+ type: 'rect',
+ bounds: { x: 100, y: 100, width: 80, height: 60 },
+ });
+ });
+
+ // 2. Crop canvas from 400x300 -> 200x150 starting at cropX=100, cropY=80 (offsetX=-100, offsetY=-80)
+ const cropOpts: ResizeCanvasOptions = {
+ width: 200,
+ height: 150,
+ dpi: 300,
+ scaleContent: false,
+ offsetX: -100,
+ offsetY: -80,
+ backgroundColor: '#ffffff',
+ };
+ act(() => {
+ api.docLifecycle.handleResizeCanvas(cropOpts);
+ });
+
+ // Verify BOTH top-level store.dimensions AND documents[docId].dimensions updated atomically!
+ const afterStore = useDocumentStore.getState();
+ expect(afterStore.dimensions).toEqual({ width: 200, height: 150, dpi: 300 });
+ expect(afterStore.documents[0].dimensions).toEqual({ width: 200, height: 150, dpi: 300 });
+ expect(afterStore.documents[0].isDirty).toBe(true);
+ // Rulers shifted by (-100, -80)
+ expect(afterStore.perspectiveRuler?.vps[0]).toMatchObject({ x: 100, y: 70 });
+ expect(afterStore.straightRuler).toMatchObject({ x: 80, y: 60 });
+ // Selection cleared without extra step
+ expect(api.selectionTools.selection).toBeNull();
+ // Original maskCanvas was NOT mutated in-place; new mask has cropped dimensions
+ expect(initialMask.width).toBe(400);
+ expect(initialMask.height).toBe(300);
+ const resizedLayer1 = api.layerMgr.layers.find((l) => l.id === 'layer-1')!;
+ expect(resizedLayer1.maskCanvas?.width).toBe(200);
+ expect(resizedLayer1.maskCanvas?.height).toBe(150);
+
+ // 3. Serialize to .ink using targetDoc.dimensions (just like Ctrl+S) and reopen!
+ const savedDocTab = useDocumentStore.getState().documents[0];
+ const serialized = await serializeInkProject(
+ {
+ name: 'Portrait',
+ dimensions: savedDocTab.dimensions,
+ colorMode: savedDocTab.colorMode,
+ layers: api.layerMgr.layers,
+ tileGrid: grid,
+ getEffectiveOpacity: (l) => l.opacity,
+ isLayerEffectivelyVisible: (l) => l.visible,
+ perspectiveRuler: useDocumentStore.getState().perspectiveRuler,
+ },
+ grid
+ );
+ const reopened = await parseInkProject(serialized.bytes);
+ const reopenGrid = reopened.tileGrid;
+
+ // Exact cropped dimensions, NO transparent margins, shifted art preserved!
+ expect(reopened.dimensions).toEqual({ width: 200, height: 150, dpi: 300 });
+ expect(readGridPixel(reopenGrid, 'layer-1', 50, 40)).toEqual([200, 30, 40, 255]);
+ expect(readGridPixel(reopenGrid, 'layer-1', 60, 50)).toEqual([50, 210, 90, 255]);
+ expect(readGridPixel(reopenGrid, 'layer-bg', 199, 149)).toEqual([255, 255, 255, 255]);
+ expect(reopened.perspectiveRuler?.vps[0]).toMatchObject({ x: 100, y: 70 });
+
+ // 4. Ctrl+Z #1: Undoes Canvas Resize completely!
+ expect(api.history.historyList.some((h) => h.type === 'brush')).toBe(true);
+ expect(api.history.historyList.some((h) => h.type === 'canvas-resize')).toBe(true);
+ act(() => {
+ api.history.undo();
+ });
+
+ const undoneStore = useDocumentStore.getState();
+ expect(undoneStore.dimensions).toEqual(origDims);
+ expect(undoneStore.documents[0].dimensions).toEqual(origDims);
+ // Both kept AND previously cropped-away pixels are restored!
+ expect(readGridPixel(grid, 'layer-1', 150, 120)).toEqual([200, 30, 40, 255]);
+ expect(readGridPixel(grid, 'layer-1', 160, 130)).toEqual([50, 210, 90, 255]);
+ expect(readGridPixel(grid, 'layer-1', 350, 250)).toEqual([20, 40, 220, 255]);
+ expect(readGridPixel(grid, 'layer-bg', 399, 299)).toEqual([255, 255, 255, 255]);
+ // Rulers, selection, and mask dimensions restored
+ expect(undoneStore.perspectiveRuler?.vps[0]).toMatchObject({ x: 200, y: 150 });
+ expect(undoneStore.straightRuler).toMatchObject({ x: 180, y: 140 });
+ expect(api.selectionTools.selection?.bounds).toEqual({ x: 100, y: 100, width: 80, height: 60 });
+ expect(api.layerMgr.layers.find((l) => l.id === 'layer-1')?.maskCanvas?.width).toBe(400);
+
+ // 5. Ctrl+Z #2: Pre-resize Brush Stroke is STILL in undo history and undoes cleanly!
+ act(() => {
+ api.history.undo();
+ });
+ expect(readGridPixel(grid, 'layer-1', 160, 130)).toEqual([0, 0, 0, 0]);
+ expect(readGridPixel(grid, 'layer-1', 150, 120)).toEqual([200, 30, 40, 255]);
+
+ // 6. Ctrl+Y x2: Redoes Stroke, then Redoes Resize!
+ act(() => {
+ api.history.redo();
+ });
+ expect(readGridPixel(grid, 'layer-1', 160, 130)).toEqual([50, 210, 90, 255]);
+ act(() => {
+ api.history.redo();
+ });
+ expect(useDocumentStore.getState().dimensions).toEqual({ width: 200, height: 150, dpi: 300 });
+ expect(useDocumentStore.getState().documents[0].dimensions).toEqual({
+ width: 200,
+ height: 150,
+ dpi: 300,
+ });
+ expect(readGridPixel(grid, 'layer-1', 60, 50)).toEqual([50, 210, 90, 255]);
+ expect(readGridPixel(grid, 'layer-1', 350, 250)[3]).toBe(0);
+
+ await documentStore.closeSession(docId);
+ });
+
+ it('supports Ctrl+Z / Ctrl+Y for Selections, Layer Solo, Rulers (with coalescing), and Animation Timeline Cel Creation', async () => {
+ const docId = 'doc-broad-undo-test';
+ const dims: CanvasDimensions = { width: 120, height: 80, dpi: 300 };
+ const session = documentStore.getOrCreateSession(docId);
+ const grid = session.tileGrid;
+ grid.clearAll();
+
+ const initialLayers: LayerItem[] = [
+ {
+ id: 'layer-1',
+ name: 'Lineart',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ },
+ {
+ id: 'layer-2',
+ name: 'Colors',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ },
+ {
+ id: 'layer-bg',
+ name: 'Background',
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ },
+ ];
+
+ documentStoreActions.setDimensions(dims);
+ documentStoreActions.setDocuments([
+ {
+ id: docId,
+ name: 'Scene.ink',
+ dimensions: dims,
+ colorMode: 'color',
+ layers: initialLayers,
+ activeLayerId: 'layer-1',
+ animation: null,
+ },
+ ]);
+ documentStoreActions.setActiveDocumentId(docId);
+
+ interface BroadApi {
+ layerMgr: ReturnType<typeof useLayerManager>;
+ history: ReturnType<typeof useDrawingHistory>;
+ selectionTools: ReturnType<typeof useSelectionTools>;
+ addCel: (frameIdx: number) => void;
+ }
+ let api!: BroadApi;
+
+ const Harness: React.FC = () => {
+ const curDims = useDocumentStore((s) => s.dimensions);
+ const activeDocId = useDocumentStore((s) => s.activeDocumentId);
+ const pushHistoryStepRef = useRef<PushHistoryStepFn | null>(null);
+ const dimensionsRef = useRef(curDims);
+ dimensionsRef.current = curDims;
+ const colorModeRef = useRef<'color'>('color');
+
+ const layerMgr = useLayerManager({
+ dimensions: curDims,
+ activeSessionId: activeDocId,
+ tileGrid: grid,
+ pushHistoryStepRef,
+ });
+
+ const seededRef = useRef(false);
+ if (!seededRef.current) {
+ seededRef.current = true;
+ layerMgr.loadDocument(
+ { name: 'Scene.ink', dimensions: dims, colorMode: 'color', layers: initialLayers },
+ docId,
+ true
+ );
+ }
+
+ const activeLayerIdRef = useRef(layerMgr.activeLayerId);
+ activeLayerIdRef.current = layerMgr.activeLayerId;
+ const layersRef = useRef<LayerItem[] | undefined>(layerMgr.layers);
+ layersRef.current = layerMgr.layers;
+ const onApplyLayerTreeDeltaRef = useRef(layerMgr.applyLayerTreeDelta);
+ onApplyLayerTreeDeltaRef.current = layerMgr.applyLayerTreeDelta;
+ const onUpdateMaskThumbnailRef = useRef<((id: string) => void) | undefined>(undefined);
+ const isDrawingRef = useRef(false);
+ const lastStrokeEndRef = useRef(null);
+ const abortActiveStrokeRef = useRef(() => {});
+
+ const stablePush = useCallback<PushHistoryStepFn>((...args) => {
+ pushHistoryStepRef.current?.(...args);
+ }, []);
+
+ const selectionTools = useSelectionTools({
+ dimensions: curDims,
+ colorMode: 'color',
+ layers: layerMgr.layers,
+ activeLayer: layerMgr.activeLayer,
+ activeLayerId: layerMgr.activeLayerId,
+ selectedLayerIds: layerMgr.selectedLayerIds,
+ tileGrid: grid,
+ updateLayerThumbnail: layerMgr.updateLayerThumbnail,
+ pushHistoryStep: stablePush,
+ showToast: vi.fn(),
+ });
+
+ useEffect(() => {
+ documentStoreActions.setRulerHistoryRecorder((label, delta) => {
+ pushHistoryStepRef.current?.(
+ 'ruler',
+ label,
+ null,
+ null,
+ activeLayerIdRef.current || '',
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ undefined,
+ delta
+ );
+ });
+ return () => documentStoreActions.setRulerHistoryRecorder(null);
+ }, []);
+
+ const handleApplyDocumentStateDelta = useCallback(
+ (delta: DocumentStateDelta, direction: 'undo' | 'redo') => {
+ if (delta.beforePerspectiveRuler !== undefined || delta.afterPerspectiveRuler !== undefined) {
+ const target =
+ direction === 'undo' ? delta.beforePerspectiveRuler : delta.afterPerspectiveRuler;
+ documentStoreActions.setPerspectiveRuler(target ?? null, { recordHistory: false });
+ }
+ if (delta.beforeStraightRuler !== undefined || delta.afterStraightRuler !== undefined) {
+ const target =
+ direction === 'undo' ? delta.beforeStraightRuler : delta.afterStraightRuler;
+ documentStoreActions.setStraightRuler(target ?? null, { recordHistory: false });
+ }
+ if (
+ delta.beforeAnimationTimeline !== undefined ||
+ delta.afterAnimationTimeline !== undefined
+ ) {
+ const target =
+ direction === 'undo' ? delta.beforeAnimationTimeline : delta.afterAnimationTimeline;
+ documentStoreActions.setAnimationTimeline(target ?? null);
+ }
+ if (delta.beforeSelection !== undefined || delta.afterSelection !== undefined) {
+ const target = direction === 'undo' ? delta.beforeSelection : delta.afterSelection;
+ selectionTools.restoreSelectionFromHistory(target ?? null);
+ }
+ },
+ [selectionTools.restoreSelectionFromHistory]
+ );
+
+ const onApplyDocumentStateDeltaRef = useRef(handleApplyDocumentStateDelta);
+ onApplyDocumentStateDeltaRef.current = handleApplyDocumentStateDelta;
+
+ const history = useDrawingHistory({
+ activeSessionId: activeDocId,
+ tileGrid: grid,
+ activeLayerId: layerMgr.activeLayerId,
+ activeLayerLocked: false,
+ dimensions: curDims,
+ dimensionsRef,
+ activeLayerIdRef,
+ colorModeRef,
+ layersRef,
+ onUpdateLayerThumbnail: layerMgr.updateLayerThumbnail,
+ onApplyLayerTreeDeltaRef,
+ onApplyDocumentStateDeltaRef,
+ onUpdateMaskThumbnailRef,
+ isDrawingRef,
+ lastStrokeEndRef,
+ abortActiveStrokeRef,
+ });
+
+ pushHistoryStepRef.current = history.pushHistoryStep;
+
+ const addCel = useCallback(
+ (frameIndex: number) => {
+ const beforeLayers = layerMgr.layers;
+ const beforeActive = layerMgr.activeLayerId;
+ const beforeTl: AnimationTimeline | null = useDocumentStore.getState().animationTimeline;
+ const newId = `layer-cel-test-${frameIndex}`;
+ const celLayer: LayerItem = {
+ id: newId,
+ name: `Cel Frame ${frameIndex + 1}`,
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ };
+ const nextLayers = [celLayer, ...beforeLayers];
+ layerMgr.setLayers(nextLayers);
+ layerMgr.setActiveLayerId(newId);
+ const nextTl = setFrameCel(
+ beforeTl || createDefaultAnimationTimeline(beforeLayers),
+ frameIndex,
+ newId
+ );
+ documentStoreActions.setAnimationTimeline(nextTl);
+ pushHistoryStepRef.current?.(
+ 'animation',
+ `Add Cel Frame ${frameIndex + 1}`,
+ null,
+ null,
+ newId,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ false,
+ createLayerTreeSnapshotDelta(beforeLayers, nextLayers, beforeActive, newId),
+ {
+ beforeAnimationTimeline: beforeTl,
+ afterAnimationTimeline: nextTl,
+ }
+ );
+ },
+ [layerMgr]
+ );
+
+ api = { layerMgr, history, selectionTools, addCel };
+ return null;
+ };
+
+ root = createRoot(container as unknown as HTMLElement);
+ act(() => {
+ root!.render(<Harness />);
+ });
+
+ // A. Selection actions undo & redo
+ act(() => {
+ api.selectionTools.handleSelectAll();
+ });
+ expect(api.selectionTools.selection?.bounds).toEqual({ x: 0, y: 0, width: 120, height: 80 });
+
+ act(() => {
+ api.selectionTools.handleContractSelection(10);
+ });
+ const contractedBounds = api.selectionTools.selection?.bounds;
+ expect(contractedBounds).toBeDefined();
+ expect(contractedBounds!.width).toBeLessThan(120);
+ expect(contractedBounds!.height).toBeLessThan(80);
+
+ act(() => {
+ api.selectionTools.handleDeselect();
+ });
+ expect(api.selectionTools.selection).toBeNull();
+
+ // Undo Deselect -> contracted bounds back
+ act(() => {
+ api.history.undo();
+ });
+ expect(api.selectionTools.selection?.bounds).toEqual(contractedBounds);
+
+ // Undo Contract -> full canvas Select All back
+ act(() => {
+ api.history.undo();
+ });
+ expect(api.selectionTools.selection?.bounds).toEqual({ x: 0, y: 0, width: 120, height: 80 });
+
+ // Undo Select All -> null
+ act(() => {
+ api.history.undo();
+ });
+ expect(api.selectionTools.selection).toBeNull();
+
+ // Redo Select All -> full canvas back
+ act(() => {
+ api.history.redo();
+ });
+ expect(api.selectionTools.selection?.bounds).toEqual({ x: 0, y: 0, width: 120, height: 80 });
+
+ // B. Layer Solo & Exit Solo undo / redo
+ act(() => {
+ api.layerMgr.toggleSoloLayer('layer-1');
+ });
+ expect(api.layerMgr.layers.find((l) => l.id === 'layer-1')?.visible).toBe(true);
+ expect(api.layerMgr.layers.find((l) => l.id === 'layer-2')?.visible).toBe(false);
+
+ act(() => {
+ api.history.undo();
+ });
+ expect(api.layerMgr.layers.find((l) => l.id === 'layer-2')?.visible).toBe(true);
+
+ act(() => {
+ api.history.redo();
+ });
+ expect(api.layerMgr.layers.find((l) => l.id === 'layer-2')?.visible).toBe(false);
+
+ // C. Perspective & Straight Rulers undo / redo + drag coalescing
+ const ruler1: PerspectiveRuler = {
+ id: 'p1',
+ type: '1-point',
+ enabled: true,
+ locked: false,
+ snapEnabled: true,
+ vps: [{ id: 'vp1', x: 60, y: 40, label: 'VP1', color: '#3b82f6' }],
+ horizonAngle: 0,
+ guideRayCount: 12,
+ grid: { enabled: false, density: 10, plane: 'ground', opacity: 0.3 },
+ };
+ act(() => {
+ documentStoreActions.setPerspectiveRuler(ruler1);
+ });
+ expect(useDocumentStore.getState().perspectiveRuler?.vps[0].x).toBe(60);
+
+ // Rapid handle drags coalesce into ONE single undo step
+ const countAfterAdd = api.history.historyList.length;
+ act(() => {
+ documentStoreActions.setPerspectiveRuler({
+ ...ruler1,
+ vps: [{ ...ruler1.vps[0], x: 75 }],
+ });
+ documentStoreActions.setPerspectiveRuler({
+ ...ruler1,
+ vps: [{ ...ruler1.vps[0], x: 95 }],
+ });
+ });
+ expect(api.history.historyList.length).toBe(countAfterAdd + 1);
+ expect(useDocumentStore.getState().perspectiveRuler?.vps[0].x).toBe(95);
+
+ // System ruler updates with { recordHistory: false } do NOT create undo steps
+ const countBeforeSilent = api.history.historyList.length;
+ act(() => {
+ documentStoreActions.setStraightRuler(
+ { enabled: true, x: 50, y: 50, angle: 0, locked: false, snapEnabled: true },
+ { recordHistory: false }
+ );
+ });
+ expect(api.history.historyList.length).toBe(countBeforeSilent);
+
+ // Undo coalesced VP drag -> jumps straight back to x=60!
+ act(() => {
+ api.history.undo();
+ });
+ expect(useDocumentStore.getState().perspectiveRuler?.vps[0].x).toBe(60);
+
+ // Undo Add Perspective Ruler -> null
+ act(() => {
+ api.history.undo();
+ });
+ expect(useDocumentStore.getState().perspectiveRuler).toBeNull();
+
+ // D. Atomic Animation Cel creation undo / redo
+ act(() => {
+ api.addCel(2);
+ });
+ expect(api.layerMgr.layers.some((l) => l.id === 'layer-cel-test-2')).toBe(true);
+ expect(useDocumentStore.getState().animationTimeline?.cels[2]).toBe('layer-cel-test-2');
+
+ // Single Ctrl+Z removes BOTH cel layer AND frame binding atomically!
+ act(() => {
+ api.history.undo();
+ });
+ expect(api.layerMgr.layers.some((l) => l.id === 'layer-cel-test-2')).toBe(false);
+ expect(useDocumentStore.getState().animationTimeline).toBeNull();
+
+ // Single Ctrl+Y restores BOTH cel layer AND frame binding!
+ act(() => {
+ api.history.redo();
+ });
+ expect(api.layerMgr.layers.some((l) => l.id === 'layer-cel-test-2')).toBe(true);
+ expect(useDocumentStore.getState().animationTimeline?.cels[2]).toBe('layer-cel-test-2');
+
+ await documentStore.closeSession(docId);
+ });
+
+ it('supports Ctrl+Z and Ctrl+Y / Ctrl+Shift+Z on live crop draft adjustments inside ResizeCanvasModal', () => {
+ const dims: CanvasDimensions = { width: 1000, height: 800, dpi: 300 };
+ const onResize = vi.fn();
+
+ uiStoreActions.setResizeCanvasModalOpen(true, dims);
+
+ const Harness: React.FC = () => {
+ const isOpen = useUiStore((s) => s.isResizeCanvasModalOpen);
+ return (
+ <ResizeCanvasModal
+ isOpen={isOpen}
+ onClose={() => uiStoreActions.setResizeCanvasModalOpen(false)}
+ currentDimensions={dims}
+ onResize={onResize}
+ />
+ );
+ };
+
+ root = createRoot(container as unknown as HTMLElement);
+ act(() => {
+ root!.render(<Harness />);
+ });
+
+ expect(useUiStore.getState().canvasResizeDraft?.cropX).toBe(0);
+ expect(useUiStore.getState().canvasResizeDraft?.width).toBe(1000);
+
+ // Step 1: ArrowRight + Shift (+10px cropX)
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(
+ makeKeyEvent('ArrowRight', { shiftKey: true })
+ );
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.cropX).toBe(10);
+
+ // Step 2: Simulate continuous pointer drag (multiple draft moves between pointerdown and pointerup -> 1 step!)
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(new Event('pointerdown'));
+ const cur = useUiStore.getState().canvasResizeDraft!;
+ uiStoreActions.updateCanvasResizeDraft({ ...cur, width: 900, height: 700 });
+ uiStoreActions.updateCanvasResizeDraft({ ...cur, width: 750, height: 600 });
+ (dom.win as unknown as EventTarget).dispatchEvent(new Event('pointerup'));
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.width).toBe(750);
+ expect(useUiStore.getState().canvasResizeDraft?.height).toBe(600);
+
+ // Ctrl+Z #1: Reverts the entire drag in one step back to 1000x800, cropX=10
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(makeKeyEvent('z', { ctrlKey: true }));
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.width).toBe(1000);
+ expect(useUiStore.getState().canvasResizeDraft?.cropX).toBe(10);
+
+ // Ctrl+Z #2: Reverts the arrow nudge back to cropX=0
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(makeKeyEvent('z', { ctrlKey: true }));
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.cropX).toBe(0);
+
+ // Ctrl+Y: Redoes arrow nudge
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(makeKeyEvent('y', { ctrlKey: true }));
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.cropX).toBe(10);
+
+ // Ctrl+Shift+Z: Redoes drag
+ act(() => {
+ (dom.win as unknown as EventTarget).dispatchEvent(
+ makeKeyEvent('z', { ctrlKey: true, shiftKey: true })
+ );
+ });
+ expect(useUiStore.getState().canvasResizeDraft?.width).toBe(750);
+ expect(useUiStore.getState().canvasResizeDraft?.height).toBe(600);
+ });
+});
diff --git a/src/utils/__tests__/drawingStuckRegression.test.tsx b/src/utils/__tests__/drawingStuckRegression.test.tsx
new file mode 100644
index 0000000..c5602e3
--- /dev/null
+++ b/src/utils/__tests__/drawingStuckRegression.test.tsx
@@ -0,0 +1,743 @@
+import React, { act } from 'react';
+import { createRoot, Root } from 'react-dom/client';
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import { SparseTileGrid } from '../tileEngine';
+import {
+ useBrushStrokeSession,
+ UseBrushStrokeSessionResult,
+} from '../../hooks/drawing/useBrushStrokeSession';
+import {
+ createInitialStrokeSessionState,
+ StrokeSessionHelpers,
+ StrokeSessionState,
+ UseBrushStrokeSessionParams,
+} from '../../hooks/drawing/brushStrokeSession/types';
+import { runPointerDown } from '../../hooks/drawing/brushStrokeSession/pointerDownHandler';
+import { runPointerUp } from '../../hooks/drawing/brushStrokeSession/pointerUpHandler';
+import {
+ NATIVE_PEN_POINTER_ID,
+ NativeTabletBridgeState,
+ processNativeTabletBatch,
+} from '../../hooks/drawing/brushStrokeSession/nativeTabletBridge';
+import {
+ clearNativePenContact,
+ NativeTabletSample,
+ recordNativeTabletBatchForSuppression,
+ resetNativeTabletSuppressionState,
+} from '../nativeTabletInput';
+import { applySelectionCanvasClip } from '../../hooks/drawing/types';
+import { GlobalShortcutListener } from '../../components/GlobalShortcutListener';
+import { toolStoreActions, useToolStore, useUiStore } from '../../stores';
+import type { BrushSettings, LayerItem } from '../../types/editor';
+
+function getTestBrushSettings(overrides: Partial<BrushSettings> = {}): BrushSettings {
+ return {
+ ...useToolStore.getState().brushSettings,
+ color: '#112233',
+ size: 12,
+ opacity: 1,
+ hardness: 1,
+ flow: 1,
+ spacing: 0.1,
+ ...overrides,
+ };
+}
+
+class ShimNode extends EventTarget {
+ nodeType = 1;
+ nodeName = 'DIV';
+ tagName = 'DIV';
+ namespaceURI = 'http://www.w3.org/1999/xhtml';
+ ownerDocument: any;
+ parentNode: any = null;
+ childNodes: any[] = [];
+ style: Record<string, string> = {};
+ width = 256;
+ height = 256;
+ private _ctx: any = null;
+
+ constructor(tag = 'DIV', doc?: any) {
+ super();
+ this.nodeName = tag.toUpperCase();
+ this.tagName = this.nodeName;
+ this.ownerDocument = doc ?? null;
+ }
+
+ appendChild(c: any) {
+ c.parentNode = this;
+ this.childNodes.push(c);
+ return c;
+ }
+
+ removeChild(c: any) {
+ const i = this.childNodes.indexOf(c);
+ if (i >= 0) this.childNodes.splice(i, 1);
+ c.parentNode = null;
+ return c;
+ }
+
+ insertBefore(c: any, ref: any) {
+ c.parentNode = this;
+ const i = this.childNodes.indexOf(ref);
+ if (i >= 0) this.childNodes.splice(i, 0, c);
+ else this.childNodes.push(c);
+ return c;
+ }
+
+ getBoundingClientRect(): DOMRect {
+ return {
+ left: 0,
+ top: 0,
+ right: 256,
+ bottom: 256,
+ width: 256,
+ height: 256,
+ x: 0,
+ y: 0,
+ toJSON: () => ({}),
+ } as DOMRect;
+ }
+
+ setPointerCapture() {}
+ releasePointerCapture() {}
+ hasPointerCapture() {
+ return false;
+ }
+
+ getContext() {
+ if (!this._ctx) {
+ this._ctx = createMockCtx(this);
+ }
+ return this._ctx;
+ }
+}
+
+function createMockCtx(canvas: any) {
+ return {
+ canvas,
+ globalAlpha: 1,
+ globalCompositeOperation: 'source-over',
+ fillStyle: '#000',
+ strokeStyle: '#000',
+ lineWidth: 1,
+ lineCap: 'round',
+ lineJoin: 'round',
+ imageSmoothingEnabled: true,
+ save: vi.fn(),
+ restore: vi.fn(),
+ resetTransform: vi.fn(),
+ setTransform: vi.fn(),
+ translate: vi.fn(),
+ scale: vi.fn(),
+ rotate: vi.fn(),
+ clearRect: vi.fn(),
+ fillRect: vi.fn(),
+ beginPath: vi.fn(),
+ closePath: vi.fn(),
+ moveTo: vi.fn(),
+ lineTo: vi.fn(),
+ arc: vi.fn(),
+ rect: vi.fn(),
+ fill: vi.fn(),
+ stroke: vi.fn(),
+ clip: vi.fn(),
+ drawImage: vi.fn(),
+ putImageData: vi.fn(),
+ createImageData: (w: number, h: number) => ({
+ width: w,
+ height: h,
+ data: new Uint8ClampedArray(w * h * 4),
+ }),
+ getImageData: (_x: number, _y: number, w: number, h: number) => ({
+ width: w,
+ height: h,
+ data: new Uint8ClampedArray(w * h * 4),
+ }),
+ };
+}
+
+function installDomShim() {
+ const doc: any = new ShimNode('#document');
+ doc.nodeType = 9;
+ doc.hidden = false;
+ doc.activeElement = null;
+ doc.createElement = (tag: string) => new ShimNode(tag, doc);
+ doc.createTextNode = (txt: string) => {
+ const n: any = new ShimNode('#text', doc);
+ n.nodeType = 3;
+ n.nodeValue = txt;
+ return n;
+ };
+ doc.documentElement = new ShimNode('HTML', doc);
+ doc.body = new ShimNode('BODY', doc);
+ doc.getElementById = () => null;
+
+ let nextRafId = 1;
+ const rafQueue = new Map<number, FrameRequestCallback>();
+
+ const win: any = new EventTarget();
+ win.document = doc;
+ doc.defaultView = win;
+ class HTMLIFrameElementShim extends ShimNode {}
+ win.HTMLElement = ShimNode;
+ win.HTMLIFrameElement = HTMLIFrameElementShim;
+ win.Element = ShimNode;
+ win.Node = ShimNode;
+ win.devicePixelRatio = 1;
+ win.navigator = { platform: 'Win32', userAgent: 'Windows' };
+ win.getSelection = () => ({ toString: () => '' });
+ win.requestAnimationFrame = (cb: FrameRequestCallback) => {
+ const id = nextRafId++;
+ rafQueue.set(id, cb);
+ return id;
+ };
+ win.cancelAnimationFrame = (id: number) => {
+ rafQueue.delete(id);
+ };
+
+ (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true;
+ (globalThis as any).window = win;
+ (globalThis as any).document = doc;
+ (globalThis as any).HTMLElement = ShimNode;
+ (globalThis as any).HTMLIFrameElement = HTMLIFrameElementShim;
+ (globalThis as any).Element = ShimNode;
+ (globalThis as any).Node = ShimNode;
+ (globalThis as any).requestAnimationFrame = win.requestAnimationFrame;
+ (globalThis as any).cancelAnimationFrame = win.cancelAnimationFrame;
+
+ const flushRafs = () => {
+ const pending = Array.from(rafQueue.entries());
+ rafQueue.clear();
+ for (const [, cb] of pending) {
+ cb(performance.now());
+ }
+ };
+
+ return { win, doc, rafQueue, flushRafs };
+}
+
+function makePointerEvent(
+ overrides: Partial<{
+ pointerId: number;
+ pointerType: string;
+ button: number;
+ buttons: number;
+ clientX: number;
+ clientY: number;
+ pressure: number;
+ timeStamp: number;
+ altKey: boolean;
+ shiftKey: boolean;
+ ctrlKey: boolean;
+ }> = {}
+): React.PointerEvent<HTMLElement> {
+ const ev: any = {
+ pointerId: 1,
+ pointerType: 'mouse',
+ button: 0,
+ buttons: 1,
+ clientX: 100,
+ clientY: 100,
+ pressure: 0.5,
+ tiltX: 0,
+ tiltY: 0,
+ twist: 0,
+ timeStamp: performance.now(),
+ altKey: false,
+ shiftKey: false,
+ ctrlKey: false,
+ metaKey: false,
+ preventDefault: vi.fn(),
+ stopPropagation: vi.fn(),
+ ...overrides,
+ };
+ ev.nativeEvent = ev;
+ return ev as React.PointerEvent<HTMLElement>;
+}
+
+function makeNativeSample(
+ overrides: Partial<NativeTabletSample> = {}
+): NativeTabletSample {
+ return {
+ clientX: 120,
+ clientY: 120,
+ pressure: 0.6,
+ tiltX: 0,
+ tiltY: 0,
+ twist: 0,
+ timestamp: 1000,
+ buttons: 1,
+ phase: 1,
+ backend: 2,
+ ...overrides,
+ };
+}
+
+describe('Drawing stuck-state regression fixes (Ctrl+Z symptom)', () => {
+ let shim: ReturnType<typeof installDomShim>;
+ let root: Root | null = null;
+ let container: any;
+
+ beforeEach(() => {
+ shim = installDomShim();
+ container = shim.doc.createElement('div');
+ shim.doc.body.appendChild(container);
+ useToolStore.reset();
+ useUiStore.reset();
+ resetNativeTabletSuppressionState(false);
+ });
+
+ afterEach(async () => {
+ if (root) {
+ await act(async () => {
+ root!.unmount();
+ });
+ root = null;
+ }
+ resetNativeTabletSuppressionState(false);
+ });
+
+ it('aborts stroke & nulls drawRafId cleanly when disabled toggles mid-stroke (e.g. Space pan)', async () => {
+ const viewportEl = shim.doc.createElement('div');
+ const draftCanvas = shim.doc.createElement('canvas');
+ const grid = new SparseTileGrid();
+ const isDrawingRef = { current: false };
+ const layer: LayerItem = {
+ id: 'layer-1',
+ name: 'Layer 1',
+ type: 'raster',
+ visible: true,
+ locked: false,
+ opacity: 1,
+ blendMode: 'normal',
+ alphaLocked: false,
+ parentId: null,
+ };
+
+ let session!: UseBrushStrokeSessionResult;
+ const pushHistoryStep = vi.fn();
+
+ function Harness({ disabled }: { disabled: boolean }) {
+ const viewportRef = React.useRef<HTMLDivElement | null>(viewportEl);
+ const interactionRef = React.useRef<HTMLDivElement | null>(viewportEl);
+ const draftRef = React.useRef<HTMLCanvasElement | null>(draftCanvas);
+ const activeTileGridRef = React.useRef(grid);
+ const layersRef = React.useRef<LayerItem[] | undefined>([layer]);
+ const brushSettings: BrushSettings = getTestBrushSettings({ size: 12 });
+
+ session = useBrushStrokeSession({
+ disabled,
+ activeSessionId: 'doc-1',
+ viewportRef,
+ interactionRef,
+ isDrawingRef,
+ lastStrokeEndRef: React.useRef(null),
+ panRef: React.useRef({ x: 0, y: 0 }),
+ zoomRef: React.useRef(1),
+ rotationRef: React.useRef(0),
+ flipXRef: React.useRef(false),
+ flipYRef: React.useRef(false),
+ toolOverrideRef: React.useRef('brush'),
+ brushSettingsOverrideRef: React.useRef(brushSettings),
+ colorModeRef: React.useRef('color'),
+ activeLayerIdRef: React.useRef('layer-1'),
+ activeLayerLockedRef: React.useRef(false),
+ activeLayerVisibleRef: React.useRef(true),
+ dimensionsRef: React.useRef({ width: 256, height: 256, dpi: 300 }),
+ selectionRef: React.useRef(null),
+ isMaskModeRef: React.useRef(false),
+ layersRef,
+ effectiveDraftCanvasRef: draftRef,
+ activeTileGridRef,
+ rulerRef: React.useRef(null),
+ straightRulerRef: React.useRef(null),
+ onActiveConstraintAxisChangeRef: React.useRef(undefined),
+ onQuickShapePreviewChangeRef: React.useRef(undefined),
+ onUpdateLayerThumbnail: vi.fn(),
+ onUpdateMaskThumbnailRef: React.useRef(undefined),
+ onCollabStrokeStartRef: React.useRef(undefined),
+ onCollabStrokeChunkRef: React.useRef(undefined),
+ onCollabStrokeFinishRef: React.useRef(undefined),
+ onCollabCursorMoveRef: React.useRef(undefined),
+ getActiveMaskCanvas: () => null,
+ pushHistoryStep,
+ flushPendingHistoryTasks: vi.fn(),
+ enqueueHistoryTask: (fn) => fn(),
+ });
+ return null;
+ }
+
+ await act(async () => {
+ root = createRoot(container);
+ root.render(<Harness disabled={false} />);
+ });
+
+ // 1. Start a stroke and move pointer so drawRafId is actively pending (before flushing)
+ act(() => {
+ session.handlePointerDown(makePointerEvent({ pointerId: 7, clientX: 80, clientY: 80 }));
+ session.handlePointerMove(makePointerEvent({ pointerId: 7, clientX: 110, clientY: 100 }));
+ });
+ expect(isDrawingRef.current).toBe(true);
+ const pendingBeforeDisable = shim.rafQueue.size;
+ expect(pendingBeforeDisable).toBeGreaterThan(0);
+
+ // 2. Toggle disabled=true mid-stroke (simulating tapping Space / pan / rotate)
+ await act(async () => {
+ root!.render(<Harness disabled={true} />);
+ });
+
+ // Stroke MUST be cleanly aborted and its drawRafId cancelled & nulled
+ expect(isDrawingRef.current).toBe(false);
+ expect(shim.rafQueue.size).toBeLessThan(pendingBeforeDisable);
+
+ // 3. Re-enable drawing and start a brand-new stroke WITHOUT pressing Ctrl+Z
+ await act(async () => {
+ root!.render(<Harness disabled={false} />);
+ });
+
+ shim.flushRafs();
+ act(() => {
+ session.handlePointerDown(makePointerEvent({ pointerId: 8, clientX: 90, clientY: 90 }));
+ });
+ expect(isDrawingRef.current).toBe(true);
+ const rafsBeforeMove = shim.rafQueue.size;
+
+ act(() => {
+ session.handlePointerMove(makePointerEvent({ pointerId: 8, clientX: 140, clientY: 120 }));
+ });
+ // Live draw rAF MUST be scheduled (previously permanently blocked by non-null orphaned drawRafId!)
+ expect(shim.rafQueue.size).toBeGreaterThan(rafsBeforeMove);
+
+ act(() => {
+ shim.flushRafs();
+ session.handlePointerUp(makePointerEvent({ pointerId: 8, clientX: 140, clientY: 120 }));
+ });
+ expect(isDrawingRef.current).toBe(false);
+ expect(pushHistoryStep).toHaveBeenCalledTimes(1);
+ });
+
+ it('DOM pointerdown recovers from stale native pen lockout, while still protecting live native pen contact', () => {
+ const state: StrokeSessionState = createInitialStrokeSessionState();
+ const abortSpy = vi.fn(() => {
+ params.isDrawingRef.current = false;
+ state.activePointerId = null;
+ });
+ const viewportEl = shim.doc.createElement('div');
+ const draftCanvas = shim.doc.createElement('canvas');
+ const grid = new SparseTileGrid();
+
+ const params: UseBrushStrokeSessionParams = {
+ disabled: false,
+ activeSessionId: 'doc-1',
+ viewportRef: { current: viewportEl },
+ interactionRef: { current: viewportEl },
+ isDrawingRef: { current: true },
+ lastStrokeEndRef: { current: null },
+ panRef: { current: { x: 0, y: 0 } },
+ zoomRef: { current: 1 },
+ rotationRef: { current: 0 },
+ flipXRef: { current: false },
+ flipYRef: { current: false },
+ toolOverrideRef: { current: 'brush' },
+ brushSettingsOverrideRef: { current: getTestBrushSettings() },
+ colorModeRef: { current: 'color' },
+ activeLayerIdRef: { current: 'layer-1' },
+ activeLayerLockedRef: { current: false },
+ activeLayerVisibleRef: { current: true },
+ dimensionsRef: { current: { width: 256, height: 256, dpi: 300 } },
+ selectionRef: { current: null },
+ isMaskModeRef: { current: false },
+ layersRef: {
+ current: [
+ {
+ id: 'layer-1',
+ name: 'Layer 1',
+ type: 'raster',
+ visible: true,
+ locked: false,
+ opacity: 1,
+ blendMode: 'normal',
+ alphaLocked: false,
+ parentId: null,
+ },
+ ],
+ },
+ effectiveDraftCanvasRef: { current: draftCanvas },
+ activeTileGridRef: { current: grid },
+ rulerRef: { current: null },
+ straightRulerRef: { current: null },
+ onActiveConstraintAxisChangeRef: { current: undefined },
+ onQuickShapePreviewChangeRef: { current: undefined },
+ onUpdateLayerThumbnail: vi.fn(),
+ onUpdateMaskThumbnailRef: { current: undefined },
+ onCollabStrokeStartRef: { current: undefined },
+ onCollabStrokeChunkRef: { current: undefined },
+ onCollabStrokeFinishRef: { current: undefined },
+ onCollabCursorMoveRef: { current: undefined },
+ getActiveMaskCanvas: () => null,
+ pushHistoryStep: vi.fn(),
+ flushPendingHistoryTasks: vi.fn(),
+ enqueueHistoryTask: (fn) => fn(),
+ };
+
+ const helpers: StrokeSessionHelpers = {
+ getTool: () => 'brush',
+ getBrushSettings: () => getTestBrushSettings(),
+ getPredictedCanvas: () => null,
+ clearPredictedCanvas: vi.fn(),
+ emitConstraintAxisChange: vi.fn(),
+ markTouchedTiles: vi.fn(),
+ getViewportRect: () => viewportEl.getBoundingClientRect(),
+ dispatchPointerStat: vi.fn(),
+ abortActiveStroke: abortSpy,
+ getCanvasPoint: () => ({ x: 100, y: 100, pressure: 0.5, width: 12, timestamp: performance.now() }),
+ resolveEffectiveOpacitySensor: () => undefined,
+ resolveLiveAntiAlias: () => undefined,
+ buildTouchedTileSpans: () => [],
+ buildLiveBrushOptions: () => ({} as any),
+ resolveStrokeColor: () => '#000000',
+ emitLiveSegment: vi.fn(),
+ renderPredictedStroke: vi.fn(),
+ flushPendingPoints: vi.fn(),
+ };
+
+ // (a) Active live native pen contact MUST NOT be aborted by synthesized mouse pointerdown
+ state.activePointerId = NATIVE_PEN_POINTER_ID;
+ params.isDrawingRef.current = true;
+ resetNativeTabletSuppressionState(true);
+ recordNativeTabletBatchForSuppression([makeNativeSample({ phase: 1 })], performance.now());
+
+ runPointerDown(state, params, helpers, makePointerEvent({ pointerId: 1, pointerType: 'mouse' }));
+ expect(abortSpy).not.toHaveBeenCalled();
+ expect(state.activePointerId).toBe(NATIVE_PEN_POINTER_ID);
+
+ // (b) Once native pen is no longer in contact (e.g. missed pen-up / focus loss / hover),
+ // a mouse pointerdown MUST recover instead of staying permanently locked out!
+ clearNativePenContact();
+ runPointerDown(state, params, helpers, makePointerEvent({ pointerId: 1, pointerType: 'mouse' }));
+ expect(abortSpy).toHaveBeenCalledTimes(1);
+ expect(state.activePointerId).toBe(1);
+ expect(params.isDrawingRef.current).toBe(true);
+ });
+
+ it('runPointerUp always resets isDrawingRef and activePointerId even if commit throws', () => {
+ const state = createInitialStrokeSessionState();
+ state.activePointerId = 5;
+ state.drawRafId = 99;
+ const isDrawingRef = { current: true };
+ const draftCanvas = shim.doc.createElement('canvas');
+ const grid = new SparseTileGrid();
+
+ const params: any = {
+ isDrawingRef,
+ interactionRef: { current: null },
+ effectiveDraftCanvasRef: { current: draftCanvas },
+ activeTileGridRef: { current: grid },
+ dimensionsRef: { current: { width: 256, height: 256, dpi: 300 } },
+ activeLayerIdRef: { current: 'layer-1' },
+ colorModeRef: { current: 'color' },
+ layersRef: { current: [] },
+ isMaskModeRef: { current: false },
+ getActiveMaskCanvas: () => null,
+ onQuickShapePreviewChangeRef: { current: undefined },
+ onUpdateLayerThumbnail: vi.fn(),
+ onUpdateMaskThumbnailRef: { current: undefined },
+ onCollabStrokeFinishRef: { current: undefined },
+ };
+
+ const helpers: any = {
+ clearPredictedCanvas: vi.fn(),
+ flushPendingPoints: vi.fn(() => {
+ throw new Error('simulated commit failure');
+ }),
+ emitConstraintAxisChange: vi.fn(),
+ };
+
+ const errSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ try {
+ expect(() =>
+ runPointerUp(state, params, helpers, makePointerEvent({ pointerId: 5 }))
+ ).not.toThrow();
+ } finally {
+ errSpy.mockRestore();
+ }
+
+ expect(isDrawingRef.current).toBe(false);
+ expect(state.activePointerId).toBeNull();
+ expect(state.drawRafId).toBeNull();
+ });
+
+ it('nativeTabletBridge self-heals rejected pointerdown, hover after dropped pen-up, and delayed new pen-down', () => {
+ const bridge: NativeTabletBridgeState = {
+ nativeStrokeActive: false,
+ prevToolBeforeEraserFlip: null,
+ contactBlockedUntilPenUp: false,
+ };
+ const modKeys = { shift: false, alt: false };
+
+ let strokeAccepted = false;
+ const onPointerDown = vi.fn();
+ const onPointerMove = vi.fn();
+ const onPointerUp = vi.fn();
+ const onHover = vi.fn();
+
+ const cb = {
+ getTool: () => 'brush' as const,
+ selectTool: vi.fn(),
+ isDisabled: () => false,
+ isStrokeActive: () => strokeAccepted,
+ isPointOverCanvasViewport: () => true,
+ onPointerDown: (e: any) => {
+ onPointerDown(e);
+ return strokeAccepted;
+ },
+ onPointerMove,
+ onPointerUp: (e: any) => {
+ strokeAccepted = false;
+ onPointerUp(e);
+ },
+ onHover,
+ };
+
+ // 1. Rejected pointerdown (e.g. locked layer): nativeStrokeActive MUST revert to false
+ processNativeTabletBatch([makeNativeSample({ phase: 1, timestamp: 100 })], bridge, modKeys, cb);
+ expect(onPointerDown).toHaveBeenCalledTimes(1);
+ expect(bridge.nativeStrokeActive).toBe(false);
+
+ // 2. Accepted stroke whose phase=3 pen-up was dropped -> hover (phase=0, pressure=0, buttons=0) ends it!
+ strokeAccepted = true;
+ processNativeTabletBatch([makeNativeSample({ phase: 1, timestamp: 200 })], bridge, modKeys, cb);
+ expect(bridge.nativeStrokeActive).toBe(true);
+
+ processNativeTabletBatch(
+ [makeNativeSample({ phase: 0, buttons: 0, pressure: 0, timestamp: 240 })],
+ bridge,
+ modKeys,
+ cb
+ );
+ expect(onPointerUp).toHaveBeenCalledTimes(1);
+ expect(bridge.nativeStrokeActive).toBe(false);
+ expect(onHover).toHaveBeenCalledTimes(1);
+
+ // 3. Duplicate immediate phase=1 within 60ms continues as move (child-HWND dedup),
+ // whereas a delayed phase=1 (>60ms after dropped pen-up) ends the old stroke and starts fresh!
+ strokeAccepted = true;
+ processNativeTabletBatch([makeNativeSample({ phase: 1, timestamp: 300 })], bridge, modKeys, cb);
+ processNativeTabletBatch([makeNativeSample({ phase: 1, timestamp: 305 })], bridge, modKeys, cb);
+ expect(onPointerMove).toHaveBeenCalledTimes(1);
+ expect(onPointerUp).toHaveBeenCalledTimes(1);
+
+ // Delayed genuine new pen-down (300ms later after missed pen-up)
+ const downCountBefore = onPointerDown.mock.calls.length;
+ onPointerDown.mockImplementationOnce(() => {
+ strokeAccepted = true;
+ });
+ processNativeTabletBatch([makeNativeSample({ phase: 1, timestamp: 600 })], bridge, modKeys, cb);
+ expect(onPointerUp).toHaveBeenCalledTimes(2);
+ expect(onPointerDown.mock.calls.length).toBe(downCountBefore + 1);
+ expect(bridge.nativeStrokeActive).toBe(true);
+ });
+
+ it('GlobalShortcutListener self-heals a stuck Alt eyedropper hold on pointerdown when Alt is no longer pressed', async () => {
+ toolStoreActions.selectTool('brush');
+ expect(useToolStore.getState().tool).toBe('brush');
+
+ const noop = vi.fn();
+ await act(async () => {
+ root = createRoot(container);
+ root.render(
+ <GlobalShortcutListener
+ hasOpenDocument={true}
+ dimensions={{ width: 256, height: 256, dpi: 300 }}
+ layers={[]}
+ activeLayer={undefined}
+ activeLayerId="layer-1"
+ selection={null}
+ transformSession={null}
+ textSession={null}
+ activeAnimationTimeline={null}
+ isSpaceDown={false}
+ isHostModalOpen={false}
+ isDrawingRef={{ current: false }}
+ isSelectionPenDrawingRef={{ current: false }}
+ isPipetteSamplingRef={{ current: false }}
+ handleUndo={noop}
+ redo={noop}
+ handleAddLayer={noop}
+ handleTriggerOpenFile={noop}
+ handleSave={noop}
+ handleSaveAs={noop}
+ duplicateLayer={noop}
+ handleCutSelection={noop}
+ handleCopySelection={noop}
+ handleCopySelectedLayer={noop}
+ handlePasteSelectedLayer={noop}
+ handleMoveSelectionToNewLayer={noop}
+ handleCopySelectionToNewLayer={noop}
+ handleGroupSelectedLayers={noop}
+ handleStartTransform={noop}
+ handleSelectAll={noop}
+ handleDeselect={noop}
+ handleInvertSelection={noop}
+ handleApplyReverseGradient={noop}
+ handleOpenTonalModal={noop}
+ handleUpdateAnimationTimeline={noop}
+ handleAddAnimationCel={noop}
+ toggleFlipHorizontal={noop}
+ toggleFlipVertical={noop}
+ handleClearSelection={noop}
+ handleDeleteSelectedLayer={noop}
+ handleCancelTransform={noop}
+ handleCancelText={noop}
+ handleApplyTransform={noop}
+ handleProcessFile={noop}
+ showToast={noop}
+ />
+ );
+ });
+
+ // Press bare Alt -> temporarily switches to pipette
+ act(() => {
+ const altDown = Object.assign(new Event('keydown', { cancelable: true }), {
+ key: 'Alt',
+ code: 'AltLeft',
+ altKey: true,
+ ctrlKey: false,
+ metaKey: false,
+ shiftKey: false,
+ repeat: false,
+ });
+ shim.win.dispatchEvent(altDown);
+ });
+ expect(useToolStore.getState().tool).toBe('pipette');
+
+ // Simulate Windows/WebView2 swallowing Alt keyup: user clicks canvas with altKey=false
+ act(() => {
+ const clickWithoutAlt = Object.assign(new Event('pointerdown', { cancelable: true }), {
+ altKey: false,
+ ctrlKey: false,
+ shiftKey: false,
+ metaKey: false,
+ });
+ shim.win.dispatchEvent(clickWithoutAlt);
+ });
+
+ // Tool MUST immediately revert back to 'brush' without needing Ctrl+Z!
+ expect(useToolStore.getState().tool).toBe('brush');
+ });
+
+ it('applySelectionCanvasClip ignores degenerate 0x0 rect selection so strokes are never silently clipped out', () => {
+ const ctx = createMockCtx({});
+ applySelectionCanvasClip(ctx as any, {
+ type: 'rect',
+ bounds: { x: 10, y: 10, width: 0, height: 0 },
+ });
+ expect(ctx.clip).not.toHaveBeenCalled();
+
+ applySelectionCanvasClip(ctx as any, {
+ type: 'rect',
+ bounds: { x: 10, y: 10, width: 50, height: 40 },
+ });
+ expect(ctx.clip).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/utils/__tests__/reloadGuard.test.ts b/src/utils/__tests__/reloadGuard.test.ts
new file mode 100644
index 0000000..583a59c
--- /dev/null
+++ b/src/utils/__tests__/reloadGuard.test.ts
@@ -0,0 +1,176 @@
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import {
+ _resetReloadGuardForTests,
+ installReloadGuard,
+ isBrowserReloadOrNavShortcut,
+ markIntentionalReload,
+ shouldBlockDefaultContextMenu,
+ shouldConfirmBeforeUnload,
+} from '../reloadGuard';
+import { shortcutManager } from '../shortcutManager';
+
+function makeKeyEvent(
+ overrides: Partial<{
+ key: string;
+ code: string;
+ ctrlKey: boolean;
+ metaKey: boolean;
+ shiftKey: boolean;
+ altKey: boolean;
+ repeat: boolean;
+ }> = {}
+): KeyboardEvent {
+ const ev = new Event('keydown', { bubbles: true, cancelable: true }) as KeyboardEvent;
+ Object.assign(ev, {
+ key: '',
+ code: '',
+ ctrlKey: false,
+ metaKey: false,
+ shiftKey: false,
+ altKey: false,
+ repeat: false,
+ ...overrides,
+ });
+ return ev;
+}
+
+describe('Accidental Reload & Page Navigation Protection', () => {
+ beforeEach(() => {
+ _resetReloadGuardForTests();
+ });
+
+ afterEach(() => {
+ _resetReloadGuardForTests();
+ });
+
+ it('detects reload and browser history navigation shortcuts across layouts and platforms', () => {
+ // Ctrl+R / Cmd+R / Ctrl+Shift+R / Cyrillic Ctrl+К (physical KeyR)
+ expect(isBrowserReloadOrNavShortcut({ key: 'r', code: 'KeyR', ctrlKey: true }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'R', code: 'KeyR', ctrlKey: true, shiftKey: true }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'r', code: 'KeyR', metaKey: true }, true)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'к', code: 'KeyR', ctrlKey: true }, false)).toBe(true);
+
+ // F5 variants
+ expect(isBrowserReloadOrNavShortcut({ key: 'F5', code: 'F5' }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'F5', code: 'F5', ctrlKey: true }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'F5', code: 'F5', shiftKey: true }, false)).toBe(true);
+
+ // Hardware browser keys
+ expect(isBrowserReloadOrNavShortcut({ key: 'BrowserRefresh', code: 'BrowserRefresh' }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'BrowserBack', code: 'BrowserBack' }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'BrowserForward', code: 'BrowserForward' }, false)).toBe(true);
+
+ // Alt+Left / Alt+Right blocked on Windows/Linux, allowed on macOS (Option+Arrow word jump)
+ expect(isBrowserReloadOrNavShortcut({ key: 'ArrowLeft', code: 'ArrowLeft', altKey: true }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'ArrowRight', code: 'ArrowRight', altKey: true }, false)).toBe(true);
+ expect(isBrowserReloadOrNavShortcut({ key: 'ArrowLeft', code: 'ArrowLeft', altKey: true }, true)).toBe(false);
+
+ // Legitimate non-reload shortcuts are unaffected
+ expect(isBrowserReloadOrNavShortcut({ key: 'r', code: 'KeyR' }, false)).toBe(false);
+ expect(isBrowserReloadOrNavShortcut({ key: 'R', code: 'KeyR', shiftKey: true }, false)).toBe(false);
+ expect(isBrowserReloadOrNavShortcut({ key: 'z', code: 'KeyZ', ctrlKey: true }, false)).toBe(false);
+ expect(isBrowserReloadOrNavShortcut({ key: 's', code: 'KeyS', ctrlKey: true }, false)).toBe(false);
+ expect(isBrowserReloadOrNavShortcut({ key: 'r', code: 'KeyR', ctrlKey: true, altKey: true }, false)).toBe(false);
+ });
+
+ it('prevents Ctrl+R / F5 reloads without blocking Ink Studio Ctrl+Shift+R or downstream listeners', () => {
+ const fakeWin = new EventTarget() as unknown as Window;
+ const onBlocked = vi.fn();
+ const downstreamListener = vi.fn();
+
+ const uninstall = installReloadGuard({
+ target: fakeWin,
+ getDocuments: () => [{ isDirty: true }],
+ isFinalizingClose: () => false,
+ shouldNotifyBlockedKey: (e) => !shortcutManager.matchEvent(e, {}),
+ onBlockedReloadShortcut: onBlocked,
+ });
+
+ // Downstream app shortcut listener (bubble phase, like GlobalShortcutListener)
+ fakeWin.addEventListener('keydown', downstreamListener);
+
+ // 1. Bare Ctrl+R: defaultPrevented = true AND user gets toast notification
+ const ctrlR = makeKeyEvent({ key: 'r', code: 'KeyR', ctrlKey: true });
+ fakeWin.dispatchEvent(ctrlR);
+ expect(ctrlR.defaultPrevented).toBe(true);
+ expect(downstreamListener).toHaveBeenCalledTimes(1);
+ expect(onBlocked).toHaveBeenCalledTimes(1);
+
+ // 2. Ctrl+Shift+R (Perspective Ruler): browser hard-reload is prevented,
+ // downstream listener STILL runs, and no false "reload blocked" toast fires
+ const ctrlShiftR = makeKeyEvent({ key: 'R', code: 'KeyR', ctrlKey: true, shiftKey: true });
+ fakeWin.dispatchEvent(ctrlShiftR);
+ expect(ctrlShiftR.defaultPrevented).toBe(true);
+ expect(downstreamListener).toHaveBeenCalledTimes(2);
+ expect(onBlocked).toHaveBeenCalledTimes(1);
+
+ // 3. Normal Ctrl+Z: untouched
+ const ctrlZ = makeKeyEvent({ key: 'z', code: 'KeyZ', ctrlKey: true });
+ fakeWin.dispatchEvent(ctrlZ);
+ expect(ctrlZ.defaultPrevented).toBe(false);
+ expect(downstreamListener).toHaveBeenCalledTimes(3);
+
+ uninstall();
+ fakeWin.removeEventListener('keydown', downstreamListener);
+ });
+
+ it('blocks default context menu on canvas/chrome/sliders while preserving Copy/Paste in text inputs', () => {
+ expect(shouldBlockDefaultContextMenu({ tagName: 'CANVAS' } as any, '')).toBe(true);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'DIV' } as any, '')).toBe(true);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'INPUT', type: 'range' } as any, '')).toBe(true);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'INPUT', type: 'checkbox' } as any, '')).toBe(true);
+
+ expect(shouldBlockDefaultContextMenu({ tagName: 'INPUT', type: 'text' } as any, '')).toBe(false);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'TEXTAREA' } as any, '')).toBe(false);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'DIV', isContentEditable: true } as any, '')).toBe(false);
+ expect(shouldBlockDefaultContextMenu({ tagName: 'DIV' } as any, 'selected text')).toBe(false);
+ });
+
+ it('guards beforeunload whenever unsaved artwork or an active stroke exists, unless closing/reloading intentionally', () => {
+ const fakeWin = new EventTarget() as unknown as Window;
+ let docs: Array<{ isDirty: boolean }> = [{ isDirty: false }];
+ let finalizing = false;
+ let drawingActive = false;
+
+ const uninstall = installReloadGuard({
+ target: fakeWin,
+ getDocuments: () => docs,
+ isFinalizingClose: () => finalizing,
+ isDrawingActive: () => drawingActive,
+ });
+
+ const fireBeforeUnload = () => {
+ const ev = new Event('beforeunload', { cancelable: true }) as BeforeUnloadEvent;
+ Object.defineProperty(ev, 'returnValue', { writable: true, value: undefined });
+ fakeWin.dispatchEvent(ev);
+ return ev;
+ };
+
+ // Clean document, not drawing -> does not prompt
+ expect(fireBeforeUnload().defaultPrevented).toBe(false);
+
+ // Dirty document -> blocks unload
+ docs = [{ isDirty: true }];
+ const dirtyEv = fireBeforeUnload();
+ expect(dirtyEv.defaultPrevented).toBe(true);
+ expect(dirtyEv.returnValue).toBe('');
+
+ // Clean document but mid-stroke -> blocks unload
+ docs = [{ isDirty: false }];
+ drawingActive = true;
+ expect(fireBeforeUnload().defaultPrevented).toBe(true);
+
+ // Finalizing intentional app close -> allows unload even with dirty docs
+ docs = [{ isDirty: true }];
+ finalizing = true;
+ expect(fireBeforeUnload().defaultPrevented).toBe(false);
+
+ // Intentional ErrorBoundary reload -> allows unload even with dirty docs
+ finalizing = false;
+ expect(shouldConfirmBeforeUnload(docs, false, false)).toBe(true);
+ markIntentionalReload();
+ expect(fireBeforeUnload().defaultPrevented).toBe(false);
+
+ uninstall();
+ });
+});
diff --git a/src/utils/appCloseFlow.ts b/src/utils/appCloseFlow.ts
index 718bc49..17e7a42 100644
--- a/src/utils/appCloseFlow.ts
+++ b/src/utils/appCloseFlow.ts
@@ -9,6 +9,7 @@ import {
useUiStore,
} from '../stores';
import { flushPendingBrushSettingsSave } from './brushPresetManager';
+import { t } from '../i18n';
export type SaveDocumentResult = 'saved' | 'canceled' | 'error';
@@ -22,7 +23,7 @@ export function getUnsavedDocumentIds(documents: readonly DocumentTab[]): string
export function formatCanvasDisplayName(name: string | undefined | null): string {
const cleaned = (name || '').replace(/\*+$/, '').trim();
- return cleaned || 'Untitled';
+ return cleaned || t('Untitled');
}
export function computeInitialClosePromptState(dirtyDocIds: string[]): AppClosePromptState {
@@ -161,6 +162,6 @@ export async function finalizeAppClose(deps: FinalizeAppCloseDeps = {}): Promise
console.error('Failed to close application window:', err);
finalizingAppClose = false;
uiStoreActions.setAppClosePrompt((prev) => ({ ...prev, isBusy: false }));
- uiStoreActions.showToast('Failed to close window');
+ uiStoreActions.showToast(t('Failed to close window'));
}
}
diff --git a/src/utils/collabFeatures.ts b/src/utils/collabFeatures.ts
index 49504d0..9ff53dc 100644
--- a/src/utils/collabFeatures.ts
+++ b/src/utils/collabFeatures.ts
@@ -24,6 +24,7 @@ import {
getBuiltinBrushConfig,
isDecorationPresetId,
} from './presetBrushes';
+import { t } from '../i18n';
export const MAX_CHAT_MESSAGE_LENGTH = 1000;
export const MAX_CHAT_HISTORY = 200;
@@ -397,7 +398,7 @@ export function buildSaveableCspBrush(
name: cleanName,
category,
badge: 'Shared',
- desc: 'Grabbed from collaborative drawing session',
+ desc: t('Grabbed from collaborative drawing session'),
tipDataUrl: bs.customTipDataUrl,
tipWidth: bs.customTipImage?.naturalWidth || bs.customTipImage?.width || undefined,
tipHeight: bs.customTipImage?.naturalHeight || bs.customTipImage?.height || undefined,
diff --git a/src/utils/collabUndoUtils.ts b/src/utils/collabUndoUtils.ts
index fbbda47..5f9e48f 100644
--- a/src/utils/collabUndoUtils.ts
+++ b/src/utils/collabUndoUtils.ts
@@ -20,6 +20,7 @@ export const NON_INVERTIBLE_COLLAB_UNDO_ACTIONS: ReadonlySet<HistoryActionType>
'filter',
'retouch',
'tonal-correction',
+ 'canvas-resize',
]);
export function isNonInvertibleCollabAction(actionType?: HistoryActionType): boolean {
diff --git a/src/utils/fileSaveDialog.ts b/src/utils/fileSaveDialog.ts
index 7cc3746..c89aea6 100644
--- a/src/utils/fileSaveDialog.ts
+++ b/src/utils/fileSaveDialog.ts
@@ -15,6 +15,7 @@
*/
import { safeLocalStorageGetItem, safeLocalStorageSetItem } from './safeStorage';
+import { t, td } from '../i18n';
export type ExportFileCategory =
| 'brush'
@@ -217,13 +218,13 @@ export async function saveFileWithDialog(
const invoke = await getTauriInvoke();
const headers: Record<string, string> = {
'x-suggested-name': encodeURIComponent(suggestedName),
- 'x-filter-name': encodeURIComponent(options.description || 'File'),
+ 'x-filter-name': encodeURIComponent(options.description ? td(options.description) : t('File')),
'x-extensions': encodeURIComponent(
normalizedExts.map((e) => e.replace(/^\./, '')).join(',')
),
};
if (options.title) {
- headers['x-dialog-title'] = encodeURIComponent(options.title);
+ headers['x-dialog-title'] = encodeURIComponent(td(options.title));
}
const rememberedDir = getRememberedSaveDir(category);
if (rememberedDir) {
@@ -269,7 +270,7 @@ export async function saveFileWithDialog(
normalizedExts.length > 0
? [
{
- description: options.description,
+ description: td(options.description),
accept: {
[sanitizeAcceptMime(mimeType)]: normalizedExts,
},
@@ -341,7 +342,7 @@ export async function saveFileWithDialog(
// 3. Fallback anchor download
if (options.fallbackToDownload === false) {
- throw new Error('Save dialog is not available in this environment');
+ throw new Error(t('Save dialog is not available in this environment'));
}
const blob = payloadToBlob(options.data, mimeType);
diff --git a/src/utils/inkbBrushFormat.ts b/src/utils/inkbBrushFormat.ts
index a82c026..5c5c6df 100644
--- a/src/utils/inkbBrushFormat.ts
+++ b/src/utils/inkbBrushFormat.ts
@@ -37,6 +37,7 @@ import { saveFileWithDialog } from './fileSaveDialog';
import { parseSutFile } from './sutParser';
import { normalizeDualBrushCompositeMode } from '../engine/DualBrushEngine';
import { toolStoreActions } from '../stores';
+import { t } from '../i18n';
export const INKB_FORMAT = 'inkb';
export const INKB_VERSION = 2;
@@ -677,10 +678,10 @@ export function serializeInkbBrush(brush: CspBrush): Uint8Array {
*/
export function parseInkbFile(buffer: ArrayBuffer, fileName: string = 'Brush.inkb'): CspBrush {
if (!buffer || buffer.byteLength === 0) {
- throw new Error('Invalid .inkb file: file is empty.');
+ throw new Error(t('Invalid .inkb file: file is empty.'));
}
if (buffer.byteLength > MAX_INKB_FILE_BYTES) {
- throw new Error('Invalid .inkb file: exceeds 25 MB safety limit.');
+ throw new Error(t('Invalid .inkb file: exceeds 25 MB safety limit.'));
}
const bytes = new Uint8Array(buffer);
@@ -694,16 +695,16 @@ export function parseInkbFile(buffer: ArrayBuffer, fileName: string = 'Brush.ink
filter: (file) => file.name === 'brush.json' && file.originalSize <= MAX_INKB_JSON_BYTES,
});
} catch {
- throw new Error('Invalid .inkb file: corrupted archive.');
+ throw new Error(t('Invalid .inkb file: corrupted archive.'));
}
const entry = entries['brush.json'];
if (!entry || entry.byteLength === 0 || entry.byteLength > MAX_INKB_JSON_BYTES) {
- throw new Error('Invalid .inkb file: missing or oversized brush.json.');
+ throw new Error(t('Invalid .inkb file: missing or oversized brush.json.'));
}
jsonText = strFromU8(entry);
} else {
if (bytes.byteLength > MAX_INKB_JSON_BYTES) {
- throw new Error('Invalid .inkb file: payload too large.');
+ throw new Error(t('Invalid .inkb file: payload too large.'));
}
jsonText = strFromU8(bytes);
}
@@ -712,24 +713,24 @@ export function parseInkbFile(buffer: ArrayBuffer, fileName: string = 'Brush.ink
try {
parsed = JSON.parse(jsonText);
} catch {
- throw new Error('Invalid .inkb file: malformed JSON payload.');
+ throw new Error(t('Invalid .inkb file: malformed JSON payload.'));
}
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
- throw new Error('Invalid .inkb file: root must be an object.');
+ throw new Error(t('Invalid .inkb file: root must be an object.'));
}
const root = parsed as Record<string, unknown>;
if (root.format !== INKB_FORMAT) {
- throw new Error('Invalid .inkb file: unrecognized format header.');
+ throw new Error(t('Invalid .inkb file: unrecognized format header.'));
}
if (typeof root.version !== 'number' || root.version < 1 || root.version > INKB_VERSION) {
- throw new Error(`Unsupported .inkb brush version: ${String(root.version)}`);
+ throw new Error(t('Unsupported .inkb brush version: {version}', { version: String(root.version) }));
}
const rawBrush = root.brush;
if (!rawBrush || typeof rawBrush !== 'object' || Array.isArray(rawBrush)) {
- throw new Error('Invalid .inkb file: missing brush definition.');
+ throw new Error(t('Invalid .inkb file: missing brush definition.'));
}
const b = rawBrush as Record<string, unknown>;
@@ -945,10 +946,10 @@ export async function exportBrushToInkbFile(
data: bytes,
suggestedName,
mimeType: 'application/octet-stream',
- description: 'Ink Studio Brush',
+ description: t('Ink Studio Brush'),
extensions: [INKB_EXTENSION],
category: 'brush',
- title: 'Save Brush As',
+ title: t('Save Brush As'),
});
return {
exported: res.saved && !res.canceled,
diff --git a/src/utils/mangaTextEngine.ts b/src/utils/mangaTextEngine.ts
index 39e91ad..9ce1f4b 100644
--- a/src/utils/mangaTextEngine.ts
+++ b/src/utils/mangaTextEngine.ts
@@ -57,7 +57,7 @@ export interface TextLayoutResult {
// Characters that should be rotated 90 degrees clockwise in vertical writing mode
const ROTATED_PUNCTUATION = new Set([
- '—', '―', '–', '-', '…', '‥', '~', '~', ':', ';',
+ '—', '―', '–', '-', 'ー', '…', '‥', '~', '~', '〜', ':', ';',
'「', '」', '『', '』', '(', ')', '(', ')', '【', '】',
'[', ']', '[', ']', '{', '}', '{', '}', '〈', '〉',
'《', '》', '<', '>', '<', '>', '〔', '〕', '|', '|',
@@ -69,6 +69,12 @@ const SHIFTED_PUNCTUATION = new Set([
'。', '、', ',', '.', '・',
]);
+// Japanese small kana (拗音・促音) shift subtly toward top-right in traditional vertical lettering
+const SMALL_KANA = new Set([
+ 'ぁ', 'ぃ', 'ぅ', 'ぇ', 'ぉ', 'っ', 'ゃ', 'ゅ', 'ょ', 'ゎ',
+ 'ァ', 'ィ', 'ゥ', 'ェ', 'ォ', 'ッ', 'ャ', 'ュ', 'ョ', 'ヮ', 'ヵ', 'ヶ',
+]);
+
let cachedMeasureCtx: CanvasRenderingContext2D | null | undefined;
let supportsNativeLetterSpacing: boolean | undefined;
@@ -408,6 +414,9 @@ export function computeMangaTextLayout(
} else if (SHIFTED_PUNCTUATION.has(char)) {
dx = fontSize * 0.28;
dy = -fontSize * 0.28;
+ } else if (SMALL_KANA.has(char)) {
+ dx = fontSize * 0.1;
+ dy = -fontSize * 0.08;
}
glyphs.push({
diff --git a/src/utils/nativeTabletInput.ts b/src/utils/nativeTabletInput.ts
index 667aca7..3a2f739 100644
--- a/src/utils/nativeTabletInput.ts
+++ b/src/utils/nativeTabletInput.ts
@@ -133,6 +133,14 @@ export function resetNativeTabletSuppressionState(activeOverride?: boolean): voi
}
}
+/**
+ * Clears active native pen contact state (e.g. on window blur / tab hide) without disabling
+ * the native tablet channel so stale contact cannot block subsequent DOM or pen strokes.
+ */
+export function clearNativePenContact(): void {
+ nativePenInContact = false;
+}
+
/**
* Returns true if native WinTab / Windows Ink packets are currently active and recently received
* (used to suppress redundant DOM `pointerType === 'pen'` PointerEvents).
@@ -144,6 +152,18 @@ export function isNativePenStreamActive(nowMs?: number): boolean {
return lastPacketPerfMs > 0 && now - lastPacketPerfMs < 1500;
}
+/**
+ * Returns true ONLY if the native tablet stream is actively in tip-down contact right now
+ * (recently received an in-contact packet without a subsequent pen-up/hover/leave).
+ * Used to guard against stale native stroke lockout on DOM/mouse pointerdown.
+ */
+export function isNativePenInActiveContact(nowMs?: number): boolean {
+ if (!activeStatus.active || !nativePenInContact || lastPacketPerfMs <= 0) return false;
+ const now =
+ nowMs !== undefined ? nowMs : typeof performance !== 'undefined' ? performance.now() : Date.now();
+ return now - lastPacketPerfMs < 500;
+}
+
/**
* Returns true if a DOM PointerEvent should be suppressed because the native WinTab / Windows Ink
* channel already owns this pen interaction.
diff --git a/src/utils/performanceManager.ts b/src/utils/performanceManager.ts
index d55a39b..bdecd8a 100644
--- a/src/utils/performanceManager.ts
+++ b/src/utils/performanceManager.ts
@@ -23,6 +23,7 @@ import {
ViewportResolutionScale,
} from '../types/settings';
import { isTauriEnvironment } from './tileEngine/scratchDriver';
+import { t, td } from '../i18n';
export interface GpuAdapterInfo {
id: string;
@@ -297,9 +298,13 @@ export function computeRecommendedSettings(
if (onlySoftwareGpu) {
const percent = totalRamMb <= 4096 ? 45 : 55;
const budgetMb = memoryPercentToMb(percent, totalRamMb);
+ const ramStr =
+ Math.round(budgetMb / 102.4) / 10 >= 1
+ ? `${(budgetMb / 1024).toFixed(1)} GB`
+ : `${budgetMb} MB`;
return {
- profileLabel: 'Auto (CPU Safe)',
- summary: `${Math.round(budgetMb / 102.4) / 10 >= 1 ? `${(budgetMb / 1024).toFixed(1)} GB` : `${budgetMb} MB`} RAM · Canvas 2D CPU · 1× Scale`,
+ profileLabel: t('Auto (CPU Safe)'),
+ summary: t('{ram} RAM · Canvas 2D CPU · 1× Scale', { ram: ramStr }),
settings: {
autoOptimizePerformance: true,
memoryAllocationPercent: percent,
@@ -330,7 +335,7 @@ export function computeRecommendedSettings(
let viewportResolutionScale: ViewportResolutionScale = 'capped-2x';
let preview3DMaxResolution: Preview3DMaxResolution = 1920;
let preview3DAntialias = true;
- let profileLabel = 'Auto (Balanced)';
+ let profileLabel = t('Auto (Balanced)');
if (totalRamMb <= 4096) {
percent = 50;
@@ -339,7 +344,7 @@ export function computeRecommendedSettings(
viewportResolutionScale = '1x';
preview3DMaxResolution = 1024;
preview3DAntialias = false;
- profileLabel = 'Auto (Compact RAM)';
+ profileLabel = t('Auto (Compact RAM)');
} else if (totalRamMb <= 8192) {
percent = 55;
undoRamSteps = 12;
@@ -347,7 +352,7 @@ export function computeRecommendedSettings(
viewportResolutionScale = 'capped-2x';
preview3DMaxResolution = 1920;
preview3DAntialias = true;
- profileLabel = 'Auto (Standard)';
+ profileLabel = t('Auto (Standard)');
} else if (totalRamMb >= 24576 && (hasDiscreteGpu || (hw.activeWebGl?.maxArrayLayers ?? 0) >= 1024)) {
percent = 65;
undoRamSteps = 25;
@@ -356,7 +361,7 @@ export function computeRecommendedSettings(
viewportResolutionScale = 'capped-2x';
preview3DMaxResolution = 2560;
preview3DAntialias = true;
- profileLabel = 'Auto (Workstation)';
+ profileLabel = t('Auto (Workstation)');
} else {
// 16 GB class — use 'high' (512 slices) when WebGL2 supports >=512 array layers so
// multi-layer 600 DPI manga canvases don't thrash TEXTURE_2D_ARRAY LRU eviction mid-frame!
@@ -367,7 +372,7 @@ export function computeRecommendedSettings(
viewportResolutionScale = 'capped-2x';
preview3DMaxResolution = 1920;
preview3DAntialias = true;
- profileLabel = hasDiscreteGpu ? 'Auto (High GPU)' : 'Auto (Balanced)';
+ profileLabel = hasDiscreteGpu ? t('Auto (High GPU)') : t('Auto (Balanced)');
}
const budgetMb = memoryPercentToMb(percent, totalRamMb);
@@ -375,12 +380,16 @@ export function computeRecommendedSettings(
budgetMb >= 1024
? `${(budgetMb / 1024).toFixed(budgetMb % 1024 === 0 ? 0 : 1)} GB`
: `${budgetMb} MB`;
- const gpuLabel = hasDiscreteGpu ? 'Dedicated GPU' : 'WebGL2 GPU';
- const poolLabel = GPU_TEXTURE_POOL_CONFIGS[gpuTexturePoolPreset].label;
+ const gpuLabel = hasDiscreteGpu ? t('Dedicated GPU') : t('WebGL2 GPU');
+ const poolLabel = td(GPU_TEXTURE_POOL_CONFIGS[gpuTexturePoolPreset].label);
return {
profileLabel,
- summary: `${ramLabel} RAM · ${gpuLabel} · ${poolLabel} Cache`,
+ summary: t('{ram} RAM · {gpu} · {pool} Cache', {
+ ram: ramLabel,
+ gpu: gpuLabel,
+ pool: poolLabel,
+ }),
settings: {
autoOptimizePerformance: true,
memoryAllocationPercent: percent,
diff --git a/src/utils/reloadGuard.ts b/src/utils/reloadGuard.ts
new file mode 100644
index 0000000..e0f6125
--- /dev/null
+++ b/src/utils/reloadGuard.ts
@@ -0,0 +1,264 @@
+/**
+ * Prevents accidental page reloads and browser history navigation (`Ctrl+R`, `Cmd+R`,
+ * `Ctrl+Shift+R`, `F5`, `BrowserRefresh`, `Alt+Left/Right`, right-click "Reload", and
+ * browser/WebView unload when unsaved artwork exists) without blocking Ink Studio's own
+ * shortcuts (such as `Ctrl+Shift+R` Perspective Ruler or custom shortcut recording).
+ */
+
+export interface ReloadKeyEventLike {
+ key?: string;
+ code?: string;
+ ctrlKey?: boolean;
+ metaKey?: boolean;
+ shiftKey?: boolean;
+ altKey?: boolean;
+ repeat?: boolean;
+}
+
+export interface DirtyDocumentLike {
+ isDirty?: boolean;
+}
+
+export interface InstallReloadGuardOptions {
+ /** Target EventTarget (defaults to `window`). */
+ target?: Window;
+ /** Returns current open documents to check for unsaved changes. */
+ getDocuments: () => ReadonlyArray<DirtyDocumentLike>;
+ /** Returns true while app close is intentionally finalizing (never prompt/block shutdown). */
+ isFinalizingClose: () => boolean;
+ /** Optional check for an active in-progress stroke before history marks the document dirty. */
+ isDrawingActive?: () => boolean;
+ /**
+ * Optional predicate returning true if the reload/nav keystroke should trigger a user-visible
+ * notification (e.g. skip when bound to an Ink Studio command like `Ctrl+Shift+R` or while
+ * recording a shortcut in Settings).
+ */
+ shouldNotifyBlockedKey?: (e: KeyboardEvent) => boolean;
+ /** Optional callback invoked when an unbound reload shortcut is blocked. */
+ onBlockedReloadShortcut?: () => void;
+}
+
+const NON_TEXT_INPUT_TYPES = new Set([
+ 'button',
+ 'checkbox',
+ 'color',
+ 'file',
+ 'hidden',
+ 'image',
+ 'radio',
+ 'range',
+ 'reset',
+ 'submit',
+]);
+
+let intentionalReloadAllowed = false;
+
+/**
+ * Marks an explicit, user-confirmed programmatic reload (e.g. ErrorBoundary "Reload Editor")
+ * so `beforeunload` does not block crash recovery.
+ */
+export function markIntentionalReload(): void {
+ intentionalReloadAllowed = true;
+}
+
+/** Test-only reset for `intentionalReloadAllowed`. */
+export function _resetReloadGuardForTests(): void {
+ intentionalReloadAllowed = false;
+}
+
+function detectIsMacPlatform(): boolean {
+ if (typeof navigator === 'undefined') return false;
+ const plat =
+ (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ||
+ navigator.platform ||
+ navigator.userAgent ||
+ '';
+ return /mac|iphone|ipad|ipod/i.test(plat);
+}
+
+/**
+ * Returns true if the keyboard event triggers a browser/WebView reload or history navigation
+ * (`Ctrl/Cmd+R`, `Ctrl/Cmd+Shift+R`, `F5`, `Ctrl/Shift/Alt+F5`, `BrowserRefresh`,
+ * `BrowserBack`, `BrowserForward`, and `Alt+ArrowLeft`/`Alt+ArrowRight` on Windows/Linux),
+ * matching both physical `code` (layout-independent for Cyrillic/IME/etc.) and logical `key`.
+ */
+export function isBrowserReloadOrNavShortcut(
+ e: ReloadKeyEventLike,
+ isMac: boolean = detectIsMacPlatform()
+): boolean {
+ const code = e.code || '';
+ const key = e.key || '';
+ const keyLower = key.toLowerCase();
+
+ // F5 / Ctrl+F5 / Shift+F5 / Cmd+F5 / Alt+F5
+ if (code === 'F5' || key === 'F5') {
+ return true;
+ }
+
+ // Dedicated multimedia keyboard refresh / back / forward keys
+ if (
+ code === 'BrowserRefresh' ||
+ key === 'BrowserRefresh' ||
+ code === 'BrowserBack' ||
+ key === 'BrowserBack' ||
+ code === 'BrowserForward' ||
+ key === 'BrowserForward'
+ ) {
+ return true;
+ }
+
+ // Ctrl+R / Cmd+R / Ctrl+Shift+R / Cmd+Shift+R (layout-independent via KeyR + key fallback)
+ if ((e.ctrlKey || e.metaKey) && !e.altKey) {
+ if (code === 'KeyR' || keyLower === 'r') {
+ return true;
+ }
+ }
+
+ // Alt+Left / Alt+Right browser history navigation on Windows/Linux (on macOS Option+Arrow is word jump)
+ if (!isMac && e.altKey && !e.ctrlKey && !e.metaKey) {
+ if (
+ code === 'ArrowLeft' ||
+ code === 'ArrowRight' ||
+ key === 'ArrowLeft' ||
+ key === 'ArrowRight'
+ ) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Returns true if the browser/WebView default context menu (which exposes "Reload", "Back",
+ * "Forward") should be blocked for this event target. Editable text inputs, textareas,
+ * contentEditable regions, and active text selections retain their native Copy/Paste menu.
+ */
+export function shouldBlockDefaultContextMenu(
+ target: EventTarget | null,
+ selectionText?: string
+): boolean {
+ const selected =
+ selectionText !== undefined
+ ? selectionText
+ : typeof window !== 'undefined'
+ ? window.getSelection?.()?.toString() ?? ''
+ : '';
+ if (selected.length > 0) {
+ return false;
+ }
+
+ if (!target || typeof target !== 'object') {
+ return true;
+ }
+
+ const el = target as {
+ tagName?: string;
+ type?: string;
+ isContentEditable?: boolean;
+ closest?: (selector: string) => {
+ tagName?: string;
+ type?: string;
+ isContentEditable?: boolean;
+ } | null;
+ };
+
+ const editable =
+ typeof el.closest === 'function'
+ ? el.closest('input, textarea, [contenteditable="true"], [contenteditable=""]')
+ : el;
+
+ if (!editable) {
+ return true;
+ }
+
+ if (editable.isContentEditable) {
+ return false;
+ }
+
+ const tag = (editable.tagName || '').toUpperCase();
+ if (tag === 'TEXTAREA') {
+ return false;
+ }
+ if (tag === 'INPUT') {
+ const inputType = (editable.type || 'text').toLowerCase();
+ return NON_TEXT_INPUT_TYPES.has(inputType);
+ }
+
+ return true;
+}
+
+/**
+ * Returns true when `beforeunload` should ask confirmation / prevent unload.
+ */
+export function shouldConfirmBeforeUnload(
+ documents: ReadonlyArray<DirtyDocumentLike>,
+ finalizingClose: boolean,
+ isDrawingActive = false
+): boolean {
+ if (finalizingClose || intentionalReloadAllowed) {
+ return false;
+ }
+ if (isDrawingActive) {
+ return true;
+ }
+ return documents.some((d) => Boolean(d.isDirty));
+}
+
+/**
+ * Installs capture-phase reload-key prevention, default context-menu suppression outside
+ * text inputs, and `beforeunload` protection (active in BOTH Tauri desktop and Web).
+ */
+export function installReloadGuard(options: InstallReloadGuardOptions): () => void {
+ const win = options.target ?? (typeof window !== 'undefined' ? window : undefined);
+ if (!win) return () => {};
+
+ let lastNotifyMs = 0;
+
+ const handleKeyDownCapture = (e: KeyboardEvent) => {
+ if (!isBrowserReloadOrNavShortcut(e)) return;
+
+ // Prevent browser/WebView reload & history navigation while deliberately NOT stopping
+ // propagation so Ink Studio commands (e.g. Ctrl+Shift+R Perspective Ruler) and Settings
+ // shortcut recording still receive the event normally.
+ e.preventDefault();
+
+ if (
+ !e.repeat &&
+ options.onBlockedReloadShortcut &&
+ (options.shouldNotifyBlockedKey ? options.shouldNotifyBlockedKey(e) : true)
+ ) {
+ const now = Date.now();
+ if (now - lastNotifyMs >= 1500) {
+ lastNotifyMs = now;
+ options.onBlockedReloadShortcut();
+ }
+ }
+ };
+
+ const handleContextMenu = (e: MouseEvent) => {
+ if (e.defaultPrevented) return;
+ if (shouldBlockDefaultContextMenu(e.target)) {
+ e.preventDefault();
+ }
+ };
+
+ const handleBeforeUnload = (e: BeforeUnloadEvent) => {
+ const docs = options.getDocuments();
+ const drawingActive = options.isDrawingActive ? options.isDrawingActive() : false;
+ if (shouldConfirmBeforeUnload(docs, options.isFinalizingClose(), drawingActive)) {
+ e.preventDefault();
+ e.returnValue = '';
+ }
+ };
+
+ win.addEventListener('keydown', handleKeyDownCapture, true);
+ win.addEventListener('contextmenu', handleContextMenu, false);
+ win.addEventListener('beforeunload', handleBeforeUnload);
+
+ return () => {
+ win.removeEventListener('keydown', handleKeyDownCapture, true);
+ win.removeEventListener('contextmenu', handleContextMenu, false);
+ win.removeEventListener('beforeunload', handleBeforeUnload);
+ };
+}
diff --git a/src/utils/saveManager/fileActions.ts b/src/utils/saveManager/fileActions.ts
index 62176ea..67b024e 100644
--- a/src/utils/saveManager/fileActions.ts
+++ b/src/utils/saveManager/fileActions.ts
@@ -27,6 +27,7 @@ import {
normalizeSavedFileName,
sanitizeDocumentStem,
} from './fileNameUtils';
+import { t } from '../../i18n';
interface NativePickSavePathResponse {
canceled: boolean;
@@ -121,7 +122,7 @@ export async function exportImage(
current: 1,
total: 1,
percent: 92,
- message: `Encoding ${format.toUpperCase()}...`,
+ message: t('Encoding {format}...', { format: format.toUpperCase() }),
});
const blob = await canvasToBlob(canvas, mimeType, quality);
onProgress?.({
@@ -129,7 +130,7 @@ export async function exportImage(
current: 1,
total: 1,
percent: 100,
- message: 'Export complete',
+ message: t('Export complete'),
});
return {
blob,
@@ -214,7 +215,7 @@ export async function serializeDocument(
// 2. Native Ink Studio Project (.ink) — Binary v2 container (.sora is read-only)
if (ext === '.sora') {
- throw new Error('Legacy .sora format is read-only. Save as .ink instead.');
+ throw new Error(t('Legacy .sora format is read-only. Save as .ink instead.'));
}
if (ext === PRIMARY_PROJECT_EXTENSION) {
const result = await serializeInkProject(data, tileGrid);
@@ -306,9 +307,9 @@ export async function promptSaveAs(
const picked = await invoke<NativePickSavePathResponse>('native_pick_save_path', {
suggestedName: cleanStem,
- filters: PROJECT_SAVE_FILTERS,
+ filters: PROJECT_SAVE_FILTERS.map((f) => ({ ...f, name: t(f.name) })),
defaultFilterIndex,
- title: 'Save As',
+ title: t('Save As'),
initialDir: initialDir ?? null,
});
@@ -359,27 +360,27 @@ export async function promptSaveAs(
const allPickerTypes = [
{
ext: '.ink',
- description: 'Ink Studio Project (*.ink)',
+ description: t('Ink Studio Project (*.ink)'),
accept: { 'application/octet-stream': ['.ink'] },
},
{
ext: '.psd',
- description: 'Photoshop Document with Layers (*.psd)',
+ description: t('Photoshop Document with Layers (*.psd)'),
accept: { 'image/vnd.adobe.photoshop': ['.psd'] },
},
{
ext: '.png',
- description: 'PNG Image (*.png)',
+ description: t('PNG Image (*.png)'),
accept: { 'image/png': ['.png'] },
},
{
ext: '.jpg',
- description: 'JPEG Image (*.jpg, *.jpeg)',
+ description: t('JPEG Image (*.jpg, *.jpeg)'),
accept: { 'image/jpeg': ['.jpg', '.jpeg'] },
},
{
ext: '.webp',
- description: 'WebP Image (*.webp)',
+ description: t('WebP Image (*.webp)'),
accept: { 'image/webp': ['.webp'] },
},
];
@@ -451,7 +452,7 @@ export async function promptSaveAs(
};
}
- throw new Error('Save dialog was not available');
+ throw new Error(t('Save dialog was not available'));
}
/**
@@ -469,7 +470,7 @@ export async function saveToExistingHandle(
);
if (!hasWebHandle && !hasNativePath) {
- throw new Error('No valid file handle or disk path to save to');
+ throw new Error(t('No valid file handle or disk path to save to'));
}
const cleanStem = sanitizeDocumentStem(fileInfo.name || data.name, 'Untitled');
@@ -503,7 +504,7 @@ export async function saveToExistingHandle(
perm = await fileInfo.handle.requestPermission({ mode: 'readwrite' });
}
if (perm !== 'granted') {
- throw new Error('Write permission denied for file handle');
+ throw new Error(t('Write permission denied for file handle'));
}
}
@@ -540,9 +541,9 @@ export async function promptExportPngImage(
const initialDir = options?.initialDir || getRememberedSaveDir('project') || undefined;
const picked = await invoke<NativePickSavePathResponse>('native_pick_save_path', {
suggestedName: cleanStem,
- filters: IMAGE_EXPORT_FILTERS,
+ filters: IMAGE_EXPORT_FILTERS.map((f) => ({ ...f, name: t(f.name) })),
defaultFilterIndex: 0,
- title: 'Export Image As',
+ title: t('Export Image As'),
initialDir: initialDir ?? null,
});
if (picked?.canceled) {
@@ -583,15 +584,15 @@ export async function promptExportPngImage(
const types = [
{
- description: 'PNG Image (*.png)',
+ description: t('PNG Image (*.png)'),
accept: { 'image/png': ['.png'] },
},
{
- description: 'JPEG Image (*.jpg, *.jpeg)',
+ description: t('JPEG Image (*.jpg, *.jpeg)'),
accept: { 'image/jpeg': ['.jpg', '.jpeg'] },
},
{
- description: 'WebP Image (*.webp)',
+ description: t('WebP Image (*.webp)'),
accept: { 'image/webp': ['.webp'] },
},
];
diff --git a/src/utils/saveManager/inkParse.ts b/src/utils/saveManager/inkParse.ts
index bb8f6e4..e2acab6 100644
--- a/src/utils/saveManager/inkParse.ts
+++ b/src/utils/saveManager/inkParse.ts
@@ -30,6 +30,7 @@ import {
decodeMaskBinary,
decodeNativeTileRecord,
} from './inkCodec';
+import { t } from '../../i18n';
/**
* Extracts `preview.png` from raw ZIP container bytes without inflating tile entries.
@@ -70,7 +71,7 @@ export async function parseInkZipBytes(
current: 0,
total: 1,
percent: 5,
- message: `Unpacking ${label} container...`,
+ message: t('Unpacking {label} container...', { label }),
});
const files = unzipSync(zipBytes);
@@ -78,16 +79,16 @@ export async function parseInkZipBytes(
const fileNames = Object.keys(files);
for (const name of fileNames) {
if (!isSafeZipPath(name)) {
- throw new Error(`Unsafe archive path in ${label} file: "${name}"`);
+ throw new Error(t('Unsafe archive path in {label} file: "{name}"', { label, name }));
}
}
const manifestRaw = files['manifest.json'];
if (!manifestRaw || manifestRaw.byteLength === 0) {
- throw new Error(`Invalid ${label} project: missing manifest.json`);
+ throw new Error(t('Invalid {label} project: missing manifest.json', { label }));
}
if (manifestRaw.byteLength > MAX_MANIFEST_BYTES) {
- throw new Error(`Invalid ${label} project: manifest.json exceeds size limit`);
+ throw new Error(t('Invalid {label} project: manifest.json exceeds size limit', { label }));
}
const manifestText = new TextDecoder('utf-8').decode(manifestRaw);
@@ -97,13 +98,13 @@ export async function parseInkZipBytes(
typeof parsedManifest !== 'object' ||
!Array.isArray(parsedManifest.layers)
) {
- throw new Error(`Invalid ${label} manifest: missing layers array`);
+ throw new Error(t('Invalid {label} manifest: missing layers array', { label }));
}
const width = Math.floor(Number(parsedManifest.dimensions?.width) || 0);
const height = Math.floor(Number(parsedManifest.dimensions?.height) || 0);
if (width <= 0 || height <= 0 || width > MAX_DOCUMENT_DIM || height > MAX_DOCUMENT_DIM) {
- throw new Error(`Invalid ${label} dimensions: ${width}x${height}`);
+ throw new Error(t('Invalid {label} dimensions: {width}x{height}', { label, width, height }));
}
const dpi = Number(parsedManifest.dimensions?.dpi) || 300;
const colorMode: CanvasColorMode = parsedManifest.colorMode || 'color';
@@ -147,7 +148,7 @@ export async function parseInkZipBytes(
const tx = parseInt(tileMatch[2], 10);
const ty = parseInt(tileMatch[3], 10);
if (!Number.isSafeInteger(tx) || !Number.isSafeInteger(ty)) {
- throw new Error(`Invalid tile coordinates in ${label} archive: ${path}`);
+ throw new Error(t('Invalid tile coordinates in {label} archive: {path}', { label, path }));
}
tileEntries.push({ path, layerId, tx, ty });
continue;
@@ -164,7 +165,12 @@ export async function parseInkZipBytes(
}
if (tileEntries.length > MAX_TILE_ENTRIES) {
- throw new Error(`Invalid ${label} project: tile count ${tileEntries.length} exceeds limit`);
+ throw new Error(
+ t('Invalid {label} project: tile count {count} exceeds limit', {
+ label,
+ count: tileEntries.length,
+ })
+ );
}
const restoredTiles: TileBuffer[] = [];
@@ -184,7 +190,7 @@ export async function parseInkZipBytes(
current: done,
total: tileEntries.length,
percent: 15 + Math.round((done / tileEntries.length) * 70),
- message: `Loading tiles (${done}/${tileEntries.length})...`,
+ message: t('Loading tiles ({done}/{total})...', { done, total: tileEntries.length }),
});
await yieldToMainThread();
}
@@ -240,7 +246,10 @@ export async function parseInkZipBytes(
if (rawTimelapse && Array.isArray(rawTimelapse.frames)) {
if (rawTimelapse.frames.length > MAX_TIMELAPSE_FRAMES) {
throw new Error(
- `Invalid ${label} project: time-lapse frame count ${rawTimelapse.frames.length} exceeds limit`
+ t('Invalid {label} project: time-lapse frame count {count} exceeds limit', {
+ label,
+ count: rawTimelapse.frames.length,
+ })
);
}
const totalFrames = rawTimelapse.frames.length;
@@ -253,13 +262,21 @@ export async function parseInkZipBytes(
!isSafeZipPath(framePath) ||
!framePath.startsWith('timelapse/')
) {
- throw new Error(`Unsafe time-lapse frame path in ${label} archive: "${String(framePath)}"`);
+ throw new Error(
+ t('Unsafe time-lapse frame path in {label} archive: "{path}"', {
+ label,
+ path: String(framePath),
+ })
+ );
}
const rawPayload = files[framePath];
if (!rawPayload || rawPayload.byteLength === 0) continue;
if (rawPayload.byteLength > MAX_TIMELAPSE_FRAME_BYTES) {
throw new Error(
- `Invalid ${label} project: time-lapse frame "${framePath}" exceeds 8 MB size limit`
+ t('Invalid {label} project: time-lapse frame "{path}" exceeds 8 MB size limit', {
+ label,
+ path: framePath,
+ })
);
}
@@ -316,7 +333,7 @@ export async function parseInkZipBytes(
current: done,
total: totalFrames,
percent: 85 + Math.round((done / totalFrames) * 14),
- message: `Loading time-lapse frames (${done}/${totalFrames})...`,
+ message: t('Loading time-lapse frames ({done}/{total})...', { done, total: totalFrames }),
});
await yieldToMainThread();
}
@@ -334,7 +351,10 @@ export async function parseInkZipBytes(
}
if (orphanFrames.length > MAX_TIMELAPSE_FRAMES) {
throw new Error(
- `Invalid ${label} project: time-lapse frame count ${orphanFrames.length} exceeds limit`
+ t('Invalid {label} project: time-lapse frame count {count} exceeds limit', {
+ label,
+ count: orphanFrames.length,
+ })
);
}
orphanFrames.sort((a, b) => a.index - b.index || a.path.localeCompare(b.path));
@@ -343,7 +363,10 @@ export async function parseInkZipBytes(
if (!rawPayload || rawPayload.byteLength === 0) continue;
if (rawPayload.byteLength > MAX_TIMELAPSE_FRAME_BYTES) {
throw new Error(
- `Invalid ${label} project: time-lapse frame "${item.path}" exceeds 8 MB size limit`
+ t('Invalid {label} project: time-lapse frame "{path}" exceeds 8 MB size limit', {
+ label,
+ path: item.path,
+ })
);
}
const mimeType: 'image/webp' | 'image/jpeg' =
@@ -473,7 +496,7 @@ export async function parseInkZipBytes(
current: 1,
total: 1,
percent: 100,
- message: 'Project loaded',
+ message: t('Project loaded'),
});
return {
@@ -505,7 +528,7 @@ export async function parseInkProject(
): Promise<ParsedInkProject> {
const rawBytes = input instanceof Uint8Array ? input : new Uint8Array(input);
if (!isInkProjectBytes(rawBytes)) {
- throw new Error('Invalid .ink project: expected binary ZIP container');
+ throw new Error(t('Invalid .ink project: expected binary ZIP container'));
}
return parseInkZipBytes(rawBytes, { ...options, containerLabel: '.ink' });
}
diff --git a/src/utils/saveManager/inkSerialize.ts b/src/utils/saveManager/inkSerialize.ts
index d2eca2a..d789b01 100644
--- a/src/utils/saveManager/inkSerialize.ts
+++ b/src/utils/saveManager/inkSerialize.ts
@@ -25,7 +25,7 @@ import {
toSafeZipKey,
yieldToMainThread,
} from './types';
-import { inferLayerTileFormat } from './exportGridPrep';
+import { hydratePagedTilesForLayers, inferLayerTileFormat } from './exportGridPrep';
import {
encodeMaskBinary,
encodeNativeTileRecordInto,
@@ -33,6 +33,7 @@ import {
} from './inkCodec';
import { sanitizeDocumentStem } from './fileNameUtils';
import { TILE_BINARY_HEADER_BYTES } from './types';
+import { t } from '../../i18n';
/**
* Serializes a document into the native binary `.ink` ZIP container:
@@ -65,7 +66,7 @@ export async function serializeInkProject(
current: 0,
total: 1,
percent: 2,
- message: 'Preparing project metadata...',
+ message: t('Preparing project metadata...'),
});
const usedKeys = new Set<string>();
@@ -147,8 +148,9 @@ export async function serializeInkProject(
current: 0,
total: 1,
percent: 8,
- message: 'Generating preview thumbnail...',
+ message: t('Generating preview thumbnail...'),
});
+ await hydratePagedTilesForLayers(resolvedGrid, data.layers, true);
const preview = await generatePreviewPng(data, resolvedGrid);
// Time-lapse keyframes are persisted in external local storage rather than embedded inside .ink
@@ -236,7 +238,7 @@ export async function serializeInkProject(
current: done,
total: totalTiles,
percent: Math.min(tilesEndPct, pct),
- message: `Saving tiles (${done}/${totalTiles})...`,
+ message: t('Saving tiles ({done}/{total})...', { done, total: totalTiles }),
});
if (done < totalTiles) {
await yieldToMainThread();
@@ -259,7 +261,7 @@ export async function serializeInkProject(
total: totalMasks,
percent:
tilesEndPct + Math.round((done / Math.max(1, totalMasks)) * (masksEndPct - tilesEndPct)),
- message: `Saving layer masks (${done}/${totalMasks})...`,
+ message: t('Saving layer masks ({done}/{total})...', { done, total: totalMasks }),
});
if (done % CHUNK_YIELD_INTERVAL === 0 && done < totalMasks) {
await yieldToMainThread();
@@ -340,7 +342,7 @@ export async function serializeInkProject(
current: done,
total: framesLimit,
percent: Math.min(95, pct),
- message: `Saving time-lapse frames (${done}/${framesLimit})...`,
+ message: t('Saving time-lapse frames ({done}/{total})...', { done, total: framesLimit }),
});
if (done < framesLimit) {
await yieldToMainThread();
@@ -470,7 +472,7 @@ export async function serializeInkProject(
current: 1,
total: 1,
percent: 96,
- message: 'Finalizing .ink archive...',
+ message: t('Finalizing .ink archive...'),
});
zip.end();
@@ -485,7 +487,7 @@ export async function serializeInkProject(
current: 1,
total: 1,
percent: 100,
- message: 'Saved successfully',
+ message: t('Saved successfully'),
});
return { bytes, previewBytes, previewDataUrl, manifest };
diff --git a/src/utils/selectionUtils.ts b/src/utils/selectionUtils.ts
index ea87054..a01fff6 100644
--- a/src/utils/selectionUtils.ts
+++ b/src/utils/selectionUtils.ts
@@ -2294,3 +2294,69 @@ export function clearOutsideSelectionInTileGrid(params: {
return { dirtyRect, tileDeltas };
}
+
+/**
+ * Deep-clones a CanvasSelection for lossless Undo/Redo storage (omitting ephemeral floating pixels).
+ */
+export function cloneSelectionForHistory(
+ selection: CanvasSelection | null | undefined
+): CanvasSelection | null {
+ if (!selection) return null;
+ return {
+ type: selection.type,
+ bounds: {
+ x: selection.bounds.x,
+ y: selection.bounds.y,
+ width: selection.bounds.width,
+ height: selection.bounds.height,
+ },
+ ...(selection.polygon
+ ? { polygon: selection.polygon.map((pt) => ({ x: pt.x, y: pt.y })) }
+ : {}),
+ ...(selection.mask ? { mask: new Uint8Array(selection.mask) } : {}),
+ ...(selection.maskWidth !== undefined ? { maskWidth: selection.maskWidth } : {}),
+ ...(selection.maskHeight !== undefined ? { maskHeight: selection.maskHeight } : {}),
+ ...(selection.svgPath !== undefined ? { svgPath: selection.svgPath } : {}),
+ floating: null,
+ };
+}
+
+/**
+ * Checks whether two CanvasSelection states represent the same selection geometry/mask.
+ */
+export function areSelectionsEqualForHistory(
+ a: CanvasSelection | null | undefined,
+ b: CanvasSelection | null | undefined
+): boolean {
+ if (!a && !b) return true;
+ if (!a || !b) return false;
+ if (
+ a.type !== b.type ||
+ a.bounds.x !== b.bounds.x ||
+ a.bounds.y !== b.bounds.y ||
+ a.bounds.width !== b.bounds.width ||
+ a.bounds.height !== b.bounds.height ||
+ a.maskWidth !== b.maskWidth ||
+ a.maskHeight !== b.maskHeight ||
+ a.svgPath !== b.svgPath
+ ) {
+ return false;
+ }
+ if (Boolean(a.polygon) !== Boolean(b.polygon)) return false;
+ if (a.polygon && b.polygon) {
+ if (a.polygon.length !== b.polygon.length) return false;
+ for (let i = 0; i < a.polygon.length; i++) {
+ if (a.polygon[i].x !== b.polygon[i].x || a.polygon[i].y !== b.polygon[i].y) {
+ return false;
+ }
+ }
+ }
+ if (Boolean(a.mask) !== Boolean(b.mask)) return false;
+ if (a.mask && b.mask) {
+ if (a.mask.length !== b.mask.length) return false;
+ for (let i = 0; i < a.mask.length; i++) {
+ if (a.mask[i] !== b.mask[i]) return false;
+ }
+ }
+ return true;
+}
diff --git a/src/utils/shortcutManager.ts b/src/utils/shortcutManager.ts
index 6c1bab5..2a3c45c 100644
--- a/src/utils/shortcutManager.ts
+++ b/src/utils/shortcutManager.ts
@@ -9,6 +9,7 @@ import {
} from '../types/settings';
import { ALL_BUILTIN_BRUSHES, ALL_BUILTIN_BRUSH_SECTIONS } from './presetBrushes';
import { CustomSubToolGroup, buildBrushToCustomGroupMap } from './subToolGroups';
+import { t, td } from '../i18n';
export const SPRING_LOADED_HOLD_MS = 250;
@@ -924,7 +925,7 @@ export function formatShortcutLabel(
platform: ShortcutPlatform = detectShortcutPlatform()
): string {
const parsed = parseShortcut(raw);
- if (!parsed) return 'Unassigned';
+ if (!parsed) return t('Unassigned');
const parts: string[] = [];
if (parsed.ctrl) parts.push('Ctrl');
if (parsed.meta) parts.push(getOsModifierDisplayName(platform));
@@ -1234,8 +1235,17 @@ export function buildSubToolShortcutCommands(
const count = group.brushIds.length;
result.push({
id: getSubToolGroupCommandId(group.id),
- label: `Group: ${group.name}`,
- description: `Open custom sub tool group "${group.name}" (${count} ${count === 1 ? 'sub tool' : 'sub tools'})`,
+ label: t('Group: {name}', { name: group.name }),
+ description:
+ count === 1
+ ? t('Open custom sub tool group "{name}" ({count} sub tool)', {
+ name: group.name,
+ count,
+ })
+ : t('Open custom sub tool group "{name}" ({count} sub tools)', {
+ name: group.name,
+ count,
+ }),
category: 'Sub Tools',
defaultShortcut: '',
subToolGroupId: group.id,
@@ -1250,7 +1260,10 @@ export function buildSubToolShortcutCommands(
result.push({
id: getSubToolCommandId(brush.id),
label: brush.name,
- description: `Directly open custom sub tool "${brush.name}" (hold > 250ms for temporary switch)`,
+ description: t(
+ 'Directly open custom sub tool "{name}" (hold > 250ms for temporary switch)',
+ { name: brush.name }
+ ),
category: 'Sub Tools',
defaultShortcut: '',
subToolPresetId: brush.id,
@@ -1267,7 +1280,10 @@ export function buildSubToolShortcutCommands(
result.push({
id: getSubToolCommandId(builtin.id),
label: builtin.name,
- description: `Directly open ${builtin.name} sub tool (hold > 250ms for temporary switch)`,
+ description: t(
+ 'Directly open {name} sub tool (hold > 250ms for temporary switch)',
+ { name: td(builtin.name) }
+ ),
category: 'Sub Tools',
defaultShortcut: '',
subToolPresetId: builtin.id,
diff --git a/src/utils/textSettings.ts b/src/utils/textSettings.ts
index f4f5ece..e5ef2b8 100644
--- a/src/utils/textSettings.ts
+++ b/src/utils/textSettings.ts
@@ -70,6 +70,26 @@ export const TEXT_FONT_PRESETS: ReadonlyArray<TextFontOption> = [
label: 'Monospace',
category: 'Mono',
},
+ {
+ value: "'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', 'Noto Sans JP', sans-serif",
+ label: 'Japanese Gothic (游ゴシック)',
+ category: 'Sans',
+ },
+ {
+ value: "'Hiragino Mincho ProN', 'Yu Mincho', 'BIZ UDPMincho', 'Noto Serif JP', serif",
+ label: 'Japanese Mincho (游明朝)',
+ category: 'Serif',
+ },
+ {
+ value: "'BIZ UDPGothic', 'Meiryo', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif",
+ label: 'Japanese UI Sans (BIZ UDゴシック)',
+ category: 'Sans',
+ },
+ {
+ value: "'Yu Mincho', 'Hiragino Mincho ProN', 'Yu Gothic', 'Meiryo', serif",
+ label: 'Japanese Manga (明朝・縦書き)',
+ category: 'Manga',
+ },
];
export const TEXT_QUICK_COLORS: ReadonlyArray<{ hex: string; label: string }> = [
diff --git a/src/utils/themeEngine.ts b/src/utils/themeEngine.ts
index aaba57e..6636609 100644
--- a/src/utils/themeEngine.ts
+++ b/src/utils/themeEngine.ts
@@ -35,6 +35,7 @@ import {
normalizeHex6,
sanitizeAppearanceConfig,
} from '../types/appearance';
+import { t } from '../i18n';
export interface RgbColor {
r: number;
@@ -461,16 +462,16 @@ const DENSITY_SCALES: Record<
const FONT_STACKS: Record<FontProfile, { sans: string; mono: string }> = {
system: {
- sans: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
- mono: '"JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, ui-monospace, monospace',
+ sans: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "BIZ UDPGothic", "Meiryo", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif',
+ mono: '"JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "BIZ UDGothic", "Yu Gothic", "Meiryo", ui-monospace, monospace',
},
humanist: {
- sans: '"Plus Jakarta Sans", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif',
- mono: '"IBM Plex Mono", "SF Mono", Consolas, ui-monospace, monospace',
+ sans: '"Plus Jakarta Sans", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", Roboto, sans-serif',
+ mono: '"IBM Plex Mono", "SF Mono", Consolas, "BIZ UDGothic", "Yu Gothic", "Meiryo", ui-monospace, monospace',
},
technical: {
- sans: '"IBM Plex Sans", "DIN Alternate", "Bahnschrift", "Segoe UI", -apple-system, sans-serif',
- mono: '"JetBrains Mono", "IBM Plex Mono", "Fira Code", Consolas, ui-monospace, monospace',
+ sans: '"IBM Plex Sans", "DIN Alternate", "Bahnschrift", "Segoe UI", -apple-system, "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif',
+ mono: '"JetBrains Mono", "IBM Plex Mono", "Fira Code", Consolas, "BIZ UDGothic", "Yu Gothic", "Meiryo", ui-monospace, monospace',
},
};
@@ -1108,22 +1109,22 @@ export function serializeThemePreset(
*/
export function parseThemePreset(rawJson: string): ParseThemePresetResult {
if (typeof rawJson !== 'string' || rawJson.trim().length === 0) {
- return { ok: false, error: 'Theme preset input is empty.' };
+ return { ok: false, error: t('Theme preset input is empty.') };
}
if (rawJson.length > MAX_THEME_FILE_BYTES) {
- return { ok: false, error: 'Theme preset file exceeds maximum allowed size (64 KB).' };
+ return { ok: false, error: t('Theme preset file exceeds maximum allowed size (64 KB).') };
}
let parsed: unknown;
try {
parsed = JSON.parse(rawJson);
} catch {
- return { ok: false, error: 'Theme preset is not valid JSON.' };
+ return { ok: false, error: t('Theme preset is not valid JSON.') };
}
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
- return { ok: false, error: 'Theme preset root must be a JSON object.' };
+ return { ok: false, error: t('Theme preset root must be a JSON object.') };
}
const root = parsed as Record<string, unknown>;
@@ -1131,23 +1132,31 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
if (root.format !== INK_THEME_FORMAT_ID) {
return {
ok: false,
- error: `Invalid theme format identifier. Expected "${INK_THEME_FORMAT_ID}".`,
+ error: t('Invalid theme format identifier. Expected "{expected}".', {
+ expected: INK_THEME_FORMAT_ID,
+ }),
};
}
if (root.version !== INK_THEME_SCHEMA_VERSION) {
return {
ok: false,
- error: `Unsupported theme schema version: ${String(root.version)}. Expected version ${INK_THEME_SCHEMA_VERSION}.`,
+ error: t('Unsupported theme schema version: {version}. Expected version {expected}.', {
+ version: String(root.version),
+ expected: INK_THEME_SCHEMA_VERSION,
+ }),
};
}
if (typeof root.name !== 'string' || root.name.trim().length === 0) {
- return { ok: false, error: 'Theme preset must include a non-empty "name" string.' };
+ return { ok: false, error: t('Theme preset must include a non-empty "name" string.') };
}
if (!root.appearance || typeof root.appearance !== 'object' || Array.isArray(root.appearance)) {
- return { ok: false, error: 'Theme preset must include an "appearance" configuration object.' };
+ return {
+ ok: false,
+ error: t('Theme preset must include an "appearance" configuration object.'),
+ };
}
const app = root.appearance as Record<string, unknown>;
@@ -1159,7 +1168,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.lookPreset !== 'string' ||
!VALID_LOOK_PRESETS.has(app.lookPreset as AppearanceConfig['lookPreset']))
) {
- return { ok: false, error: `Invalid lookPreset "${String(app.lookPreset)}".` };
+ return {
+ ok: false,
+ error: t('Invalid lookPreset "{value}".', { value: String(app.lookPreset) }),
+ };
}
if (
@@ -1167,7 +1179,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.baseLookPreset !== 'string' ||
!VALID_BUILT_IN_LOOK_PRESETS.has(app.baseLookPreset as BuiltInLookPresetId))
) {
- return { ok: false, error: `Invalid baseLookPreset "${String(app.baseLookPreset)}".` };
+ return {
+ ok: false,
+ error: t('Invalid baseLookPreset "{value}".', { value: String(app.baseLookPreset) }),
+ };
}
const numericChecks: Array<{
@@ -1186,10 +1201,12 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
const val = app[field];
if (val !== undefined) {
if (typeof val !== 'number' || !Number.isFinite(val)) {
- return { ok: false, error: `Field "${field}" must be a finite number.` };
+ return { ok: false, error: t('Field "{field}" must be a finite number.', { field }) };
}
if (val < min || val > max) {
- warnings.push(`Clamped "${field}" from ${val} into [${min}, ${max}].`);
+ warnings.push(
+ t('Clamped "{field}" from {val} into [{min}, {max}].', { field, val, min, max })
+ );
}
}
}
@@ -1199,7 +1216,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.canvasMatteMode !== 'string' ||
!VALID_CANVAS_MATTE_MODES.has(app.canvasMatteMode as AppearanceConfig['canvasMatteMode']))
) {
- return { ok: false, error: `Invalid canvasMatteMode "${String(app.canvasMatteMode)}".` };
+ return {
+ ok: false,
+ error: t('Invalid canvasMatteMode "{value}".', { value: String(app.canvasMatteMode) }),
+ };
}
if (
@@ -1207,7 +1227,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.canvasMatteCustomHex !== 'string' ||
!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(app.canvasMatteCustomHex.trim()))
) {
- return { ok: false, error: 'Field "canvasMatteCustomHex" must be a valid hex color.' };
+ return {
+ ok: false,
+ error: t('Field "canvasMatteCustomHex" must be a valid hex color.'),
+ };
}
if (
@@ -1215,7 +1238,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.accent !== 'string' ||
!VALID_ACCENT_PIGMENTS.has(app.accent as AppearanceConfig['accent']))
) {
- return { ok: false, error: `Invalid accent pigment "${String(app.accent)}".` };
+ return {
+ ok: false,
+ error: t('Invalid accent pigment "{value}".', { value: String(app.accent) }),
+ };
}
if (
@@ -1223,7 +1249,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.customAccentHex !== 'string' ||
!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(app.customAccentHex.trim()))
) {
- return { ok: false, error: 'Field "customAccentHex" must be a valid hex color.' };
+ return {
+ ok: false,
+ error: t('Field "customAccentHex" must be a valid hex color.'),
+ };
}
if (
@@ -1231,28 +1260,40 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.cornerRadius !== 'string' ||
!VALID_CORNER_RADIUS_PRESETS.has(app.cornerRadius as CornerRadiusPreset))
) {
- return { ok: false, error: `Invalid cornerRadius "${String(app.cornerRadius)}".` };
+ return {
+ ok: false,
+ error: t('Invalid cornerRadius "{value}".', { value: String(app.cornerRadius) }),
+ };
}
if (
app.chromeStyle !== undefined &&
(typeof app.chromeStyle !== 'string' || !VALID_CHROME_STYLES.has(app.chromeStyle as ChromeStyle))
) {
- return { ok: false, error: `Invalid chromeStyle "${String(app.chromeStyle)}".` };
+ return {
+ ok: false,
+ error: t('Invalid chromeStyle "{value}".', { value: String(app.chromeStyle) }),
+ };
}
if (
app.density !== undefined &&
(typeof app.density !== 'string' || !VALID_DENSITY_PRESETS.has(app.density as DensityPreset))
) {
- return { ok: false, error: `Invalid density "${String(app.density)}".` };
+ return {
+ ok: false,
+ error: t('Invalid density "{value}".', { value: String(app.density) }),
+ };
}
if (
app.fontProfile !== undefined &&
(typeof app.fontProfile !== 'string' || !VALID_FONT_PROFILES.has(app.fontProfile as FontProfile))
) {
- return { ok: false, error: `Invalid fontProfile "${String(app.fontProfile)}".` };
+ return {
+ ok: false,
+ error: t('Invalid fontProfile "{value}".', { value: String(app.fontProfile) }),
+ };
}
if (
@@ -1260,7 +1301,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.iconStrokeWidth !== 'number' ||
!VALID_ICON_STROKE_WIDTHS.has(app.iconStrokeWidth as AppearanceConfig['iconStrokeWidth']))
) {
- return { ok: false, error: `Invalid iconStrokeWidth "${String(app.iconStrokeWidth)}".` };
+ return {
+ ok: false,
+ error: t('Invalid iconStrokeWidth "{value}".', { value: String(app.iconStrokeWidth) }),
+ };
}
if (
@@ -1268,7 +1312,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.sliderStyle !== 'string' ||
!VALID_SLIDER_STYLES.has(app.sliderStyle as AppearanceConfig['sliderStyle']))
) {
- return { ok: false, error: `Invalid sliderStyle "${String(app.sliderStyle)}".` };
+ return {
+ ok: false,
+ error: t('Invalid sliderStyle "{value}".', { value: String(app.sliderStyle) }),
+ };
}
if (
@@ -1276,7 +1323,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.brushListStyle !== 'string' ||
!VALID_BRUSH_LIST_STYLES.has(app.brushListStyle as AppearanceConfig['brushListStyle']))
) {
- return { ok: false, error: `Invalid brushListStyle "${String(app.brushListStyle)}".` };
+ return {
+ ok: false,
+ error: t('Invalid brushListStyle "{value}".', { value: String(app.brushListStyle) }),
+ };
}
if (
@@ -1284,7 +1334,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.layerThumbSize !== 'string' ||
!VALID_LAYER_THUMB_SIZES.has(app.layerThumbSize as AppearanceConfig['layerThumbSize']))
) {
- return { ok: false, error: `Invalid layerThumbSize "${String(app.layerThumbSize)}".` };
+ return {
+ ok: false,
+ error: t('Invalid layerThumbSize "{value}".', { value: String(app.layerThumbSize) }),
+ };
}
if (
@@ -1292,7 +1345,10 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
(typeof app.scrollbarSize !== 'string' ||
!VALID_SCROLLBAR_SIZES.has(app.scrollbarSize as AppearanceConfig['scrollbarSize']))
) {
- return { ok: false, error: `Invalid scrollbarSize "${String(app.scrollbarSize)}".` };
+ return {
+ ok: false,
+ error: t('Invalid scrollbarSize "{value}".', { value: String(app.scrollbarSize) }),
+ };
}
if (app.tokenOverrides !== undefined) {
@@ -1301,14 +1357,23 @@ export function parseThemePreset(rawJson: string): ParseThemePresetResult {
typeof app.tokenOverrides !== 'object' ||
Array.isArray(app.tokenOverrides)
) {
- return { ok: false, error: 'Field "tokenOverrides" must be a plain key-value object.' };
+ return {
+ ok: false,
+ error: t('Field "tokenOverrides" must be a plain key-value object.'),
+ };
}
for (const [key, val] of Object.entries(app.tokenOverrides as Record<string, unknown>)) {
if (!VALID_OVERRIDABLE_TOKEN_KEYS.has(key as OverridableTokenKey)) {
- return { ok: false, error: `Unknown or non-overridable token key "${key}".` };
+ return {
+ ok: false,
+ error: t('Unknown or non-overridable token key "{key}".', { key }),
+ };
}
if (!isValidOverrideColorValue(val)) {
- return { ok: false, error: `Invalid or unsafe color value for token "${key}".` };
+ return {
+ ok: false,
+ error: t('Invalid or unsafe color value for token "{key}".', { key }),
+ };
}
}
}
@@ -1439,7 +1504,7 @@ export function encodeThemeShareCode(
*/
export function decodeThemeShareCode(rawInput: string): ParseThemePresetResult {
if (typeof rawInput !== 'string') {
- return { ok: false, error: 'Theme code input must be a string.' };
+ return { ok: false, error: t('Theme code input must be a string.') };
}
// Strip surrounding whitespace and optional Discord markdown backticks / code fences
@@ -1451,18 +1516,18 @@ export function decodeThemeShareCode(rawInput: string): ParseThemePresetResult {
}
if (cleaned.length === 0) {
- return { ok: false, error: 'Theme code is empty.' };
+ return { ok: false, error: t('Theme code is empty.') };
}
if (cleaned.length > MAX_THEME_FILE_BYTES) {
- return { ok: false, error: 'Theme code exceeds maximum allowed size (64 KB).' };
+ return { ok: false, error: t('Theme code exceeds maximum allowed size (64 KB).') };
}
if (cleaned.toUpperCase().startsWith(INK_THEME_CODE_PREFIX)) {
const encoded = cleaned.slice(INK_THEME_CODE_PREFIX.length).trim();
const decodedJson = base64UrlToUtf8(encoded);
if (!decodedJson) {
- return { ok: false, error: 'Theme code is corrupted or not valid base64.' };
+ return { ok: false, error: t('Theme code is corrupted or not valid base64.') };
}
return parseThemePreset(decodedJson);
}
@@ -1473,7 +1538,9 @@ export function decodeThemeShareCode(rawInput: string): ParseThemePresetResult {
return {
ok: false,
- error: `Unrecognized theme code. Expected "${INK_THEME_CODE_PREFIX}..." or .inktheme JSON.`,
+ error: t('Unrecognized theme code. Expected "{prefix}..." or .inktheme JSON.', {
+ prefix: INK_THEME_CODE_PREFIX,
+ }),
};
}
diff --git a/src/utils/tileEngine.ts b/src/utils/tileEngine.ts
index 876857c..b00050e 100644
--- a/src/utils/tileEngine.ts
+++ b/src/utils/tileEngine.ts
@@ -453,6 +453,10 @@ export class SparseTileGrid {
return tileSnapshotOps.computeDeltasFromSnapshot(this.host, beforeSnapshot, layerId, bounds);
}
+ public computeFullLayerDeltasFromSnapshot(beforeSnapshot: Map<string, TileSnapshotEntry>, layerId: string): TileDelta[] {
+ return tileSnapshotOps.computeFullLayerDeltasFromSnapshot(this.host, beforeSnapshot, layerId);
+ }
+
public applyTileDeltas(deltas: TileDelta[], direction: 'undo' | 'redo'): void {
tileSnapshotOps.applyTileDeltas(this.host, deltas, direction);
}
diff --git a/src/utils/tileEngine/tileOps.ts b/src/utils/tileEngine/tileOps.ts
index 18a95ba..95931b9 100644
--- a/src/utils/tileEngine/tileOps.ts
+++ b/src/utils/tileEngine/tileOps.ts
@@ -752,14 +752,22 @@ export function resizeLayerInGrid(
for (const [k, entry] of oldTileMap.entries()) {
const [otxStr, otyStr] = k.split(':');
- const ntx = parseInt(otxStr, 10) + dTx;
- const nty = parseInt(otyStr, 10) + dTy;
+ const otx = parseInt(otxStr, 10);
+ const oty = parseInt(otyStr, 10);
+ const ntx = otx + dTx;
+ const nty = oty + dTy;
if (ntx < 0 || nty < 0 || ntx > maxNewTx || nty > maxNewTy) continue;
const docX = ntx * TILE_SIZE;
const docY = nty * TILE_SIZE;
- const validW = Math.min(TILE_SIZE, newW - docX);
- const validH = Math.min(TILE_SIZE, newH - docY);
+ // Clamp to BOTH oldDims and newDims so stray brush overhang pixels beyond the old canvas
+ // edge never leak into newly expanded margins.
+ const oldValidW = Math.max(0, Math.min(TILE_SIZE, oldDims.width - otx * TILE_SIZE));
+ const oldValidH = Math.max(0, Math.min(TILE_SIZE, oldDims.height - oty * TILE_SIZE));
+ const validW = Math.min(TILE_SIZE, newW - docX, oldValidW);
+ const validH = Math.min(TILE_SIZE, newH - docY, oldValidH);
+ if (validW <= 0 || validH <= 0) continue;
+
if (validW === TILE_SIZE && validH === TILE_SIZE && entry.format === targetFormat) {
const newTile: TileBuffer = {
layerId,
@@ -776,7 +784,7 @@ export function resizeLayerInGrid(
host.setTile(layerId, ntx, nty, newTile);
} else {
const scratch = new Uint8ClampedArray(BYTES_32BIT);
- const rgba = readOldRgba(parseInt(otxStr, 10), parseInt(otyStr, 10), scratch);
+ const rgba = readOldRgba(otx, oty, scratch);
if (rgba) {
const cropped = new Uint8ClampedArray(validW * validH * 4);
for (let y = 0; y < validH; y++) {
@@ -1016,12 +1024,19 @@ export function resizeLayerInGrid(
const w01 = (1 - fx) * fy;
const w11 = fx * fy;
- const a = Math.round(p00[3] * w00 + p10[3] * w10 + p01[3] * w01 + p11[3] * w11);
+ const wa00 = p00[3] * w00;
+ const wa10 = p10[3] * w10;
+ const wa01 = p01[3] * w01;
+ const wa11 = p11[3] * w11;
+ const aSum = wa00 + wa10 + wa01 + wa11;
+ const a = Math.round(aSum);
const off = (ly * TILE_SIZE + lx) << 2;
- if (a > 0) {
- const r = Math.round(p00[0] * w00 + p10[0] * w10 + p01[0] * w01 + p11[0] * w11);
- const g = Math.round(p00[1] * w00 + p10[1] * w10 + p01[1] * w01 + p11[1] * w11);
- const b = Math.round(p00[2] * w00 + p10[2] * w10 + p01[2] * w01 + p11[2] * w11);
+ if (a > 0 && aSum > 1e-6) {
+ // Premultiplied-alpha bilinear filtering prevents dark halos along semi-transparent edges
+ const invA = 1 / aSum;
+ const r = Math.min(255, Math.round((p00[0] * wa00 + p10[0] * wa10 + p01[0] * wa01 + p11[0] * wa11) * invA));
+ const g = Math.min(255, Math.round((p00[1] * wa00 + p10[1] * wa10 + p01[1] * wa01 + p11[1] * wa11) * invA));
+ const b = Math.min(255, Math.round((p00[2] * wa00 + p10[2] * wa10 + p01[2] * wa01 + p11[2] * wa11) * invA));
if (bgRgb && a < 255) {
const af = a / 255;
const inv = 1 - af;
diff --git a/src/utils/tileEngine/tileSnapshots.ts b/src/utils/tileEngine/tileSnapshots.ts
index 26c88d4..e5b072a 100644
--- a/src/utils/tileEngine/tileSnapshots.ts
+++ b/src/utils/tileEngine/tileSnapshots.ts
@@ -293,6 +293,80 @@ export function computeDeltasFromSnapshot(
return deltas;
}
+/**
+ * Computes complete tile deltas across the UNION of `beforeSnapshot` keys and every live LOD 0
+ * tile currently present in `layerId` (needed for canvas resize/crop/expand where tiles can move
+ * to brand-new coordinates outside the original snapshot's key set).
+ */
+export function computeFullLayerDeltasFromSnapshot(
+ host: ISparseTileGridHost,
+ beforeSnapshot: Map<string, TileSnapshotEntry>,
+ layerId: string
+): TileDelta[] {
+ const keysToCheck = new Set<string>(beforeSnapshot.keys());
+ for (const tile of host.getLayerTiles(layerId, 0)) {
+ keysToCheck.add(getTileKey(layerId, tile.tileX, tile.tileY, 0));
+ }
+
+ const deltas: TileDelta[] = [];
+ for (const key of keysToCheck) {
+ const before = beforeSnapshot.get(key);
+ const { tileX, tileY } = parseTileKey(key);
+ const currentTile = host.getTile(layerId, tileX, tileY, 0);
+
+ const beforeData = before ? before.data : null;
+ const currentData = currentTile && currentTile.data ? currentTile.data : null;
+ const format = currentTile
+ ? currentTile.format
+ : before
+ ? before.format
+ : host.getLayerFormat(layerId);
+
+ if (beforeData === null && currentData === null) continue;
+
+ let changed = false;
+ if ((beforeData === null) !== (currentData === null)) {
+ changed = true;
+ } else if (beforeData && currentData) {
+ if (beforeData.byteLength !== currentData.byteLength) {
+ changed = true;
+ } else if (
+ beforeData.byteLength % 4 === 0 &&
+ beforeData.byteOffset % 4 === 0 &&
+ currentData.byteOffset % 4 === 0
+ ) {
+ const len32 = beforeData.byteLength >>> 2;
+ const b32 = new Uint32Array(beforeData.buffer, beforeData.byteOffset, len32);
+ const c32 = new Uint32Array(currentData.buffer, currentData.byteOffset, len32);
+ for (let i = 0; i < len32; i++) {
+ if (b32[i] !== c32[i]) {
+ changed = true;
+ break;
+ }
+ }
+ } else {
+ for (let i = 0; i < beforeData.byteLength; i++) {
+ if (beforeData[i] !== currentData[i]) {
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (changed) {
+ deltas.push({
+ key,
+ format,
+ beforeData,
+ afterData: currentData ? new Uint8Array(currentData) : null,
+ remoteEpoch: host.getTileRemoteEpoch(key),
+ });
+ }
+ }
+ return deltas;
+}
+
export function applyTileDeltas(
host: ISparseTileGridHost,
deltas: TileDelta[],
@@ -321,6 +395,7 @@ export function applyTileDeltas(
tile.solidColorU32 = undefined;
tile.format = delta.format;
host.setLayerFormat(layerId, delta.format);
+ host.ingestedLayers.add(layerId);
tile.dirty = true;
tile.version = allocateTileVersion();
host.markLodAncestorsDirty(layerId, tileX, tileY);
diff --git a/src/utils/webtoonExporter.ts b/src/utils/webtoonExporter.ts
index b7e0315..992c3a6 100644
--- a/src/utils/webtoonExporter.ts
+++ b/src/utils/webtoonExporter.ts
@@ -11,6 +11,7 @@
import { zipSync } from 'fflate';
import { releaseTemporaryCanvas } from './tileEngine';
import { saveFileWithDialog, SaveFileDialogResult } from './fileSaveDialog';
+import { t } from '../i18n';
export interface WebtoonSliceOptions {
sliceWidth?: number;
@@ -43,7 +44,7 @@ async function canvasSliceToBytes(
canvas.toBlob(
async (blob) => {
if (!blob) {
- reject(new Error('Failed to create slice blob'));
+ reject(new Error(t('Failed to create slice blob')));
return;
}
const buffer = await blob.arrayBuffer();
@@ -194,10 +195,10 @@ export async function saveWebtoonZipWithDialog(
data: zipBytes,
suggestedName: filename,
mimeType: 'application/zip',
- description: 'Webtoon Slices Archive',
+ description: t('Webtoon Slices Archive'),
extensions: ['.zip'],
category: 'webtoon',
- title: 'Save Webtoon Slices As',
+ title: t('Save Webtoon Slices As'),
});
}
diff --git a/src/utils/workspacePresets.ts b/src/utils/workspacePresets.ts
index b4885e2..8f4ee23 100644
--- a/src/utils/workspacePresets.ts
+++ b/src/utils/workspacePresets.ts
@@ -1,4 +1,5 @@
import { safeLocalStorageSetItem } from './safeStorage';
+import { t } from '../i18n';
import { migrateLegacyPresetId } from './brushPresetManager';
import { clampNavigatorSplitRatio, DEFAULT_NAVIGATOR_SPLIT_RATIO } from './valueCheck';
import { BrushPresetId } from '../types/editor';
@@ -2603,50 +2604,55 @@ export function serializeWorkspaceBundle(input: SerializeWorkspaceBundleInput):
*/
export function parseWorkspaceBundle(rawJson: string): ParseWorkspaceBundleResult {
if (typeof rawJson !== 'string' || rawJson.trim().length === 0) {
- return { ok: false, error: 'Workspace file is empty.' };
+ return { ok: false, error: t('Workspace file is empty.') };
}
if (rawJson.length > MAX_WORKSPACE_BUNDLE_BYTES) {
- return { ok: false, error: 'Workspace file exceeds maximum allowed size (256 KB).' };
+ return { ok: false, error: t('Workspace file exceeds maximum allowed size (256 KB).') };
}
let parsed: unknown;
try {
parsed = JSON.parse(rawJson);
} catch {
- return { ok: false, error: 'Workspace file is not valid JSON.' };
+ return { ok: false, error: t('Workspace file is not valid JSON.') };
}
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
- return { ok: false, error: 'Workspace file root must be a JSON object.' };
+ return { ok: false, error: t('Workspace file root must be a JSON object.') };
}
const root = parsed as Record<string, unknown>;
if (root.format !== INK_WORKSPACE_FORMAT_ID) {
return {
ok: false,
- error: `Invalid workspace format identifier. Expected "${INK_WORKSPACE_FORMAT_ID}".`,
+ error: t('Invalid workspace format identifier. Expected "{expected}".', {
+ expected: INK_WORKSPACE_FORMAT_ID,
+ }),
};
}
if (root.version !== INK_WORKSPACE_SCHEMA_VERSION) {
return {
ok: false,
- error: `Unsupported workspace schema version: ${String(root.version)}. Expected version ${INK_WORKSPACE_SCHEMA_VERSION}.`,
+ error: t('Unsupported workspace schema version: {version}. Expected version {expected}.', {
+ version: String(root.version),
+ expected: INK_WORKSPACE_SCHEMA_VERSION,
+ }),
};
}
if (typeof root.name !== 'string' || root.name.trim().length === 0) {
- return { ok: false, error: 'Workspace file must include a non-empty "name" string.' };
+ return { ok: false, error: t('Workspace file must include a non-empty "name" string.') };
}
const layout = sanitizeLayout(root.layout);
if (!layout) {
- return { ok: false, error: 'Workspace file contains no valid dock or floating panels.' };
+ return { ok: false, error: t('Workspace file contains no valid dock or floating panels.') };
}
const warnings: string[] = [];
let appearance: AppearanceConfig | undefined;
if (root.appearance !== undefined) {
if (!root.appearance || typeof root.appearance !== 'object' || Array.isArray(root.appearance)) {
- return { ok: false, error: 'Bundled "appearance" field must be an object.' };
+ return { ok: false, error: t('Bundled "appearance" field must be an object.') };
}
const themeCheck = parseThemePreset(
JSON.stringify({
@@ -2657,7 +2663,10 @@ export function parseWorkspaceBundle(rawJson: string): ParseWorkspaceBundleResul
})
);
if (!themeCheck.ok) {
- return { ok: false, error: `Invalid bundled appearance: ${themeCheck.error}` };
+ return {
+ ok: false,
+ error: t('Invalid bundled appearance: {error}', { error: themeCheck.error }),
+ };
}
appearance = themeCheck.preset.appearance;
warnings.push(...themeCheck.warnings);