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 0edbbcb
Show file tree
Hide file tree
Showing 27 changed files with 220 additions and 14 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
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
2 changes: 2 additions & 0 deletions src/lib/i18n/de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "Um",
"COPYRIGHT": "Copyright(C) DC. Alle Rechte vorbehalten.",
"DEVELOPED_BY": "Entwickelt von 0-don. Unterstützt von Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "Derzeit keine Updates verfügbar",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "Maximale RTF-Größe",
"MAX_TEXT_SIZE": "Maximale Textgröße"
},
"SETTINGS": "Einstellungen",
"TAB": {
"BACKUP": "Sicherung",
"GENERAL": "Allgemein",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "About",
"COPYRIGHT": "Copyright(C) DC. All right reserved.",
"DEVELOPED_BY": "Developed by 0-don. Powered by Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "No updates currently available",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "Max Rtf size",
"MAX_TEXT_SIZE": "Max Text size"
},
"SETTINGS": "Settings",
"TAB": {
"BACKUP": "Backup",
"GENERAL": "General",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/es.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "Acerca de",
"COPYRIGHT": "Copyright(C) DC. Todos los derechos reservados.",
"DEVELOPED_BY": "Desarrollado por 0-don. Con tecnología de Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "No hay actualizaciones disponibles actualmente",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "Tamaño máximo de Rtf",
"MAX_TEXT_SIZE": "Tamaño máximo del texto"
},
"SETTINGS": "Ajustes",
"TAB": {
"BACKUP": "Respaldo",
"GENERAL": "General",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "À propos",
"COPYRIGHT": "Copyright (C) DC. Tous droits réservés.",
"DEVELOPED_BY": "Développé par 0-don. Propulsé par Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "Aucune mise à jour disponible actuellement",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "Taille maximale du fichier RTF",
"MAX_TEXT_SIZE": "Taille maximale du texte"
},
"SETTINGS": "Paramètres",
"TAB": {
"BACKUP": "Sauvegarde",
"GENERAL": "Général",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/hi.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "के बारे में",
"COPYRIGHT": "कॉपीराइट(सी) डीसी. सभी अधिकार सुरक्षित.",
"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/it.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ABOUT": {
"ABOUT": "Di",
"COPYRIGHT": "Copyright(C) DC. Tutti i diritti riservati.",
"DEVELOPED_BY": "Sviluppato da 0-don con Tauri.",
"NO_UPDATES_CURRENTLY_AVAILABLE": "Questa versione è aggiornata",
Expand Down Expand Up @@ -131,6 +132,7 @@
"MAX_RTF_SIZE": "Dimensione massima RTF",
"MAX_TEXT_SIZE": "Dimensione massima testo"
},
"SETTINGS": "Impostazioni",
"TAB": {
"BACKUP": "Backup",
"GENERAL": "Generale",
Expand Down
Loading

0 comments on commit 0edbbcb

Please sign in to comment.