diff --git a/src/component/Canvas/CanvasEditor/commands/CutSelectionToNewLayerCommand.js b/src/component/Canvas/CanvasEditor/commands/CutSelectionToNewLayerCommand.js
index ad5addc5..62de515a 100644
--- a/src/component/Canvas/CanvasEditor/commands/CutSelectionToNewLayerCommand.js
+++ b/src/component/Canvas/CanvasEditor/commands/CutSelectionToNewLayerCommand.js
@@ -10,6 +10,8 @@ import { fabric } from "fabric-with-all";
import { generateId } from "../utils/helper.js";
import { ClearSelectionCommand } from "./LassoCutoutCommand.js";
import { ClearSelectionContentCommand } from "./ClearSelectionContentCommand.js";
+import i18n from "@/lang/index.ts";
+const { t } = i18n.global;
/**
* 剪切选区到新图层命令
@@ -36,7 +38,7 @@ export class CutSelectionToNewLayerCommand extends CompositeCommand {
this.baseResolutionScale = options.baseResolutionScale || 2; // 基础分辨率倍数
this.groupId = options.groupId || generateId("lasso-copy-group-");
- this.groupName = options.groupName || `选区组`;
+ this.groupName = options.groupName || t(`Canvas.ConstituencyGroup`);
this.groupLayer = null; // 新增:保存组图层的引用
this.originalLayersLength = 0; // 新增:保存原始图层数量
@@ -179,7 +181,7 @@ export class CutSelectionToNewLayerCommand extends CompositeCommand {
// 创建新的组图层
this.groupLayer = createLayer({
id: this.groupId,
- name: this.groupName || `选区组`,
+ name: this.groupName || t(`Canvas.ConstituencyGroup`),
type: LayerType.GROUP,
visible: true,
locked: false,
diff --git a/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.bak.js b/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.bak.js
index 8897a6bd..5c4a50b2 100644
--- a/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.bak.js
+++ b/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.bak.js
@@ -11,6 +11,10 @@ import {
} from "./LayerCommands.js";
import { fabric } from "fabric-with-all";
import { generateId } from "../utils/helper.js";
+import i18n from "@/lang/index.ts";
+const { t } = i18n.global;
+
+
/**
* 套索抠图命令
@@ -37,7 +41,7 @@ export class LassoCutoutCommand extends CompositeCommand {
this.baseResolutionScale = options.baseResolutionScale || 2; // 基础分辨率倍数
this.groupId = options.groupId || generateId("lasso-group-");
- this.groupName = options.groupName || `选区组`;
+ this.groupName = options.groupName || t(`Canvas.ConstituencyGroup`);
this.clippingMaskId = generateId("clipping-mask-");
@@ -238,7 +242,7 @@ export class LassoCutoutCommand extends CompositeCommand {
// 创建新的组图层
this.groupLayer = createLayer({
id: this.groupId,
- name: this.groupName || `选区组`,
+ name: this.groupName || t(`Canvas.ConstituencyGroup`),
type: LayerType.GROUP,
visible: true,
locked: false,
diff --git a/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.js b/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.js
index 06a3ade1..b0d765c1 100644
--- a/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.js
+++ b/src/component/Canvas/CanvasEditor/commands/LassoCutoutCommand.js
@@ -13,6 +13,9 @@ import {
import { fabric } from "fabric-with-all";
import { generateId } from "../utils/helper.js";
import { ToolCommand } from "./ToolCommands.js";
+import i18n from "@/lang/index.ts";
+const { t } = i18n.global;
+
/**
* 套索抠图命令
@@ -39,7 +42,7 @@ export class LassoCutoutCommand extends CompositeCommand {
this.baseResolutionScale = options.baseResolutionScale || 2; // 基础分辨率倍数
this.groupId = options.groupId || generateId("lasso-group-");
- this.groupName = options.groupName || `选区组`;
+ this.groupName = options.groupName || t(`Canvas.ConstituencyGroup`);
this.clippingMaskId = generateId("clipping-mask-");
@@ -229,7 +232,7 @@ export class LassoCutoutCommand extends CompositeCommand {
// 创建新的组图层
this.groupLayer = createLayer({
id: this.groupId,
- name: this.groupName || `选区组`,
+ name: this.groupName || t(`Canvas.ConstituencyGroup`),
type: LayerType.GROUP,
visible: true,
locked: false,
@@ -244,7 +247,7 @@ export class LassoCutoutCommand extends CompositeCommand {
// });
const selectLayer = createLayer({
- name: `选区空图层`,
+ name: t(`Canvas.ConstituencyEmptyLayer`),
type: LayerType.EMPTY,
visible: true,
locked: false,
diff --git a/src/component/Canvas/CanvasEditor/commands/TextCommands.js b/src/component/Canvas/CanvasEditor/commands/TextCommands.js
index f4d52013..24c47c62 100644
--- a/src/component/Canvas/CanvasEditor/commands/TextCommands.js
+++ b/src/component/Canvas/CanvasEditor/commands/TextCommands.js
@@ -1,6 +1,8 @@
import { generateId, optimizeCanvasRendering } from "../utils/helper";
import { createLayer, LayerType, OperationType } from "../utils/layerHelper";
import { Command } from "./Command";
+import i18n from "@/lang/index.ts";
+const { t } = i18n.global;
/**
* 文本内容命令
@@ -329,7 +331,7 @@ export class CreateTextCommand extends Command {
// 默认文本属性
this.defaultOptions = {
- text: "双击编辑文本",
+ text: t('Canvas.DoubleClickText'),
fontFamily: "Arial",
fontSize: 24,
fontWeight: "normal",
diff --git a/src/component/Canvas/CanvasEditor/components/BrushPanel.vue b/src/component/Canvas/CanvasEditor/components/BrushPanel.vue
index f78e5935..b625358b 100644
--- a/src/component/Canvas/CanvasEditor/components/BrushPanel.vue
+++ b/src/component/Canvas/CanvasEditor/components/BrushPanel.vue
@@ -190,7 +190,7 @@
- {{ $t("上传的纹理") }}
+ {{ $t("Canvas.UploadedTexture") }}
@@ -201,7 +201,7 @@
+
-
{{ $t("上传纹理") }}
+
{{ $t("Canvas.UploadTexture") }}
×
@@ -535,6 +535,9 @@ import {
TextureUploadCommand,
} from "../commands/BrushCommands";
import { debounce } from "lodash-es";
+import { useI18n } from "vue-i18n";
+const { t } = useI18n();
+
// 从工具管理器获取可用笔刷类型
const toolManager = inject("toolManager");
@@ -873,7 +876,7 @@ function applyPresetWithCommand(presetIndex) {
// 保存当前设置为预设
function saveCurrentAsPreset() {
// 简单实现,可以后续优化为弹窗输入名称
- const name = prompt("请输入预设名称:", `预设 ${BrushStore.state.presets.length + 1}`);
+ const name = prompt(t('Canvas.presetNamePrompt'), `${t('Canvas.preset')} ${BrushStore.state.presets.length + 1}`);
if (name) {
const presetIndex = BrushStore.saveCurrentAsPreset(name);
// 应用新创建的预设(可选)
diff --git a/src/component/Canvas/CanvasEditor/components/KeyboardShortcutHelp.vue b/src/component/Canvas/CanvasEditor/components/KeyboardShortcutHelp.vue
index edba6ecc..e1d19484 100644
--- a/src/component/Canvas/CanvasEditor/components/KeyboardShortcutHelp.vue
+++ b/src/component/Canvas/CanvasEditor/components/KeyboardShortcutHelp.vue
@@ -136,7 +136,7 @@ function convertShortcuts(managerShortcuts) {
action: actionDisplay,
windows: shortcut.key.replace(/cmdOrCtrl\+/g, "Ctrl+"),
mac: shortcut.key.replace(/cmdOrCtrl\+/g, "⌘+"),
- touch: shortcut.touch || "触控界面点击对应工具",
+ touch: shortcut.touch || t('Canvas.touchTools'),
displayKey: shortcut.displayKey,
});
}
@@ -326,8 +326,8 @@ function getShortcutsByCategory(category) {
iPad
iOS
Android
- 其他
- (触控设备)
+ {{ $t('Canvas.other') }}
+ ({{ $t('Canvas.touchDevice') }})
@@ -421,14 +421,14 @@ function getShortcutsByCategory(category) {
-->
-
触控设备提示
+
{{ $t('Canvas.touchDevicePrompts') }}
- - 长按图层面板可访问更多选项
- - 双击元素可快速进入编辑模式
- - 双指拖动可平移画布
- - 双指捏合可缩放画布
- - 双指连按可显示元素变换控制点
- - 三指左右滑动可进行撤销/重做操作
+ - {{ $t('Canvas.touchDevicePrompts_1') }}
+ - {{ $t('Canvas.touchDevicePrompts_2') }}
+ - {{ $t('Canvas.touchDevicePrompts_3') }}
+ - {{ $t('Canvas.touchDevicePrompts_4') }}
+ - {{ $t('Canvas.touchDevicePrompts_5') }}
+ - {{ $t('Canvas.touchDevicePrompts_6') }}
diff --git a/src/component/Canvas/CanvasEditor/components/LiquifyPanel.vue b/src/component/Canvas/CanvasEditor/components/LiquifyPanel.vue
index c8946485..be4facb3 100644
--- a/src/component/Canvas/CanvasEditor/components/LiquifyPanel.vue
+++ b/src/component/Canvas/CanvasEditor/components/LiquifyPanel.vue
@@ -444,16 +444,16 @@ function showPanel(event) {
if (detail.layerStatus && detail.layerStatus.message) {
console.log("液化操作提示:", detail.layerStatus.message);
Modal.error({
- title: "错误提示",
+ title: t('Canvas.ErrorMessage'),
content: detail.layerStatus.message,
- okText: "确定",
+ okText: t('Canvas.confirm'),
centered: true,
});
} else {
Modal.error({
- title: "错误提示",
- content: "未选择有效图像或图层不适合液化操作",
- okText: "确定",
+ title: t('Canvas.ErrorMessage'),
+ content: t('Canvas.LiquidationError'),
+ okText: t('Canvas.confirm'),
centered: true,
});
console.log("未选择有效图像或图层不适合液化操作");
diff --git a/src/component/Canvas/CanvasEditor/index.vue b/src/component/Canvas/CanvasEditor/index.vue
index 4fab1a07..503e83dd 100644
--- a/src/component/Canvas/CanvasEditor/index.vue
+++ b/src/component/Canvas/CanvasEditor/index.vue
@@ -580,7 +580,7 @@ async function addLayer() {
await layerManager.createLayer(t("Canvas.EmptyLayer"));
}
async function addTopLayer() {
- await layerManager.createLayer("空图层", LayerType.EMPTY, {
+ await layerManager.createLayer(t("Canvas.EmptyLayer"), LayerType.EMPTY, {
insertTop: true,
});
}
diff --git a/src/component/Canvas/CanvasEditor/managers/brushes/types/TextureBrush.js b/src/component/Canvas/CanvasEditor/managers/brushes/types/TextureBrush.js
index ccdcece5..71ce6f17 100644
--- a/src/component/Canvas/CanvasEditor/managers/brushes/types/TextureBrush.js
+++ b/src/component/Canvas/CanvasEditor/managers/brushes/types/TextureBrush.js
@@ -1,6 +1,8 @@
import { BaseBrush } from "../BaseBrush";
import { fabric } from "fabric-with-all";
import texturePresetManager from "../TexturePresetManager";
+import i18n from "@/lang/index.ts";
+const {t} = i18n.global;
/**
* 纹理笔刷
@@ -468,12 +470,12 @@ export class TextureBrush extends BaseBrush {
const textureProperties = [
{
id: "textureSelector",
- name: "材质选择",
+ name: t('Canvas.TextureSelector'),
type: "texture-grid",
defaultValue: this.selectedTextureId,
options: textureOptions,
- description: "选择要使用的纹理",
- category: "纹理设置",
+ description: t('Canvas.selectTexture'),
+ category: t('Canvas.TextureSettings'),
order: 100,
hidden: allTextures.length === 0,
},
diff --git a/src/component/Canvas/CanvasEditor/managers/liquify/EnhancedLiquifyManager.js b/src/component/Canvas/CanvasEditor/managers/liquify/EnhancedLiquifyManager.js
index 13a6015e..db5070c0 100644
--- a/src/component/Canvas/CanvasEditor/managers/liquify/EnhancedLiquifyManager.js
+++ b/src/component/Canvas/CanvasEditor/managers/liquify/EnhancedLiquifyManager.js
@@ -5,6 +5,8 @@
import { LiquifyWebGLManager } from "./LiquifyWebGLManager";
import { LiquifyCPUManager } from "./LiquifyCPUManager";
import { findLayerRecursively, LayerType } from "../../utils/layerHelper";
+import i18n from "@/lang/index.ts";
+const {t} = i18n.global;
export class EnhancedLiquifyManager {
/**
@@ -599,7 +601,7 @@ export class EnhancedLiquifyManager {
if (objectsToCheck.length === 0) {
return {
valid: false,
- message: "图层为空,无法进行液化操作",
+ message: t('Canvas.layerEmptyNoLiquidation'),
needsRasterization: false,
isImage: false,
isEmpty: true,
diff --git a/src/lang/cn.ts b/src/lang/cn.ts
index f44973b6..16463cb9 100644
--- a/src/lang/cn.ts
+++ b/src/lang/cn.ts
@@ -1056,6 +1056,8 @@ export default {
showHiddenLayer: "显示/隐藏图层",
preview: "预览",
EmptyLayer: "空图层",
+ ConstituencyGroup: "选区组",
+ ConstituencyEmptyLayer: "选区空图层",
Scale: "缩放",
ResetLayer: "重置视图",
Help: "查看快捷键和触控操作",
@@ -1063,6 +1065,16 @@ export default {
height: "高度",
color: "颜色",
KeyboardShortcutsOperationGuide: "键盘快捷键 & 操作指南",
+ other: "其他",
+ touchDevice: "触控设备",
+ touchTools: "触控界面点击对应工具",
+ touchDevicePrompts: "触控设备提示",
+ touchDevicePrompts_1: "长按图层面板可访问更多选项。",
+ touchDevicePrompts_2: "双击元素可快速进入编辑模式。",
+ touchDevicePrompts_3: "双指拖动可平移画布。",
+ touchDevicePrompts_4: "双指捏合可缩放画布。",
+ touchDevicePrompts_5: "双指连按可显示元素变换控制点。",
+ touchDevicePrompts_6: "三指左右滑动可进行撤销/重做操作。",
TheDetectedPlatform: "检测到的平台",
BasicOperations: "基础操作",
Operation: "操作",
@@ -1306,6 +1318,18 @@ export default {
liquefactionEnvironmentLoading:'正在准备液化环境,请稍候...',
LiqueficationFailed:'液化工具启动失败',
DoubleClickText:'双击编辑文本',
+ LiquidationcuoError:'未选择有效图像或图层不适合液化操作',
+ ErrorMessage: '错误提示',
+ preset: '预设',
+ presetNamePrompt: '请输入预设名称:',
+ UploadedTexture: '上传的纹理',
+ UploadTexture: '上传纹理',
+ selectTexture:'选择要使用的纹理',
+ DeleteTexture:'删除纹理',
+ TextureSettings: '纹理设置',
+ TextureSelector: '纹理选择',
+
+
},
speedList:{
High:'高级',
diff --git a/src/lang/en.ts b/src/lang/en.ts
index 8a045deb..720d4f63 100644
--- a/src/lang/en.ts
+++ b/src/lang/en.ts
@@ -1056,6 +1056,8 @@ export default {
showHiddenLayer: "Show/Hidden Layer",
preview: "Preview",
EmptyLayer: "Empty layer",
+ ConstituencyGroup: "Constituency group",
+ ConstituencyEmptyLayer: "Constituency Empty Layer",
Scale: "Scale",
ResetLayer: "Reset Layer",
Help: "View the shortcut keys and touch operations",
@@ -1063,6 +1065,16 @@ export default {
height: "Height",
color: "Color",
KeyboardShortcutsOperationGuide: "Keyboard shortcuts & Operation guide",
+ other: "Other",
+ touchDevice: "Touch Device",
+ touchTools: "Touch interface corresponding tools",
+ touchDevicePrompts: "Touch device prompts",
+ touchDevicePrompts_1: "Long-press the Layers panel to access more options.",
+ touchDevicePrompts_2: "Double-click an element to quickly enter edit mode.",
+ touchDevicePrompts_3: "Two-finger drag to pan the canvas.",
+ touchDevicePrompts_4: "Pinch to zoom.",
+ touchDevicePrompts_5: "Two-finger tap to display the element's transform handles.",
+ touchDevicePrompts_6: "Three-finger swipe left or right to undo/redo.",
TheDetectedPlatform: "Guide Detected Platform",
BasicOperations: "Basic Operations",
Operation: "Operation",
@@ -1306,6 +1318,18 @@ export default {
liquefactionEnvironmentLoading:'The liquefaction environment is being prepared. Please wait a moment...',
LiqueficationFailed:'Liquefication tool failed to start.',
DoubleClickText:'Double-click to edit the text',
+ LiquidationError:'No valid image selected or the layer does not fit the liquefaction operation.',
+ ErrorMessage: 'Error Message',
+ preset: 'Preset',
+ presetNamePrompt: 'Please enter the preset name:',
+ UploadedTexture: 'Uploaded Texture',
+ UploadTexture: 'Upload Texture',
+ selectTexture: 'Select the texture you want to use',
+ DeleteTexture:'Delete Texture',
+ TextureSettings: 'Texture Settings',
+ TextureSelector: 'Texture Selector',
+
+
},
speedList:{
High:'High',