From d592480beb70716a59b6ec5a00c73e92ff6ea986 Mon Sep 17 00:00:00 2001
From: he wei <858544502@qq.com>
Date: 星期一, 15 一月 2024 18:14:17 +0800
Subject: [PATCH] U 国际化

---
 src/components/contextMenu.vue |   70 ++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/src/components/contextMenu.vue b/src/components/contextMenu.vue
index 95fb864..a286380 100644
--- a/src/components/contextMenu.vue
+++ b/src/components/contextMenu.vue
@@ -44,15 +44,15 @@
       append-to-body
       width="30%"
     >
-      <el-input v-model="stationName" placeholder="璇疯緭鍏�..."></el-input>
+      <el-input v-model="stationName" :placeholder="$t('form.inputMsg')"></el-input>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
-        <el-button type="primary" @click="stationNameOk">纭� 瀹�</el-button>
+        <el-button @click="dialogVisible = false">{{ $t('operate.cancel') }}</el-button>
+        <el-button type="primary" @click="stationNameOk">{{ $t('operate.ok') }}</el-button>
       </span>
     </el-dialog>
     <!-- 鏂囦欢灞炴�� -->
     <el-dialog
-      title="灞炴��"
+      :title="$t('Properties')"
       class="file-info"
       :visible.sync="fileInfoVisible"
       append-to-body
@@ -74,6 +74,10 @@
 
 <script>
 import FileInfo from "@/components/fileInfo";
+import i18n from './i18n/contextMenu';
+import { createI18nOption } from '@/assets/js/tools/i18n';
+
+const i18nMixin = createI18nOption(i18n);
 import {
   addStation,
   addFileInStation,
@@ -85,6 +89,7 @@
 } from "@/apis";
 export default {
   name: "ContextMenu",
+  mixins: [i18nMixin],
   model: {
     prop: "visible",
     event: "change",
@@ -112,26 +117,26 @@
     const menuList = [
       {
         id: 0,
-        title: "鎵撳紑鏂囦欢",
+        title: this.$t('OpenFile'),
         method: "openFile",
         disabled: false,
         visible: false,
       },
       {
         id: 1,
-        title: "鏂板缓",
+        title: this.$t('New'),
         disabled: false,
         visible: false,
         children: [
           {
             id: 11,
-            title: "鏂板缓鏍规枃浠�",
+            title: this.$t('NewRootFile'),
             method: "addRootStation",
             disabled: false,
           },
           {
             id: 12,
-            title: "鏂板缓瀛愭枃浠�",
+            title: this.$t('NewSubFile'),
             method: "addSubStation",
             disabled: false,
           },
@@ -139,19 +144,19 @@
       },
       {
         id: 2,
-        title: "娣诲姞",
+        title: this.$t('New1'),
         disabled: false,
         visible: false,
         children: [
           {
             id: 13,
-            title: "鎸囧畾鐩綍涓嬫墍鏈夋枃浠�",
+            title: this.$t('Allfilesinthespecifieddirectory'),
             method: "selectDir",
             disabled: false,
           },
           {
             id: 14,
-            title: "鍗曚竴鏂囦欢",
+            title: this.$t('SingleFile'),
             method: "selectFile",
             disabled: false,
           },
@@ -159,14 +164,14 @@
       },
       {
         id: 3,
-        title: "閲嶅懡鍚�",
+        title: this.$t('Rename'),
         method: "rename",
         disabled: false,
         visible: false,
       },
       {
         id: 4,
-        title: "鍒犻櫎",
+        title: this.$t('Delete'),
         method: "deleteItem",
         disabled: false,
         visible: false,
@@ -177,7 +182,6 @@
       dialogTitle: "",
       dialogVisible: false,
       stationName: "",
-      // 鎿嶄綔绫诲瀷 'rename', 'add'
       type: "",
       fileInfoVisible: false,
       fileData: {},
@@ -248,7 +252,7 @@
           this.currFile.fileId = fileId;
           this.fileInfoVisible = true;
         } else {
-          this.$message.error("鏂囦欢瑙f瀽澶辫触");
+          this.$message.error(this.$t('FileParsingFailed'));
         }
       });
     },
@@ -278,20 +282,20 @@
       // console.log(this.menuList, this.disabledList, 9090);
     },
     addRootStation() {
-      this.dialogTitle = "鏂板缓鏍规枃浠跺悕绉�";
+      this.dialogTitle = this.$t('NewRootFileName');
       this.stationName = "";
       this.type = "add";
       this.dialogVisible = true;
     },
     addSubStation() {
-      this.dialogTitle = "鏂板缓瀛愭枃浠跺悕绉�";
+      this.dialogTitle = this.$t('NewSubFileName');
       this.stationName = "";
       this.type = "add";
       this.dialogVisible = true;
     },
     stationNameOk() {
       if ("" == this.stationName.trim()) {
-        this.$message.error("鍚嶇О涓嶈兘涓虹┖");
+        this.$message.error(this.$t('Thenamecannotbeblank'));
         return false;
       }
       if (this.type == "add") {
@@ -321,10 +325,10 @@
         const { code, data } = res.data;
         if (code && data) {
           this.dialogVisible = false;
-          this.$message.success("娣诲姞鎴愬姛");
+          this.$message.success(this.$t('AddSuccessfully'));
           this.reload();
         } else {
-          this.$message.error("鎿嶄綔澶辫触");
+          this.$message.error(this.$t('OperationFailed'));
         }
       });
     },
@@ -356,17 +360,17 @@
     deleteItem() {
       let { label, parent, level } = this.contextData;
       if (level == 3) {
-        this.$confirm("姝ゆ搷浣滃皢浠庣珯鐐圭Щ闄よ鏂囦欢, 鏄惁缁х画?", "鎻愮ず", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
+        this.$confirm(this.$t('Thefilewillberemovedfromthesitewhethertocontinue'), this.$t('Note'), {
+          confirmButtonText: this.$t('operate.ok'),
+          cancelButtonText: this.$t('operate.cancel'),
           type: "warning",
         }).then(() => {
           this.deleteFile();
         });
       } else {
-        this.$confirm("姝ゆ搷浣滃皢鍒犻櫎璇ョ珯鐐�, 鏄惁缁х画?", "鎻愮ず", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
+        this.$confirm(this.$t('Thesitewillbedeletedcontinuetheoperation'), this.$t('Note'), {
+          confirmButtonText: this.$t('operate.ok'),
+          cancelButtonText: this.$t('operate.cancel'),
           type: "warning",
         }).then(() => {
           this.deleteStation();
@@ -408,16 +412,16 @@
       delFileFromStation(params).then((res) => {
         const { code, data, data2 } = res.data;
         if (code && data) {
-          this.$message.success("鎿嶄綔鎴愬姛");
+          this.$message.success(this.$t('OperationSuccessfully'));
           this.reload();
         } else {
-          this.$message.error("鎿嶄綔澶辫触");
+          this.$message.error(this.$t('OperationFailed'));
         }
       });
     },
     // 閲嶅懡鍚嶇幇鍙拡瀵瑰彴绔� 锛堟枃浠舵槸鍚﹂噸鍛藉悕闇�瑕佺‘璁ら渶姹�)
     rename() {
-      this.dialogTitle = "淇敼绔欑偣鍚嶇О";
+      this.dialogTitle = this.$t('ModifySiteName');
       this.stationName = this.contextData.label;
       this.type = "rename";
       this.dialogVisible = true;
@@ -447,10 +451,10 @@
         const { code, data } = res.data;
         if (code && data) {
           this.dialogVisible = false;
-          this.$message.success("鎿嶄綔鎴愬姛");
+          this.$message.success(this.$t('OperationSuccessfully'));
           this.reload();
         } else {
-          this.$message.error("鎿嶄綔澶辫触");
+          this.$message.error(this.$t('OperationFailed'));
         }
       });
     },
@@ -462,9 +466,9 @@
       updateFileParam(this.currFile.stationId, data).then((res) => {
         const { code, data } = res.data;
         if (code && data) {
-          this.$message.success('淇敼鎴愬姛');
+          this.$message.success(this.$t('ModifySuccessfully'));
         } else {
-          this.$message.error('淇敼澶辫触');
+          this.$message.error(this.$t('ModifyFailed'));
         }
       });
       this.toRes();

--
Gitblit v1.9.1