canvas语言适配

This commit is contained in:
X1627315083
2025-07-20 18:19:34 +08:00
parent 4b694236ee
commit c44aadc9e3
12 changed files with 207 additions and 64 deletions

View File

@@ -1,6 +1,8 @@
<script setup>
import { ref, inject, onMounted } from "vue";
import { Skeleton } from "ant-design-vue";
import { useI18n } from 'vue-i18n'
const {t} = useI18n()
const loading = ref(true);
const shortcuts = ref([]);
@@ -44,17 +46,17 @@ function convertShortcuts(managerShortcuts) {
// 基本的Action到显示名称的映射
const actionDisplayMap = {
undo: "撤销",
redo: "重做",
delete: "删除选中元素",
undo: t('Canvas.Undo'),
redo: t('Canvas.Redo'),
delete: t('Canvas.DeleteSelectedElement'),
selectAll: "全选",
copy: "复制",
paste: "粘贴",
cut: "剪切",
copy: t('Canvas.Copy'),
paste: t('Canvas.Pase'),
cut: t('Canvas.Cut'),
save: "保存",
selectTool: "选择工具",
increaseBrushSize: "增加笔触大小",
decreaseBrushSize: "减小笔触大小",
increaseBrushSize: t('Canvas.DecreaseBrush'),
decreaseBrushSize: t('Canvas.IncreaseBrush'),
toggleTempTool: "临时切换工具",
// newLayer: "新建图层",
// groupLayers: "组合图层",
@@ -64,15 +66,15 @@ function convertShortcuts(managerShortcuts) {
// 工具ID到显示名称的映射
const toolDisplayMap = {
select: "选择模式",
draw: "绘画模式",
eraser: "橡皮擦模式",
// eyedropper: "吸色工具",
pan: "移动画布",
lasso: "套索工具",
// area_custom: "自由选区工具",
// wave: "波浪工具",
liquify: "液化工具",
select: t('Canvas.SelectionMode'),
draw: t('Canvas.PaintingMode'),
eraser: t('Canvas.EraserMode'),
// eyedropper: t('Canvas.Cut'),
pan: '移动画布',
lasso: t('Canvas.LassoTool'),
// area_custom: t('Canvas.Cut'),
// wave: t('Canvas.Cut'),
liquify: t('Canvas.LiquifyTool'),
};
// 处理每个快捷键
@@ -95,9 +97,9 @@ function convertShortcuts(managerShortcuts) {
// 添加一些组件特定的快捷键
result.push({
action: "缩放画布",
windows: "鼠标滚轮",
mac: "鼠标滚轮 或 触控板缩放手势",
action: t('Canvas.ZoomCanvas'),
windows: t('Canvas.MouseWheel'),
mac: t('Canvas.MacZoomCanvas'),
touch: "双指捏合",
});
@@ -268,11 +270,11 @@ function getShortcutsByCategory(category) {
<template>
<div class="keyboard-shortcut-help">
<h2>键盘快捷键 & 操作指南</h2>
<h2>{{ $t('Canvas.KeyboardShortcutsOperationGuide') }}</h2>
<Skeleton active :loading="loading">
<div class="platform-info">
检测到的平台:
{{$t('Canvas.TheDetectedPlatform')}}:
<span v-if="platform.isMac">MacOS</span>
<span v-else-if="platform.isWindows">Windows</span>
<span v-else-if="platform.isIPad">iPad</span>
@@ -283,12 +285,12 @@ function getShortcutsByCategory(category) {
</div>
<div class="shortcuts-category">
<h3>基本操作</h3>
<h3> {{$t('Canvas.BasicOperations')}}</h3>
<table class="shortcuts-table">
<thead>
<tr>
<th>操作</th>
<th>快捷键/手势</th>
<th>{{$t('Canvas.BasicOperations')}}</th>
<th>{{$t('Canvas.ShortcutGesture')}}</th>
</tr>
</thead>
<tbody>
@@ -301,12 +303,12 @@ function getShortcutsByCategory(category) {
</div>
<div class="shortcuts-category">
<h3>视图操作</h3>
<h3>{{ $t('Canvas.viewOperations') }}</h3>
<table class="shortcuts-table">
<thead>
<tr>
<th>操作</th>
<th>快捷键/手势</th>
<th>{{ $t('Canvas.Operation') }}</th>
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
</tr>
</thead>
<tbody>
@@ -319,12 +321,12 @@ function getShortcutsByCategory(category) {
</div>
<div class="shortcuts-category">
<h3>工具切换</h3>
<h3>{{ $t('Canvas.toolSwitching') }}</h3>
<table class="shortcuts-table">
<thead>
<tr>
<th>操作</th>
<th>快捷键/手势</th>
<th>{{ $t('Canvas.Operation') }}</th>
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
</tr>
</thead>
<tbody>
@@ -337,12 +339,12 @@ function getShortcutsByCategory(category) {
</div>
<div class="shortcuts-category">
<h3>笔刷调整</h3>
<h3>{{ $t('Canvas.toolSwitching') }}</h3>
<table class="shortcuts-table">
<thead>
<tr>
<th>操作</th>
<th>快捷键/手势</th>
<th>{{ $t('Canvas.Operation') }}</th>
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
</tr>
</thead>
<tbody>