Skip to content

Commit c8c9c1d

Browse files
author
Simon
committed
feat: 👷 add zh-TW supported language, fix turning off the screen bug.
1 parent 8284db1 commit c8c9c1d

File tree

10 files changed

+245
-25
lines changed

10 files changed

+245
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scrcpy-gui",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"author": "SimonMa <[email protected]>",
55
"homepage": "https://github.com/Tomotoes/scrcpy-gui",
66
"description": "✨ A simple & beautiful GUI application for scrcpy",

src/main/scrcpy/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ const open = ({ sender }, options) => {
3636
if (fixed) {
3737
args.push('--always-on-top')
3838
}
39-
if (!control) {
40-
args.push('--no-control')
41-
}
4239
if (!border) {
4340
args.push('--window-borderless')
4441
}
@@ -47,6 +44,8 @@ const open = ({ sender }, options) => {
4744
}
4845
if (awake) {
4946
args.push('--stay-awake')
47+
} else if (!control) {
48+
args.push('--no-control')
5049
}
5150
if (touch) {
5251
args.push('--show-touches')
@@ -95,7 +94,7 @@ const open = ({ sender }, options) => {
9594

9695
devices.forEach(({ id }) => {
9796
const { spawn } = require('child_process')
98-
const scrcpy = spawn(cmd, [...args, '-s',`${id}`])
97+
const scrcpy = spawn(cmd, [...args, '-s', `${id}`])
9998

10099
let opened = false
101100
let exited = false

src/renderer/components/dashboard/Configuration.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,16 @@
243243
<el-checkbox v-model="config.fullscreen" border size="medium">{{
244244
$t("configuration.other.fullscreen")
245245
}}</el-checkbox>
246-
<el-checkbox v-model="config.awake" border size="medium">{{
247-
$t("configuration.other.awake")
248-
}}</el-checkbox>
246+
<el-tooltip
247+
class="item"
248+
effect="dark"
249+
:content="$t('configuration.other.awake.tooltip')"
250+
placement="top"
251+
>
252+
<el-checkbox v-model="config.awake" border size="medium">{{
253+
$t("configuration.other.awake.content")
254+
}}</el-checkbox>
255+
</el-tooltip>
249256
<el-checkbox v-model="config.touch" border size="medium">{{
250257
$t("configuration.other.touch")
251258
}}</el-checkbox>
@@ -270,7 +277,7 @@
270277
</el-tooltip>
271278
</el-form-item>
272279
<el-divider content-position="right">
273-
<el-button type="text" @click="changeLocale">/English</el-button>
280+
<el-button type="text" @click="changeLocale">简/繁/English</el-button>
274281
</el-divider>
275282
<div style="margin:10px auto;text-align:center">
276283
<el-button type="primary" @click.native.prevent="save" plain v-waves>{{
@@ -350,6 +357,16 @@ export default {
350357
]
351358
};
352359
},
360+
watch: {
361+
"config.control"(newVal, oldVal) {
362+
if (this.config.awake && !newVal) {
363+
this.config.awake = false
364+
}
365+
},
366+
"config.awake"(newVal, oldVal) {
367+
newVal && (this.config.control = true);
368+
}
369+
},
353370
created() {
354371
if (this.$store.has("config")) {
355372
this.config = this.$store.get("config");
@@ -409,7 +426,13 @@ export default {
409426
this.$store.put("config", this.config);
410427
},
411428
changeLocale() {
412-
localStorage.setItem("lang", this.$i18n.locale === "zh" ? "en" : "zh");
429+
let nextLang = "en";
430+
if (this.$i18n.locale === "zhCN") {
431+
nextLang = "zhTW";
432+
} else if (this.$i18n.locale === "en") {
433+
nextLang = "zhCN";
434+
}
435+
localStorage.setItem("lang", nextLang);
413436
window.tray.destroy();
414437
window.location.reload();
415438
}

src/renderer/components/menu/Menu.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export default (vue) => (tray, ...items) => {
2121
const submenu = []
2222
if (!items.length) {
2323
submenu.push({
24-
label: ''
24+
label: 'Supported languages: '
2525
})
2626
}
2727
submenu.push({
28-
label: 'English',
28+
label: '- English',
2929
click: () => {
3030
localStorage.setItem('lang', 'en')
3131
tray.destroy()
@@ -37,9 +37,21 @@ export default (vue) => (tray, ...items) => {
3737
})
3838
submenu.push(
3939
{
40-
label: '中文',
40+
label: '- 简体中文',
4141
click: () => {
42-
localStorage.setItem('lang', 'zh')
42+
localStorage.setItem('lang', 'zhCN')
43+
tray.destroy()
44+
window.location.reload()
45+
}
46+
})
47+
submenu.push({
48+
type: 'separator'
49+
})
50+
submenu.push(
51+
{
52+
label: '- 繁体中文',
53+
click: () => {
54+
localStorage.setItem('lang', 'zhTW')
4355
tray.destroy()
4456
window.location.reload()
4557
}

src/renderer/components/menu/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ export default vue => {
66
const Menu = getMenu(vue)
77
const tray = Tray(Menu)
88
window.tray = tray
9+
let hideWhenClickingClose = false
10+
const config = vue.$store.get('config')
11+
if(config) {
12+
hideWhenClickingClose = config.hidden
13+
}
914
new Titlebar({
1015
backgroundColor: Color.fromHex('#868686'),
1116
shadow: true,
1217
icon: 'https://cdn.jsdelivr.net/gh/Tomotoes/images/blog/favicon.ico',
1318
maximizable: false,
14-
hideWhenClickingClose: vue.$store.get('config').hidden || false,
19+
hideWhenClickingClose,
1520
menu: Menu(tray)
1621
})
1722
}

src/renderer/lang/en.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export default {
8181
touch: 'Show phone tap location',
8282
render: 'Rendering all frames',
8383
screen: 'Turn off the phone screen',
84-
awake: 'Turn off the lock screen',
84+
awake: {
85+
tooltip: 'The computer control option must be opened before turning off the lock screen',
86+
content: 'Turn off the lock screen'
87+
},
8588
auto: 'Automatically turn on connected devices',
8689
hidden: {
8790
tooltip: 'Need to restart the application to take effect',
@@ -147,7 +150,7 @@ export default {
147150
success: '{name} already disconnected'
148151
},
149152
error: {
150-
'unknownScrcpyPathException':'The path of the Scrcpy folder is incorrectly configured. Make sure that `scrcpy.exe` exists in this folder'
153+
'unknownScrcpyPathException': 'The path of the Scrcpy folder is incorrectly configured. Make sure that `scrcpy.exe` exists in this folder'
151154
}
152155
},
153156
titleBar: {

src/renderer/lang/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as en } from './en'
2-
export { default as zh } from './zh'
2+
export { default as zhCN } from './zh_CN'
3+
export { default as zhTW } from './zh_TW'
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export default {
8787
touch: '显示点按位置',
8888
render: '渲染所有帧 会增加延迟',
8989
screen: '打开镜像时关闭屏幕',
90-
awake: '关闭锁屏',
90+
awake: {
91+
tooltip: '关闭锁屏前须打开电脑控制选项',
92+
content: '关闭锁屏'
93+
},
9194
auto: '自动打开新连接的设备',
9295
hidden: {
9396
tooltip: '需要重启应用才会生效',

src/renderer/lang/zh_TW.js

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
export default {
2+
notify: {
3+
'error': '錯誤',
4+
'info': '提示',
5+
'success': '成功',
6+
'warning': '警告'
7+
},
8+
footer: {
9+
powerBy: '基於',
10+
author: '作者'
11+
},
12+
dashboard: {
13+
configuration: '投影配置',
14+
management: '投影管理'
15+
},
16+
configuration: {
17+
source: {
18+
label: 'Scrcpy',
19+
placeholder: 'Scrcpy資料夾路徑 - 例如: C:\\scrcpy-win64',
20+
tooltip: '如果不設定,請將scrcpy資料夾路徑配置到環境變數'
21+
},
22+
title: {
23+
label: '視窗標題',
24+
placeholder: '預設為手機型號'
25+
},
26+
record: {
27+
label: '錄製投影畫面',
28+
tip: '開啟後,將錄製投影畫面;關閉後,將儲存已錄製的影片文件到指定路徑',
29+
filepath: '螢幕錄影文件路徑',
30+
tooltip: '路徑包括影片名,影片格式為.mkv',
31+
mirror: '錄影時啟動投影'
32+
},
33+
bitRate: {
34+
label: '投影傳輸比特率',
35+
popover: '8M為預設比特率'
36+
},
37+
maxSize: {
38+
label: '等比最大解析度',
39+
popover: '0為預設解析度'
40+
},
41+
maxFps: {
42+
label: '最大FPS幀數',
43+
popover: '0為預設FPS幀數'
44+
},
45+
orientation: {
46+
label: '旋轉角度',
47+
popover: '0°為預設值'
48+
},
49+
crop: {
50+
label: '裁剪畫面',
51+
x: '裁剪位置的横座標',
52+
y: '裁剪位置的縱座標',
53+
height: {
54+
title: '裁剪尺寸中的高度',
55+
content: '高寬為0,則不裁剪'
56+
},
57+
width: {
58+
title: '裁剪尺寸中的寬度',
59+
content: '高寬為0,則不裁剪'
60+
},
61+
},
62+
window: {
63+
label: '初始化',
64+
x: {
65+
title: '投影的横座標',
66+
content: '橫縱座標為0, 則以預設的位置打開'
67+
},
68+
y: {
69+
title: '投影的縱坐標',
70+
content: '橫縱座標為0, 則以預設的位置打開'
71+
},
72+
height: {
73+
title: '投影畫面的高度',
74+
content: '高寬為0,則以預設尺寸顯示'
75+
},
76+
width: {
77+
title: '投影畫面的寬度',
78+
content: '高寬為0,則以預設尺寸顯示'
79+
},
80+
},
81+
other: {
82+
label: '其他設置',
83+
fixed: '最上層顯示視窗',
84+
control: '允許由電腦控制裝置',
85+
fullscreen: '全螢幕顯示',
86+
border: '顯示邊框',
87+
touch: '顯示點擊位置',
88+
render: '渲染所有幀會增加延遲',
89+
screen: '開啟螢幕投影時關閉裝置螢幕',
90+
awake: {
91+
tooltip: '關閉鎖屏前須打開電腦控制選項',
92+
content: '關閉螢幕鎖定'
93+
},
94+
auto: '自動打開新連接的裝置',
95+
hidden: {
96+
tooltip: '需要重新啟動應用才會生效',
97+
content: '退出後隐藏到系统欄'
98+
}
99+
},
100+
button: {
101+
save: '保存目前配置',
102+
default: '恢復預設配置'
103+
},
104+
notify: {
105+
saveSuccess: '配置保存成功'
106+
}
107+
},
108+
management: {
109+
ip: {
110+
tip: '裝置區域連線 IP 地址',
111+
remove: '删除',
112+
connect: '開啟無線連接'
113+
},
114+
devices: {
115+
name: '名稱',
116+
edit: '點擊即可修改',
117+
method: {
118+
label: '連接方式',
119+
wired: '有線',
120+
wireless: '無線'
121+
},
122+
operation: '操作',
123+
disconnect: '中斷連接'
124+
},
125+
button: {
126+
open: '開啟選中裝置的投影'
127+
},
128+
whenEmpty: '暫時沒有裝置連接',
129+
notify: {
130+
firstLoad: '正在載入裝置',
131+
reduceDevices: '裝置發生變動',
132+
newDevices: '偵測到新裝置',
133+
open: '已成功開啟 {name}'
134+
},
135+
open: {
136+
loading: '正在啟動投影,請稍候...',
137+
success: '{name} 已正常關閉',
138+
error: `{name} 開啟失敗,請您仔細確認以下項目:
139+
<p>1. scrcpy 是否配置正確</p>
140+
<p>2. scrcpy-gui 本應用是否設置為以系統管理員身分啟動</p>
141+
<p>3. scrcpy 命令行是否可以開啟裝置</p>
142+
<p>4. 執行\`adb-devices\`命令 查看是否出現裝置</p>
143+
<p>5. 手机是否開啟偵錯選項</p>
144+
如以上皆配置正常,請您到原作者Github提出issue,以協助解决。`
145+
},
146+
connect: {
147+
error: {
148+
ip: '請輸入正確的 IP 地址',
149+
exist: '{name} 已經連接'
150+
},
151+
loading: '正在啟動無線連接...',
152+
success: '已成功開啟無線連接',
153+
fail: '開啟無線連接失敗'
154+
},
155+
disconnect: {
156+
success: '{name} 已中斷連接'
157+
},
158+
error: {
159+
unknownScrcpyPathException: 'Scrcpy 資料夾路徑配置錯誤,請確認該資料夾中存在`scrcpy.exe`'
160+
}
161+
},
162+
titleBar: {
163+
document: '使用說明',
164+
checkForUpdates: '檢查更新',
165+
feedback: '回報與建議',
166+
switchLanguage: '切換語言',
167+
about: '關於'
168+
},
169+
tray: {
170+
hide: '隐藏',
171+
exit: '退出'
172+
}
173+
}

src/renderer/main.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@ import ElementUI from 'element-ui'
66
import 'element-ui/lib/theme-chalk/index.css'
77
import locale from 'element-ui/lib/locale'
88
import _en from 'element-ui/lib/locale/lang/en'
9-
import _zh from 'element-ui/lib/locale/lang/zh-CN'
9+
import _zhCN from 'element-ui/lib/locale/lang/zh-CN'
10+
import _zhTW from 'element-ui/lib/locale/lang/zh-TW'
1011

11-
const lang = localStorage.getItem('lang') || 'zh'
12-
locale.use(lang === 'en' ? _en : _zh)
12+
const lang = localStorage.getItem('lang') || 'zhCN'
13+
locale.use(lang === 'en' ? _en : _zhCN)
1314

1415
Vue.use(ElementUI)
1516

16-
import { en, zh } from './lang'
17+
import { en, zhCN, zhTW } from './lang'
1718
import VueI18n from 'vue-i18n'
1819
Vue.use(VueI18n)
1920

2021
const i18n = new VueI18n({
21-
locale: (localStorage.getItem('lang') || 'zh'),
22-
messages: { zh, en }
22+
locale: (localStorage.getItem('lang') || 'zhCN'),
23+
messages: { zhCN, zhTW, en }
2324
})
2425

2526

0 commit comments

Comments
 (0)