修复画布多语言

This commit is contained in:
李志鹏
2025-09-24 16:26:40 +08:00
parent bdb3c50650
commit 016b25fcb9
12 changed files with 98 additions and 32 deletions

View File

@@ -190,7 +190,7 @@
</div>
<div class="uploaded-textures-section">
<div class="uploaded-textures-divider">
<span>{{ $t("上传的纹理") }}</span>
<span>{{ $t("Canvas.UploadedTexture") }}</span>
</div>
</div>
<div class="texture-grid">
@@ -201,7 +201,7 @@
<div class="upload-icon">
<span>+</span>
</div>
<span class="texture-label">{{ $t("上传纹理") }}</span>
<span class="texture-label">{{ $t("Canvas.UploadTexture") }}</span>
</div>
<div
v-for="textureId in brushStore.state.uploadedTextures"
@@ -219,7 +219,7 @@
<div
class="texture-remove-btn"
@click.stop="removeUploadedTexture(textureId)"
:title="$t('删除纹理')"
:title="$t('Canvas.DeleteTexture')"
>
<span>×</span>
</div>
@@ -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);
// 应用新创建的预设(可选)

View File

@@ -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) {
<span v-else-if="platform.isIPad">iPad</span>
<span v-else-if="platform.isIOS">iOS</span>
<span v-else-if="platform.isAndroid">Android</span>
<span v-else>其他</span>
<span v-if="platform.isTouchDevice"> (触控设备)</span>
<span v-else>{{ $t('Canvas.other') }}</span>
<span v-if="platform.isTouchDevice"> ({{ $t('Canvas.touchDevice') }})</span>
</div>
<div class="shortcuts-category">
@@ -421,14 +421,14 @@ function getShortcutsByCategory(category) {
</div> -->
<div class="touch-tips" v-if="platform.isTouchDevice">
<h3>触控设备提示</h3>
<h3>{{ $t('Canvas.touchDevicePrompts') }}</h3>
<ul>
<li>长按图层面板可访问更多选项</li>
<li>双击元素可快速进入编辑模式</li>
<li>双指拖动可平移画布</li>
<li>双指捏合可缩放画布</li>
<li>双指连按可显示元素变换控制点</li>
<li>三指左右滑动可进行撤销/重做操作</li>
<li>{{ $t('Canvas.touchDevicePrompts_1') }}</li>
<li>{{ $t('Canvas.touchDevicePrompts_2') }}</li>
<li>{{ $t('Canvas.touchDevicePrompts_3') }}</li>
<li>{{ $t('Canvas.touchDevicePrompts_4') }}</li>
<li>{{ $t('Canvas.touchDevicePrompts_5') }}</li>
<li>{{ $t('Canvas.touchDevicePrompts_6') }}</li>
</ul>
</div>
</Skeleton>

View File

@@ -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("未选择有效图像或图层不适合液化操作");