画布语言适配问题修复

This commit is contained in:
X1627315083
2025-07-20 20:27:13 +08:00
parent 666cbc8470
commit 9911161ec9

View File

@@ -46,17 +46,44 @@ function convertShortcuts(managerShortcuts) {
// 基本的Action到显示名称的映射 // 基本的Action到显示名称的映射
const actionDisplayMap = { const actionDisplayMap = {
undo: t('Canvas.Undo'), undo: {
redo: t('Canvas.Redo'), label:t('Canvas.Undo'),
delete: t('Canvas.DeleteSelectedElement'), value:"撤销",
selectAll: "全选", },
copy: t('Canvas.Copy'), redo: {
paste: t('Canvas.Pase'), label:t('Canvas.Redo'),
cut: t('Canvas.Cut'), value:"重做",
save: "保存", },
delete: {
label:t('Canvas.DeleteSelectedElement'),
value:"删除选中元素",
},
selectAll: {
label:"全选",
value:"全选",
},
copy: {
label:t('Canvas.Copy'),
value:"复制",
},
paste: {
label:t('Canvas.Pase'),
value:"粘贴",
},
cut: {
label:t('Canvas.Cut'),
value:"剪切",
},
save: "保存",
selectTool: "选择工具", selectTool: "选择工具",
increaseBrushSize: t('Canvas.DecreaseBrush'), increaseBrushSize: {
decreaseBrushSize: t('Canvas.IncreaseBrush'), label:t('Canvas.DecreaseBrush'),
value:"减少画笔大小",
},
decreaseBrushSize: {
label:t('Canvas.IncreaseBrush'),
value:"增加画笔大小",
},
toggleTempTool: "临时切换工具", toggleTempTool: "临时切换工具",
// newLayer: "新建图层", // newLayer: "新建图层",
// groupLayers: "组合图层", // groupLayers: "组合图层",
@@ -66,15 +93,34 @@ function convertShortcuts(managerShortcuts) {
// 工具ID到显示名称的映射 // 工具ID到显示名称的映射
const toolDisplayMap = { const toolDisplayMap = {
select: t('Canvas.SelectionMode'), select: {
draw: t('Canvas.PaintingMode'), label:t('Canvas.SelectionMode'),
eraser: t('Canvas.EraserMode'), value:"选择模式",
},
draw: {
label:t('Canvas.PaintingMode'),
value:"绘制模式",
},
eraser: {
label:t('Canvas.EraserMode'),
value:"橡皮擦模式",
},
// eyedropper: t('Canvas.Cut'), // eyedropper: t('Canvas.Cut'),
pan: '移动画布', // pan: '移动画布',
lasso: t('Canvas.LassoTool'), pan: {
label:t('Canvas.MoveCanvas'),
value:"移动画布",
},
lasso: {
label:t('Canvas.LassoTool'),
value:"套索工具",
},
// area_custom: t('Canvas.Cut'), // area_custom: t('Canvas.Cut'),
// wave: t('Canvas.Cut'), // wave: t('Canvas.Cut'),
liquify: t('Canvas.LiquifyTool'), liquify: {
label:t('Canvas.LiquifyTool'),
value:"液化工具",
},
}; };
// 处理每个快捷键 // 处理每个快捷键
@@ -264,7 +310,7 @@ function getShortcutsByCategory(category) {
// layer: ["新建图层", "组合图层", "取消组合", "合并图层"], // layer: ["新建图层", "组合图层", "取消组合", "合并图层"],
}; };
return shortcuts.value.filter((s) => categoryMap[category]?.includes(s.action)); return shortcuts.value.filter((s) => categoryMap[category]?.includes(s.action.value));
} }
</script> </script>
@@ -294,8 +340,8 @@ function getShortcutsByCategory(category) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in getShortcutsByCategory('basic')" :key="item.action"> <tr v-for="item in getShortcutsByCategory('basic')" :key="item.action.label">
<td>{{ item.action }}</td> <td>{{ item.action.label }}</td>
<td>{{ getShortcutForCurrentPlatform(item) }}</td> <td>{{ getShortcutForCurrentPlatform(item) }}</td>
</tr> </tr>
</tbody> </tbody>
@@ -312,8 +358,8 @@ function getShortcutsByCategory(category) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in getShortcutsByCategory('view')" :key="item.action"> <tr v-for="item in getShortcutsByCategory('view')" :key="item.action.label">
<td>{{ item.action }}</td> <td>{{ item.action.label }}</td>
<td>{{ getShortcutForCurrentPlatform(item) }}</td> <td>{{ getShortcutForCurrentPlatform(item) }}</td>
</tr> </tr>
</tbody> </tbody>
@@ -330,8 +376,8 @@ function getShortcutsByCategory(category) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in getShortcutsByCategory('tools')" :key="item.action"> <tr v-for="item in getShortcutsByCategory('tools')" :key="item.action.label">
<td>{{ item.action }}</td> <td>{{ item.action.label }}</td>
<td>{{ getShortcutForCurrentPlatform(item) }}</td> <td>{{ getShortcutForCurrentPlatform(item) }}</td>
</tr> </tr>
</tbody> </tbody>
@@ -348,8 +394,8 @@ function getShortcutsByCategory(category) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in getShortcutsByCategory('brush')" :key="item.action"> <tr v-for="item in getShortcutsByCategory('brush')" :key="item.action.label">
<td>{{ item.action }}</td> <td>{{ item.action.label }}</td>
<td>{{ getShortcutForCurrentPlatform(item) }}</td> <td>{{ getShortcutForCurrentPlatform(item) }}</td>
</tr> </tr>
</tbody> </tbody>
@@ -366,8 +412,8 @@ function getShortcutsByCategory(category) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in getShortcutsByCategory('layer')" :key="item.action"> <tr v-for="item in getShortcutsByCategory('layer')" :key="item.action.label">
<td>{{ item.action }}</td> <td>{{ item.action.label }}</td>
<td>{{ getShortcutForCurrentPlatform(item) }}</td> <td>{{ getShortcutForCurrentPlatform(item) }}</td>
</tr> </tr>
</tbody> </tbody>