22 * @Author: LPY
33 * @Date: 2025-08-26 11:55:49
44 * @LastEditors: LPY
5- * @LastEditTime: 2025-08-26 14:42:10
5+ * @LastEditTime: 2025-08-26 17:45:17
66 * @FilePath: \glkvm-cloud\web-ui\src\views\device\components\rttyTerm.vue
77 * @Description:
88-->
99<template >
10- <a-spin :tip =" $t('Requesting device to create terminal... ')" >
10+ <a-spin :tip =" $t('rtty.requestingDeviceToCreateTerminal ')" >
1111 <div class =" terminal-container" >
1212 <div ref =" terminal" class =" terminal" @contextmenu.prevent =" showContextmenu" ></div >
1313 <BaseButton
1818 circle
1919 class =" keyboard-toggle-btn" >⌨</BaseButton >
2020 <RttyKeyboard v-show =" showKeyboard" @keypress =" handleKeypress" @close =" hideKeyboard" class =" floating-keyboard" />
21- <BaseModal v-model:open =" fileCtx.modal" :title =" $t('Upload file to device ')" @close =" onUploadDialogClosed" :width =" 400" >
21+ <BaseModal v-model:open =" fileCtx.modal" :title =" $t('rtty.uploadFileToDevice ')" @close =" onUploadDialogClosed" :width =" 400" >
2222 <a-upload :beforeUpload =" beforeUpload" action =" #" >
23- <BaseButton type =" primary" >{{ $t("Select file ") }}</BaseButton >
23+ <BaseButton type =" primary" >{{ $t("rtty.selectFile ") }}</BaseButton >
2424 </a-upload >
2525 <p v-if =" fileCtx.file !== null" > {{ fileCtx.file.name }}</p >
2626 <template #footer >
27- <BaseButton @click =" fileCtx.modal = false" >{{ $t('Cancel ') }}</BaseButton >
28- <BaseButton type =" primary" @click =" doUploadFile" >{{ $t('OK ') }}</BaseButton >
27+ <BaseButton @click =" fileCtx.modal = false" >{{ $t('common.cancel ') }}</BaseButton >
28+ <BaseButton type =" primary" @click =" doUploadFile" >{{ $t('common.ok ') }}</BaseButton >
2929 </template >
3030 </BaseModal >
3131 <ContextMenu v-model =" contextmenuPos" :menus =" contextmenus" @click =" onContextmenuClick" />
3636<script setup lang="ts">
3737import { ref , reactive , onMounted , onUnmounted , nextTick , useTemplateRef } from ' vue'
3838import { useRoute , useRouter } from ' vue-router'
39- import { useI18n } from ' vue-i18n'
4039import useClipboard from ' vue-clipboard3'
4140import { Terminal } from ' @xterm/xterm'
4241import { FitAddon } from ' @xterm/addon-fit'
@@ -47,6 +46,7 @@ import ContextMenu from './components/contextMenu.vue'
4746import RttyKeyboard from ' ./components/rttyKeyboard.vue'
4847import { BaseModal } from ' @gl/main/components'
4948import { message , Modal } from ' ant-design-vue'
49+ import { t } from ' @/hooks/useLanguage'
5050
5151const LoginErrorOffline = 4000
5252const LoginErrorBusy = 4001
@@ -66,26 +66,25 @@ const props = defineProps({
6666const emit = defineEmits ([' split' , ' close' ])
6767
6868const router = useRouter ()
69- const { t } = useI18n ()
7069const { toClipboard } = useClipboard ()
7170
7271const terminal = useTemplateRef (' terminal' )
7372const contextmenuPos = ref (null )
7473
7574const contextmenus = [
76- {name: ' copy' , caption: t (' Copy - Ctrl+Insert ' )},
77- {name: ' paste' , caption: t (' Paste - Shift+Insert ' )},
78- {name: ' clear' , caption: t (' Clear Scrollback ' )},
79- {name: ' font+' , caption: t (' font+ ' )},
80- {name: ' font-' , caption: t (' font- ' )},
81- {name: ' upload' , caption: t (' Upload file ' ) + ' - rtty -R' },
82- {name: ' download' , caption: t (' Download file ' ) + ' - rtty -S file' },
83- {name: ' split-left' , caption: t (' split-left ' )},
84- {name: ' split-right' , caption: t (' split-right ' )},
85- {name: ' split-up' , caption: t (' split-up ' )},
86- {name: ' split-down' , caption: t (' split-down ' )},
87- {name: ' close' , caption: t (' Close ' )},
88- {name: ' about' , caption: t (' About ' )},
75+ {name: ' copy' , caption: t (' rtty.copyTips ' )},
76+ {name: ' paste' , caption: t (' rtty.pasteTips ' )},
77+ {name: ' clear' , caption: t (' rtty.clearScrollBack ' )},
78+ {name: ' font+' , caption: t (' rtty.fontUp ' )},
79+ {name: ' font-' , caption: t (' rtty.fontDown ' )},
80+ {name: ' upload' , caption: t (' rtty.uploadFile ' ) + ' - rtty -R' },
81+ {name: ' download' , caption: t (' rtty.downloadFile ' ) + ' - rtty -S file' },
82+ {name: ' split-left' , caption: t (' rtty.splitLeft ' )},
83+ {name: ' split-right' , caption: t (' rtty.splitRight ' )},
84+ {name: ' split-up' , caption: t (' rtty.splitUp ' )},
85+ {name: ' split-down' , caption: t (' rtty.splitDown ' )},
86+ {name: ' close' , caption: t (' common.close ' )},
87+ {name: ' about' , caption: t (' common.about ' )},
8988]
9089
9190const fileCtx = reactive ({
@@ -130,7 +129,7 @@ const onContextmenuClick = (name) => {
130129 if (name === ' copy' ) {
131130 const text = term .getSelection ()
132131 if (text )
133- copyText (text ).then (() => message .success (t (' Copied to clipboard ' )))
132+ copyText (text ).then (() => message .success (t (' rtty.copiedToClipboard ' )))
134133 } else if (name === ' paste' ) {
135134 pasteFromClipboard ()
136135 } else if (name === ' clear' ) {
@@ -140,9 +139,9 @@ const onContextmenuClick = (name) => {
140139 } else if (name === ' font-' ) {
141140 updateFontSize (- 1 )
142141 } else if (name === ' upload' ) {
143- message .success (t (' Please execute command " rtty -R" in current terminal! ' ))
142+ message .success (t (' rtty.executeCommandR ' ))
144143 } else if (name === ' download' ) {
145- message .success (t (' Please execute command " rtty -S file" in current terminal! ' ))
144+ message .success (t (' rtty.executeCommandS ' ))
146145 } else if (name === ' split-left' ) {
147146 emit (' split' , props .panelId , ' left' )
148147 } else if (name === ' split-right' ) {
@@ -163,23 +162,23 @@ const onContextmenuClick = (name) => {
163162const pasteFromClipboard = async () => {
164163 try {
165164 if (! navigator .clipboard || ! navigator .clipboard .readText ) {
166- message .info (t (' Please use shortcut "Shift+Insert "' ))
165+ message .info (t (' rtty.useShortcutSI "' ))
167166 return
168167 }
169168
170169 const text = await navigator .clipboard .readText ()
171170 if (text ) {
172171 sendTermData (text )
173- message .success (t (' Pasted from clipboard ' ))
172+ message .success (t (' rtty.pastedFromClipboard ' ))
174173 }
175174 } catch (error ) {
176175 if (error .name === ' NotAllowedError' ) {
177176 Modal .warning ({
178- title: t (' Clipboard Permission Required ' ),
179- content: t (' clipboard_instructions ' ),
177+ title: t (' rtty.clipboardPermissionRequired ' ),
178+ content: t (' rtty.clipboardInstructions ' ),
180179 })
181180 } else {
182- message .info (t (' Please use shortcut "Shift+Insert "' ))
181+ message .info (t (' rtty.useShortcutSI "' ))
183182 }
184183 }
185184}
@@ -222,7 +221,7 @@ const doUploadFile = () => {
222221 term .focus ()
223222
224223 if (fileCtx .file .size > 0xffffffff ) {
225- message .error (t (' The file you will upload is too large(> 4294967295 Byte) ' ))
224+ message .error (t (' rtty.fileTooLargeTips ' ))
226225 return
227226 }
228227
0 commit comments