gemercheung 1 tahun lalu
induk
melakukan
4f75998aca

+ 2 - 0
package.json

@@ -3,6 +3,7 @@
   "private": true,
   "version": "0.0.0",
   "scripts": {
+    "translate": "node translate.js",
     "dev": "vite  --mode development --port=6100",
     "dev-eur": "vite --mode eur --port=6100",
     "build-eur-test": "vue-tsc  --noEmit && vite build --mode eur",
@@ -18,6 +19,7 @@
     "lint:lint-staged": "lint-staged"
   },
   "dependencies": {
+    "@vueuse/core": "^10.9.0",
     "agora-rtc-sdk-ng": "^4.19.3",
     "axios": "^1.1.3",
     "clipboard": "^2.0.11",

+ 47 - 0
pnpm-lock.yaml

@@ -5,6 +5,9 @@ settings:
   excludeLinksFromLockfile: false
 
 dependencies:
+  '@vueuse/core':
+    specifier: ^10.9.0
+    version: 10.9.0(vue@3.2.41)
   agora-rtc-sdk-ng:
     specifier: ^4.19.3
     version: 4.19.3
@@ -1279,6 +1282,10 @@ packages:
     resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
     dev: false
 
+  /@types/web-bluetooth@0.0.20:
+    resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==}
+    dev: false
+
   /@types/yargs-parser@21.0.0:
     resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==}
     dev: true
@@ -1679,6 +1686,18 @@ packages:
     resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==}
     dev: true
 
+  /@vueuse/core@10.9.0(vue@3.2.41):
+    resolution: {integrity: sha512-/1vjTol8SXnx6xewDEKfS0Ra//ncg4Hb0DaZiwKf7drgfMsKFExQ+FnnENcN6efPen+1kIzhLQoGSy0eDUVOMg==}
+    dependencies:
+      '@types/web-bluetooth': 0.0.20
+      '@vueuse/metadata': 10.9.0
+      '@vueuse/shared': 10.9.0(vue@3.2.41)
+      vue-demi: 0.14.7(vue@3.2.41)
+    transitivePeerDependencies:
+      - '@vue/composition-api'
+      - vue
+    dev: false
+
   /@vueuse/core@9.13.0(vue@3.2.41):
     resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==}
     dependencies:
@@ -1691,10 +1710,23 @@ packages:
       - vue
     dev: false
 
+  /@vueuse/metadata@10.9.0:
+    resolution: {integrity: sha512-iddNbg3yZM0X7qFY2sAotomgdHK7YJ6sKUvQqbvwnf7TmaVPxS4EJydcNsVejNdS8iWCtDk+fYXr7E32nyTnGA==}
+    dev: false
+
   /@vueuse/metadata@9.13.0:
     resolution: {integrity: sha512-gdU7TKNAUVlXXLbaF+ZCfte8BjRJQWPCa2J55+7/h+yDtzw3vOoGQDRXzI6pyKyo6bXFT5/QoPE4hAknExjRLQ==}
     dev: false
 
+  /@vueuse/shared@10.9.0(vue@3.2.41):
+    resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==}
+    dependencies:
+      vue-demi: 0.14.7(vue@3.2.41)
+    transitivePeerDependencies:
+      - '@vue/composition-api'
+      - vue
+    dev: false
+
   /@vueuse/shared@9.13.0(vue@3.2.41):
     resolution: {integrity: sha512-UrnhU+Cnufu4S6JLCPZnkWh0WwZGUp72ktOF2DFptMlOs3TOdVv8xJN53zhHGARmVOsz5KqOls09+J1NR6sBKw==}
     dependencies:
@@ -6287,6 +6319,21 @@ packages:
       vue: 3.2.41
     dev: false
 
+  /vue-demi@0.14.7(vue@3.2.41):
+    resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
+    engines: {node: '>=12'}
+    hasBin: true
+    requiresBuild: true
+    peerDependencies:
+      '@vue/composition-api': ^1.0.0-rc.1
+      vue: ^3.0.0-0 || ^2.6.0
+    peerDependenciesMeta:
+      '@vue/composition-api':
+        optional: true
+    dependencies:
+      vue: 3.2.41
+    dev: false
+
   /vue-eslint-parser@8.3.0(eslint@8.23.1):
     resolution: {integrity: sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}

+ 8 - 3
src/components/chatRoom/index.vue

@@ -122,9 +122,9 @@
             @keyup.enter="sendText"
             :placeholder="t('base.saySomething')"
           />
-          <span class="iconsend_icon" :class="{ disable: text == '' }" @click.stop="sendText"
-            >{{ t('base.send') }}</span
-          >
+          <span class="iconsend_icon" :class="{ disable: text == '' }" @click.stop="sendText">{{
+            t('base.send')
+          }}</span>
         </div>
       </div>
     </div>
@@ -213,6 +213,7 @@
   import duration from 'dayjs/plugin/duration';
   import { useMiniApp } from '/@/hooks/useMiniApp';
   import { v4 as uuidv4 } from 'uuid';
+  import { useMagicKeys } from '@vueuse/core';
 
   const { closeSocket } = useSocket();
   dayjs.extend(duration);
@@ -415,6 +416,7 @@
     }
   };
 
+  const { enter } = useMagicKeys();
   onMounted(async () => {
     watch(
       () => isLoaded,
@@ -449,6 +451,9 @@
       },
     );
 
+    watch(enter, (v) => {
+      if (v) console.log('enter has been pressed');
+    });
     // watch(currentTag, (val) => {
     //   console.log('currentTag', val);
     // });

+ 6 - 4
src/locales/lang/en.ts

@@ -1,13 +1,15 @@
-import { genMessage } from '../helper';
+// import { genMessage } from '../helper';
 // import antdLocale from 'ant-design-vue/es/locale/en_US'
 
-type modulesType = Record<string, Record<string, any>>;
+// type modulesType = Record<string, Record<string, any>>;
 // const modules = import.meta.globEager('./en/**/*.ts')
-const modules: modulesType = import.meta.glob('./en/**/*.ts', { eager: true });
+// const modules: modulesType = import.meta.glob('./en/**/*.ts', { eager: true });
+import en from './webslate/en.json';
 
 export default {
   message: {
-    ...genMessage(modules, 'en'),
+    en,
+    // ...genMessage(modules, 'en'),
     // antdLocale
   },
   dateLocale: null,

+ 64 - 0
src/locales/lang/webslate/en.json

@@ -0,0 +1,64 @@
+{
+    "action": {
+        "hoster": "Host",
+        "hostLeaveRoom": "The host has left the room.",
+        "hostExitRoom": "The host has left the studio",
+        "earlyRoomError": "Please wait till the reservation can be made.",
+        "hostNotInRoomError": "The host is not in the room",
+        "micOn": "Mic is on",
+        "enterRoom": "Enter the room",
+        "hosterCloseDraw": "The host closes the brush",
+        "hostAllowInput": "The host is lift a ban",
+        "hosterOpenDraw": "The host opens a brush",
+        "hostBanInput": "The host set up a ban",
+        "hosterEnterRoom": "The host enter the room",
+        "leaveRoom": "Leave the studio",
+        "endUpRoom": "The Livestream is ended",
+        "errorRepeatLogin": "You have already connected to this page; please do not log in again.",
+        "errorInvalidMaster": "Inappropriate host, please check the settings !",
+        "timeOutRoomError": "Current room occupancy has expired.",
+        "errorRoomMaxing": "The room is fully staffed; please try again later!",
+        "exitRoom": "Leave the room",
+        "hosterDismissRoom": "The host has dismissed the room",
+        "micOff": "Mic is off"
+    },
+    "base": {
+        "floorPlan": "floorPlan",
+        "dollhouse": "dollhouse",
+        "copySuccess": "Copy Success!",
+        "knowIt": "Confirm",
+        "baseError1": "The scene is calculating, please try again later",
+        "baseError2": "Room anomaly, please contact the host",
+        "roomTimeOut": "The total valid time for live stream is 60 minutes, and will be automatically shut down upon expiration. You can re-initiate if needed. Please pay attention to the remaining times above, thank you!",
+        "debuginfo": "debug info",
+        "threeDModel": "3D Model",
+        "saySomething": "Comment",
+        "memberManager": "Member Management",
+        "sceneList": "Scene List",
+        "inviteFriends": "Invite Friends",
+        "copy": "Copy",
+        "confirm": "Confirm",
+        "tips": "tips",
+        "copyShare": "Copy share Link",
+        "maxRooms": "The number of people is full and can be switched for free viewing.",
+        "copyShareSuccess": "Link Copy Success",
+        "share": "Share",
+        "freeWalk": "Walkthrough",
+        "endNow": "end",
+        "send": "Send",
+        "saveSuccess": "Save successfully",
+        "audioPermission": "To continue viewing this page, we require camera and microphone access.",
+        "nickNameRegrexError": "The nickname is limited to 1 to 15 characters in Chinese, English, digits, or underscores.",
+        "disabledTalk": "The host set up a ban",
+        "joinRoom": "Enter the room",
+        "silent": "Banned",
+        "floorPlanView": "Floor plan",
+        "errorRoom": "Room anomaly, please contact the host",
+        "endRoom": "Confirm to end the livestream?",
+        "view": "View",
+        "nickNameRequired": "Please enter your nickname!",
+        "connecting": "Connecting...",
+        "hoster": "Host",
+        "cancel": "Cancel"
+    }
+}

+ 64 - 0
src/locales/lang/webslate/zh.json

@@ -0,0 +1,64 @@
+{
+    "action": {
+        "hoster": "主持人",
+        "hosterOpenDraw": "主持人开启画笔",
+        "hosterCloseDraw": "主持人关闭画笔",
+        "hosterEnterRoom": "主持人进入房间",
+        "hosterDismissRoom": "主持人已解散房间",
+        "hostLeaveRoom": "主持人离开了房间",
+        "hostExitRoom": "主持人退出了房间",
+        "hostAllowInput": "主持人已解除禁言",
+        "hostBanInput": "主持人设置了禁言",
+        "enterRoom": "进入房间",
+        "leaveRoom": "离开房间",
+        "exitRoom": "退出房间",
+        "endUpRoom": "带看已结束",
+        "errorRepeatLogin": "你已有正在连接的页面,请勿重复登录!",
+        "errorRoomMaxing": "房间已满员,请稍后再试!",
+        "errorInvalidMaster": "非法主持人,请检查参数!",
+        "earlyRoomError": "未到房间使用时间",
+        "timeOutRoomError": "当前房间使用期限已到",
+        "hostNotInRoomError": "主持人不在带看房间内",
+        "micOn": "你已开启麦克风",
+        "micOff": "你已关闭麦克风"
+    },
+    "base": {
+        "debuginfo": "调试信息",
+        "floorPlan": "二维",
+        "dollhouse": "三维",
+        "threeDModel": "3D模型",
+        "saySomething": "评论",
+        "memberManager": "成员管理",
+        "sceneList": "场景列表",
+        "inviteFriends": "邀请好友",
+        "copy": "复制",
+        "confirm": "确定",
+        "share": "分享",
+        "copyShare": "复制分享",
+        "copyShareSuccess": "链接复制成功",
+        "cancel": "取消",
+        "tips": "温馨提示",
+        "maxRooms": "带看人数已满,可切换自由观看。",
+        "freeWalk": "自由观看",
+        "endRoom": "是否结束带看?",
+        "endNow": "立即结束",
+        "disabledTalk": "主持人设置了禁言",
+        "floorPlanView": "平面",
+        "copySuccess": "复制成功!",
+        "errorRoom": "房间异常,请联系主持人。",
+        "knowIt": "我知道了",
+        "view": "观看",
+        "send": "发送",
+        "saveSuccess": "保存成功!",
+        "nickNameRequired": "请输入您的昵称",
+        "joinRoom": "加入带看房间",
+        "hoster": "主持人",
+        "audioPermission": "继续访问该页面需要获取您摄像头及麦克风的权限。",
+        "nickNameRegrexError": "昵称应是为中文、英文、数字或者下划线,且长度为1到15",
+        "silent": "已被禁言",
+        "connecting": "连接中...",
+        "baseError1": "该场景正在计算中,请稍后再试",
+        "baseError2": "房间异常,请联系主持人",
+        "roomTimeOut": "带看房间有效总时长为60分钟,到期后将自动关闭。如有需要,您可重新发起。请及时关注上方的剩余时长,谢谢!"
+    }
+}

+ 10 - 6
src/locales/lang/zh.ts

@@ -1,13 +1,17 @@
-import { genMessage } from '../helper';
+// import { genMessage } from '../helper';
 // import antdLocale from 'ant-design-vue/es/locale/zh_CN'
-type modulesType = Record<string, Record<string, any>>;
+import zh from './webslate/zh.json';
+// type modulesType = Record<string, Record<string, any>>;
 // const modules = import.meta.globEager('./zh-CN/**/*.ts')
-const modules: modulesType = import.meta.glob('./zh/**/*.ts', {
-  eager: true,
-});
+// const modules: modulesType = import.meta.glob('./zh/**/*.ts', {
+//   eager: true,
+// });
+
+debugger;
 export default {
   message: {
-    ...genMessage(modules, 'zh'),
+    zh,
+    // ...genMessage(modules, 'zh'),
     // antdLocale
   },
   // momentLocaleName: 'zh-cn',

+ 25 - 0
translate.js

@@ -0,0 +1,25 @@
+const http = require('http');
+const fs = require('fs');
+
+function checkIfPhishing(urlToPrint, path, lang = 'zh') {
+  fs.mkdirSync(path, { recursive: true });
+  const file = fs.createWriteStream(`${path}/${lang}.json`);
+  const request = http.get(urlToPrint, function (response) {
+    response.pipe(file).on('finish', function () {
+      console.log(`lang: ${lang} get translate in ${path} Done!`);
+      // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" }));
+    });
+  });
+}
+// editor zh
+checkIfPhishing(
+  'http://192.168.0.163:8080/download/daikan/frontend/zh_Hans/',
+  'src/locales/lang/webslate',
+  'zh',
+);
+// editor en
+checkIfPhishing(
+  'http://192.168.0.163:8080/download/daikan/frontend/en/',
+  'src/locales/lang/webslate',
+  'en',
+);