Skip to content

Commit ef7d12a

Browse files
authored
Merge pull request #104 from MrXiaoM/desktop-i18n
add Simplified Chinese for desktop app
2 parents e5db732 + 9dc2e1c commit ef7d12a

File tree

5 files changed

+133
-28
lines changed

5 files changed

+133
-28
lines changed

RustApp/i18n/en/android_mic.ftl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,58 @@
11
audio_device = Audio Device
22
settings = Settings
3+
network_adapter = Network adapter
34
connection = Connection
5+
connection_tcp = WIFI / LAN (TCP)
6+
connection_udp = WIFI / LAN (UDP)
7+
connection_usb = USB Serial
8+
connection_adb = USB Adb
49
none = None
510
11+
tray_show_window = Show Window
12+
tray_connect = Connect
13+
tray_disconnect = Disconnect
14+
tray_exit = Exit
15+
minimized_to_tray = Application is minimized to system tray
16+
17+
state_disconnected = Disconnected
18+
state_listening = Listening
19+
state_connected = Connected
20+
621
connect = Connect
722
listening = Listening...
823
disconnect = Disconnect
924
waiting = Waiting...
1025
26+
title_audio_format = Audio format
1127
sample_rate = Sample rate
1228
channel_count = Channel count
1329
audio_format = Audio format
30+
use_recommended_audio_format = Use Recommended Audio Format
31+
1432
denoise = Noise reduction
33+
denoise_enabled = Enabled
34+
denoise_type = Type
35+
36+
voice_activity_detection = Voice Activity Detection (VAD)
37+
voice_activity_detection_enabled = Enabled
38+
39+
gain_control = Gain Control
40+
auto_gain_control = Automatic Gain Control (AGC)
41+
42+
dereverberation = Dereverberation
43+
dereverberation_enabled = Enabled
44+
45+
reset_denoise_settings = Reset Denoise Settings
46+
47+
title_app = App
1548
1649
start_at_login = Start at login
1750
auto_connect = Auto connect
1851
theme = Theme
1952
amplify = Amplify
2053
2154
about = About
55+
about_open = open
2256
repository = Repository
2357
issues_tracker = Report an Issue
2458

RustApp/i18n/zh-CN/android_mic.ftl

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
audio_device = 音频设备
2+
settings = 设置
3+
network_adapter = 网络适配器
4+
connection = 建立连接
5+
connection_tcp = WIFI / 局域网 (TCP)
6+
connection_udp = WIFI / 局域网 (UDP)
7+
connection_usb = USB 串口
8+
connection_adb = USB Adb
9+
none =
10+
11+
tray_show_window = 显示窗口
12+
tray_connect = 连接
13+
tray_disconnect = 断开连接
14+
tray_exit = 退出
15+
minimized_to_tray = 应用程序已最小化到系统托盘
16+
17+
state_disconnected = 已断开连接
18+
state_listening = 正在监听
19+
state_connected = 已连接
20+
21+
connect = 连接
22+
listening = 正在监听...
23+
disconnect = 断开连接
24+
waiting = 正在等待...
25+
26+
title_audio_format = 音频格式
27+
sample_rate = 采样率
28+
channel_count = 通道数量
29+
audio_format = 音频格式
30+
use_recommended_audio_format = 使用推荐的音频格式
31+
32+
denoise = 降噪
33+
denoise_enabled = 启用
34+
denoise_type = 类型
35+
36+
voice_activity_detection = 语音活动检测 (VAD)
37+
voice_activity_detection_enabled = 启用
38+
39+
gain_control = 增益控制
40+
auto_gain_control = 自动增益控制 (AGC)
41+
42+
dereverberation = 去混响
43+
dereverberation_enabled = 启用
44+
45+
reset_denoise_settings = 重置降噪设置
46+
47+
title_app = 应用程序
48+
49+
start_at_login = 开机启动
50+
auto_connect = 自动连接
51+
theme = 主题
52+
amplify = 放大
53+
54+
about = 关于
55+
about_open = 打开
56+
repository = 开源仓库
57+
issues_tracker = 报告问题
58+
59+
main_window_title = AndroidMic
60+
settings_window_title = 设置
61+
62+
system_theme = 跟随系统
63+
dark_theme = 暗色
64+
light_theme = 亮色
65+
hight_contrast_dark_theme = 高对比度暗色
66+
hight_contrast_light_theme = 高对比度亮色
67+
68+
mono = 单声道
69+
stereo = 立体声
70+
71+
clear_logs = 清空日志

RustApp/src/ui/app.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl AppState {
232232
self.audio_wave.clear();
233233

234234
if let Some(system_tray) = self.system_tray.as_mut() {
235-
system_tray.update_menu_state(true, "Disconnected");
235+
system_tray.update_menu_state(true, &fl!("state_disconnected"));
236236
}
237237

238238
Task::none()
@@ -321,7 +321,7 @@ impl Application for AppState {
321321
// initialize system tray
322322
let (system_tray, system_tray_stream) = match SystemTray::new() {
323323
Ok((mut tray, stream)) => {
324-
tray.update_menu_state(true, "Disconnected");
324+
tray.update_menu_state(true, &fl!("state_disconnected"));
325325
(Some(tray), Some(stream))
326326
}
327327
Err(e) => {
@@ -419,7 +419,7 @@ impl Application for AppState {
419419
}
420420
StreamerMsg::Listening { ip, port } => {
421421
if let Some(system_tray) = self.system_tray.as_mut() {
422-
system_tray.update_menu_state(false, "Listening");
422+
system_tray.update_menu_state(false, &fl!("state_listening"));
423423
}
424424

425425
if self.main_window.is_none() {
@@ -447,7 +447,7 @@ impl Application for AppState {
447447
}
448448
StreamerMsg::Connected { ip, port } => {
449449
if let Some(system_tray) = self.system_tray.as_mut() {
450-
system_tray.update_menu_state(false, "Connected");
450+
system_tray.update_menu_state(false, &fl!("state_connected"));
451451
}
452452

453453
if self.main_window.is_none() {
@@ -679,7 +679,7 @@ impl Application for AppState {
679679

680680
let _ = Notification::new()
681681
.summary("AndroidMic")
682-
.body("Application is minimized to system tray")
682+
.body(&fl!("minimized_to_tray"))
683683
.auto_icon()
684684
.show()
685685
.map_err(|e| {

RustApp/src/ui/tray.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use tray_icon::{
77
menu::{Menu, MenuEvent, MenuItem, PredefinedMenuItem},
88
};
99

10-
use crate::tray_icon;
10+
use crate::{fl, tray_icon};
1111

1212
#[derive(Debug, Clone)]
1313
pub enum SystemTrayMsg {
@@ -30,10 +30,10 @@ pub struct SystemTray {
3030

3131
impl SystemTray {
3232
pub fn new() -> anyhow::Result<(Self, SystemTrayStream)> {
33-
let item_show = MenuItem::new("Show Window", true, None);
34-
let item_connect = MenuItem::new("Connect", true, None);
35-
let item_disconnect = MenuItem::new("Disconnect", true, None);
36-
let item_exit = MenuItem::new("Exit", true, None);
33+
let item_show = MenuItem::new(fl!("tray_show_window"), true, None);
34+
let item_connect = MenuItem::new(fl!("tray_connect"), true, None);
35+
let item_disconnect = MenuItem::new(fl!("tray_disconnect"), true, None);
36+
let item_exit = MenuItem::new(fl!("tray_exit"), true, None);
3737

3838
let item_show_id = item_show.id().clone();
3939
let item_connect_id = item_connect.id().clone();

RustApp/src/ui/view.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn network_adapter(app: &AppState) -> Element<'_, AppMsg> {
134134
column()
135135
.spacing(20)
136136
.align_x(Horizontal::Center)
137-
.push(text::title4("Network Adapter"))
137+
.push(text::title4(fl!("network_adapter")))
138138
.push(
139139
row()
140140
.width(Length::Fill)
@@ -168,13 +168,13 @@ fn connection_type(app: &AppState) -> Element<'_, AppMsg> {
168168
.push(
169169
column()
170170
.push(radio(
171-
"WIFI / LAN (TCP)",
171+
text(fl!("connection_tcp")),
172172
&ConnectionMode::Tcp,
173173
Some(connection_mode),
174174
|mode| AppMsg::ChangeConnectionMode(*mode),
175175
))
176176
.push(radio(
177-
"WIFI / LAN (UDP)",
177+
text(fl!("connection_udp")),
178178
&ConnectionMode::Udp,
179179
Some(connection_mode),
180180
|mode| AppMsg::ChangeConnectionMode(*mode),
@@ -183,7 +183,7 @@ fn connection_type(app: &AppState) -> Element<'_, AppMsg> {
183183
#[cfg(feature = "usb")]
184184
{
185185
Some(radio(
186-
"USB Serial",
186+
text(fl!("connection_usb")),
187187
&ConnectionMode::Usb,
188188
Some(connection_mode),
189189
|mode| AppMsg::ChangeConnectionMode(*mode),
@@ -199,7 +199,7 @@ fn connection_type(app: &AppState) -> Element<'_, AppMsg> {
199199
#[cfg(feature = "adb")]
200200
{
201201
Some(radio(
202-
"USB Adb",
202+
text(fl!("connection_adb")),
203203
&ConnectionMode::Adb,
204204
Some(connection_mode),
205205
|mode| AppMsg::ChangeConnectionMode(*mode),
@@ -235,7 +235,7 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
235235
.spacing(20)
236236
.push(
237237
settings::section()
238-
.title("Audio format")
238+
.title(fl!("title_audio_format"))
239239
.add(
240240
row()
241241
.align_y(Vertical::Center)
@@ -273,7 +273,7 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
273273
row()
274274
.push(horizontal_space())
275275
.push(
276-
button::text("Use Recommended Audio Format")
276+
button::text(fl!("use_recommended_audio_format"))
277277
.on_press(ConfigMsg::UseRecommendedFormat),
278278
)
279279
.push(horizontal_space()),
@@ -285,14 +285,14 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
285285
.add(
286286
row()
287287
.align_y(Vertical::Center)
288-
.push(text("Enabled"))
288+
.push(text(fl!("denoise_enabled")))
289289
.push(horizontal_space())
290290
.push(toggler(config.denoise).on_toggle(ConfigMsg::DeNoise)),
291291
)
292292
.add_maybe((config.denoise).then(|| {
293293
row()
294294
.align_y(Vertical::Center)
295-
.push(text("Type"))
295+
.push(text(fl!("denoise_type")))
296296
.push(horizontal_space())
297297
.push(pick_list(
298298
DenoiseKind::VALUES,
@@ -321,11 +321,11 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
321321
)
322322
.push(
323323
settings::section()
324-
.title("Voice Activity Detection (VAD)")
324+
.title(fl!("voice_activity_detection"))
325325
.add(
326326
row()
327327
.align_y(Vertical::Center)
328-
.push(text("Enabled"))
328+
.push(text(fl!("voice_activity_detection_enabled")))
329329
.push(horizontal_space())
330330
.push(
331331
toggler(config.speex_vad_enabled)
@@ -349,11 +349,11 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
349349
)
350350
.push(
351351
settings::section()
352-
.title("Gain Control")
352+
.title(fl!("gain_control"))
353353
.add(
354354
row()
355355
.align_y(Vertical::Center)
356-
.push(text("Automatic Gain Control (AGC)"))
356+
.push(text(fl!("auto_gain_control")))
357357
.push(horizontal_space())
358358
.push(
359359
toggler(config.speex_agc_enabled)
@@ -398,11 +398,11 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
398398
)
399399
.push(
400400
settings::section()
401-
.title("Dereverberation")
401+
.title(fl!("dereverberation"))
402402
.add(
403403
row()
404404
.align_y(Vertical::Center)
405-
.push(text("Enabled"))
405+
.push(text(fl!("dereverberation_enabled")))
406406
.push(horizontal_space())
407407
.push(
408408
toggler(config.speex_dereverb_enabled)
@@ -424,10 +424,10 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
424424
)
425425
})),
426426
)
427-
.push(button::text("Reset Denoise Settings").on_press(ConfigMsg::ResetDenoiseSettings))
427+
.push(button::text(fl!("reset_denoise_settings")).on_press(ConfigMsg::ResetDenoiseSettings))
428428
.push(
429429
settings::section()
430-
.title("App")
430+
.title(fl!("title_app"))
431431
.add_maybe(if cfg!(target_os = "windows") {
432432
Some(
433433
row()
@@ -462,7 +462,7 @@ pub fn settings_window(app: &AppState) -> Element<'_, ConfigMsg> {
462462
)
463463
.add(
464464
widget::settings::item::builder(fl!("about"))
465-
.control(button::text("open").on_press(ConfigMsg::ToggleAboutWindow)),
465+
.control(button::text(fl!("about_open")).on_press(ConfigMsg::ToggleAboutWindow)),
466466
),
467467
),
468468
)

0 commit comments

Comments
 (0)