-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from alley-rs/0.1.X
feat: support Engligh
- Loading branch information
Showing
27 changed files
with
420 additions
and
72 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use super::Translations; | ||
|
||
pub(super) const EN_US: &Translations = &Translations { | ||
window_title: "Fluxy", | ||
dark_mode_tooltip: "Switch to Light Mode", | ||
light_mode_tooltip: "Switch to Dark Mode", | ||
about_button_tooltip: "About and Help", | ||
about_dialog_github_tooltip: "Visit Official Website", | ||
about_dialog_feedback_tooltip: "Provide Feedback or Get Help", | ||
home_label_text: "Select Transfer Method", | ||
home_button_text: "Back to Home", | ||
home_receive_button_text: "Receive", | ||
home_send_button_text: "Send", | ||
qrcode_page_title: "Scan to Connect", | ||
qrcode_page_url_label: "Or visit in another computer's browser", | ||
qrcode_page_url_tooltip: "Copy Link to Clipboard", | ||
qrcode_page_url_copied_message: "Link Copied", | ||
qrcode_page_toast_message: "Please scan this QR code with your phone", | ||
ok_button_text: "Confirm", | ||
clear_button_text: "Clear File List", | ||
send_page_title: "Send Files", | ||
send_page_empty_drop_description: "Drag files here", | ||
send_page_drop_description: "You can continue dragging more files", | ||
list_item_file_size_label: "Size", | ||
list_item_file_type_label: "Type", | ||
send_page_list_item_tooltip: "Click to Preview File", | ||
receive_page_empty_description: "Please upload files from your phone or another computer", | ||
receive_page_list_item_tooltip: "Click to Open File with Default Program", | ||
receive_page_dropdown_open_button_label: "Open", | ||
receive_page_dropdown_pick_button_label: "Change", | ||
receive_page_directory_path_label: "Save Directory", | ||
receive_page_directory_path_tooltip: "Click to Open Directory in File Explorer", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use std::{collections::HashMap, sync::LazyLock}; | ||
|
||
use serde::Serialize; | ||
|
||
mod en_us; | ||
mod zh_cn; | ||
|
||
pub static LOCALES: LazyLock<HashMap<&'static Locale, &Translations>> = LazyLock::new(|| { | ||
[(&Locale::ZhCN, zh_cn::ZH_CN), (&Locale::EnUS, en_us::EN_US)] | ||
.iter() | ||
.copied() | ||
.collect() | ||
}); | ||
|
||
#[derive(PartialEq, Eq, Hash)] | ||
pub enum Locale { | ||
ZhCN, | ||
EnUS, | ||
} | ||
|
||
impl From<String> for Locale { | ||
fn from(value: String) -> Self { | ||
match value.as_ref() { | ||
"zh-CNa" => Self::ZhCN, | ||
_ => Self::EnUS, | ||
} | ||
} | ||
} | ||
|
||
#[derive(PartialEq, Eq, Hash, Serialize)] | ||
pub struct Translations { | ||
pub window_title: &'static str, | ||
pub dark_mode_tooltip: &'static str, | ||
pub light_mode_tooltip: &'static str, | ||
pub about_button_tooltip: &'static str, | ||
pub about_dialog_github_tooltip: &'static str, | ||
pub about_dialog_feedback_tooltip: &'static str, | ||
pub home_label_text: &'static str, | ||
pub home_button_text: &'static str, | ||
pub home_send_button_text: &'static str, | ||
pub home_receive_button_text: &'static str, | ||
pub qrcode_page_title: &'static str, | ||
pub qrcode_page_url_label: &'static str, | ||
pub qrcode_page_url_tooltip: &'static str, | ||
pub qrcode_page_url_copied_message: &'static str, | ||
pub qrcode_page_toast_message: &'static str, | ||
pub ok_button_text: &'static str, | ||
pub clear_button_text: &'static str, | ||
pub send_page_title: &'static str, | ||
pub send_page_empty_drop_description: &'static str, | ||
pub send_page_drop_description: &'static str, | ||
pub list_item_file_size_label: &'static str, | ||
pub list_item_file_type_label: &'static str, | ||
pub send_page_list_item_tooltip: &'static str, | ||
pub receive_page_empty_description: &'static str, | ||
pub receive_page_list_item_tooltip: &'static str, | ||
pub receive_page_dropdown_open_button_label: &'static str, | ||
pub receive_page_dropdown_pick_button_label: &'static str, | ||
pub receive_page_directory_path_label: &'static str, | ||
pub receive_page_directory_path_tooltip: &'static str, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use super::Translations; | ||
|
||
pub(super) const ZH_CN: &Translations = &Translations { | ||
window_title: "小路速传", | ||
dark_mode_tooltip: "切换为亮色", | ||
light_mode_tooltip: "切换为暗色", | ||
about_button_tooltip: "关于和帮助", | ||
about_dialog_github_tooltip: "访问官网", | ||
about_dialog_feedback_tooltip: "反馈问题或寻求帮助", | ||
home_label_text: "选择传输方式", | ||
home_button_text: "回到主页", | ||
home_receive_button_text: "接收", | ||
home_send_button_text: "发送", | ||
qrcode_page_title: "扫码连接", | ||
qrcode_page_url_label: "或在另一台电脑中通过浏览器中访问", | ||
qrcode_page_url_tooltip: "复制链接到剪贴板", | ||
qrcode_page_url_copied_message: "已复制链接", | ||
qrcode_page_toast_message: "请使用手机扫描此二维码", | ||
ok_button_text: "确认", | ||
clear_button_text: "清空文件列表", | ||
send_page_title: "发送文件", | ||
send_page_empty_drop_description: "将文件拖到此处", | ||
send_page_drop_description: "可继续拖入文件", | ||
list_item_file_size_label: "大小", | ||
list_item_file_type_label: "类型", | ||
send_page_list_item_tooltip: "单击预览文件", | ||
receive_page_empty_description: "请在手机端或者另一台电脑中上传文件", | ||
receive_page_list_item_tooltip: "单击使用默认程序打开此文件", | ||
receive_page_dropdown_open_button_label: "打开", | ||
receive_page_dropdown_pick_button_label: "修改", | ||
receive_page_directory_path_label: "保存目录", | ||
receive_page_directory_path_tooltip: "单击在文件管理器中打开此目录", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.