Skip to content

Commit

Permalink
add translations for about and settings window titles
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Dec 26, 2024
1 parent e245222 commit 5c062fd
Show file tree
Hide file tree
Showing 28 changed files with 365 additions and 154 deletions.
166 changes: 166 additions & 0 deletions project.inlang/clippy.babel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,89 @@
<folder_node>
<name>ABOUT</name>
<children>
<concept_node>
<name>ABOUT</name>
<description/>
<comment/>
<translations>
<translation>
<language>ar-SA</language>
<approved>false</approved>
</translation>
<translation>
<language>bn-IN</language>
<approved>false</approved>
</translation>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>hi-IN</language>
<approved>false</approved>
</translation>
<translation>
<language>it-IT</language>
<approved>false</approved>
</translation>
<translation>
<language>ja-JP</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
<translation>
<language>nl-NL</language>
<approved>false</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-PT</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>th-TH</language>
<approved>false</approved>
</translation>
<translation>
<language>tr-TR</language>
<approved>false</approved>
</translation>
<translation>
<language>ur-PK</language>
<approved>false</approved>
</translation>
<translation>
<language>vi-VN</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CN</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>COPYRIGHT</name>
<description/>
Expand Down Expand Up @@ -8963,6 +9046,89 @@
</concept_node>
</children>
</folder_node>
<concept_node>
<name>SETTINGS</name>
<description/>
<comment/>
<translations>
<translation>
<language>ar-SA</language>
<approved>false</approved>
</translation>
<translation>
<language>bn-IN</language>
<approved>false</approved>
</translation>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>hi-IN</language>
<approved>false</approved>
</translation>
<translation>
<language>it-IT</language>
<approved>false</approved>
</translation>
<translation>
<language>ja-JP</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
<translation>
<language>nl-NL</language>
<approved>false</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-PT</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>th-TH</language>
<approved>false</approved>
</translation>
<translation>
<language>tr-TR</language>
<approved>false</approved>
</translation>
<translation>
<language>ur-PK</language>
<approved>false</approved>
</translation>
<translation>
<language>vi-VN</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CN</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<folder_node>
<name>TAB</name>
<children>
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/commands/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use tauri::AppHandle;
use tauri_plugin_opener::OpenerExt;

#[tauri::command]
pub async fn open_new_window(window_name: WebWindow) {
open_window(window_name).await;
pub async fn open_new_window(window_name: WebWindow, title: Option<String>) {
open_window(window_name, title).await;
}

#[tauri::command]
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/events/hotkey_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub async fn parse_hotkey_event(key: &Key) {
window.to_string().to_lowercase() == e.to_string().to_lowercase()
})
.expect("Failed to find window"),
None,
)
.await
}
Expand Down
14 changes: 7 additions & 7 deletions src-tauri/src/service/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub fn calculate_thumbnail_dimensions(width: u32, height: u32) -> (u32, u32) {
}
}

pub async fn create_about_window() {
pub async fn create_about_window(title: Option<String>) {
let app = crate::service::global::get_app();

// Close existing window if it exists
Expand All @@ -213,7 +213,7 @@ pub async fn create_about_window() {
WebWindow::About.to_string().as_str(),
WebviewUrl::App("pages/about.html".into()),
)
.title("About")
.title(title.unwrap_or_else(|| "About".to_string()))
.inner_size(ABOUT_WINDOW_X as f64, ABOUT_WINDOW_Y as f64)
.always_on_top(true)
.build()
Expand All @@ -224,7 +224,7 @@ pub async fn create_about_window() {
.expect("Failed to set window size");
}

pub async fn create_settings_window() {
pub async fn create_settings_window(title: Option<String>) {
let app = crate::service::global::get_app();

// Close existing window if it exists
Expand All @@ -238,7 +238,7 @@ pub async fn create_settings_window() {
WebWindow::Settings.to_string().as_str(),
WebviewUrl::App("pages/settings.html".into()),
)
.title("Settings")
.title(title.unwrap_or_else(|| "Settings".to_string()))
.inner_size(SETTINGS_WINDOW_X as f64, SETTINGS_WINDOW_Y as f64)
.always_on_top(true)
.build()
Expand All @@ -249,10 +249,10 @@ pub async fn create_settings_window() {
.expect("Failed to set window size");
}

pub async fn open_window(window_name: WebWindow) {
pub async fn open_window(window_name: WebWindow, title: Option<String>) {
match window_name {
WebWindow::About => create_about_window().await,
WebWindow::Settings => create_settings_window().await,
WebWindow::About => create_about_window(title).await,
WebWindow::Settings => create_settings_window(title).await,
_ => {}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
},
"bundle": {
"active": true,
"license": "MIT",
"shortDescription": "A clipboard manager",
"longDescription": "A clipboard manager built with Rust & Typescript",
"category": "Utility",
"copyright": "Copyright (c) 2024",
"targets": ["app", "deb", "rpm", "dmg", "appimage", "nsis"],
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
"linux": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/app/view-more.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export const ViewMore: Component<ViewMoreProps> = ({}) => {
{/* Sync Clipboard History */}
{createButton("MAIN.HOTKEY.SYNC_CLIPBOARD_HISTORY", SettingsStore.syncClipboard)}
{/* Settings */}
{createButton("MAIN.HOTKEY.SETTINGS", () => SettingsStore.openWindow(WebWindow.Settings))}
{createButton("MAIN.HOTKEY.SETTINGS", () => SettingsStore.openWindow(WebWindow.Settings, t("SETTINGS.SETTINGS")))}
{/* About */}
{createButton("MAIN.HOTKEY.ABOUT", () => SettingsStore.openWindow(WebWindow.About))}
{createButton("MAIN.HOTKEY.ABOUT", () => SettingsStore.openWindow(WebWindow.About, t("ABOUT.ABOUT")))}
{/* Exit */}
{createButton("MAIN.HOTKEY.EXIT", SettingsStore.exitApp)}
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/settings/settings-general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const SettingsGeneral: Component<SettingsGeneralProps> = ({}) => {
...SettingsStore.settings()!,
display_scale: Number(parseFloat(e.target.value).toFixed(2)),
});
await invokeCommand(InvokeCommand.OpenNewWindow, { windowName: WebWindow.Settings });
await invokeCommand(InvokeCommand.OpenNewWindow, { windowName: WebWindow.Settings, title: "Settings" });
}}
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/ar.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "عن",
"COPYRIGHT": "جميع الحقوق محفوظة لشركة DC.",
"DEVELOPED_BY": "تم تطويره بواسطة 0-don. مدعوم بواسطة Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "لا توجد تحديثات متاحة حاليًا",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "الحد الأقصى لحجم RTF",
"MAX_TEXT_SIZE": "الحد الأقصى لحجم النص"
},
"SETTINGS": "إعدادات",
"TAB": {
"BACKUP": "دعم",
"GENERAL": "عام",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/bn.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "সম্পর্কে",
"COPYRIGHT": "কপিরাইট(C) ডিসি। সব অধিকার সংরক্ষিত.",
"DEVELOPED_BY": "0-ডন দ্বারা বিকাশিত। তৌরি দ্বারা চালিত.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "কোন আপডেট বর্তমানে উপলব্ধ",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "সর্বোচ্চ Rtf আকার",
"MAX_TEXT_SIZE": "সর্বাধিক পাঠ্য আকার"
},
"SETTINGS": "সেটিংস",
"TAB": {
"BACKUP": "ব্যাকআপ",
"GENERAL": "সাধারণ",
Expand Down
Loading

0 comments on commit 5c062fd

Please sign in to comment.