diff --git a/resources/fonts/full/subset_characters.txt b/resources/fonts/full/subset_characters.txt index 1e4b25df..4eb941ed 100644 --- a/resources/fonts/full/subset_characters.txt +++ b/resources/fonts/full/subset_characters.txt @@ -94,6 +94,7 @@ z } ¡ ¿ +Ä Ê Î Ö @@ -103,6 +104,7 @@ z â ã ä +å ç è é diff --git a/resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf b/resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf index a9fd2095..353a34a5 100644 Binary files a/resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf and b/resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf differ diff --git a/resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf b/resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf index a2561165..d4578954 100644 Binary files a/resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf and b/resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf differ diff --git a/src/gui/components/radio.rs b/src/gui/components/radio.rs index b6aa6a10..2be2fbff 100644 --- a/src/gui/components/radio.rs +++ b/src/gui/components/radio.rs @@ -13,7 +13,7 @@ use crate::notifications::types::sound::Sound; use crate::translations::translations::{ ip_version_translation, sound_translation, transport_protocol_translation, }; -use crate::utils::countries::get_flag_from_language_code; +use crate::utils::countries::get_flag_from_language; use crate::{ChartType, IpVersion, Language, StyleType, TransProtocol}; pub fn ip_version_radios( @@ -83,29 +83,33 @@ pub fn language_radios( collection: &[Language], font: Font, style: StyleType, -) -> Column<'static, Message> { - let mut ret_val = Column::new().spacing(10); +) -> Row<'static, Message> { + let mut ret_val = Row::new().spacing(10); for option in collection { ret_val = ret_val.push( - Row::new() - .align_items(Alignment::Center) - .push( - Radio::new( - format!("{} ({:?})", option.get_radio_label(), option), - *option, - Some(active), - Message::LanguageSelection, + Row::new().align_items(Alignment::Center).push( + Row::new() + .width(Length::Fixed(180.0)) + .push( + Radio::new( + format!("{} ({:?})", option.get_radio_label(), option), + *option, + Some(active), + Message::LanguageSelection, + ) + .spacing(7) + .font(font) + .size(15) + .style( + >::into(StyleTuple( + style, + ElementType::Standard, + )), + ), ) - .spacing(7) - .font(font) - .size(15) - .style(>::into(StyleTuple( - style, - ElementType::Standard, - ))), - ) - .push(horizontal_space(Length::Fixed(8.0))) - .push(get_flag_from_language_code(&format!("{option:?}"))), + .push(horizontal_space(Length::Fixed(8.0))) + .push(get_flag_from_language(*option)), + ), ); } ret_val diff --git a/src/gui/pages/initial_page.rs b/src/gui/pages/initial_page.rs index 1d0f2c36..f404a389 100644 --- a/src/gui/pages/initial_page.rs +++ b/src/gui/pages/initial_page.rs @@ -33,7 +33,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container { let col_ip_radio = ip_version_radios(ip_active, font, sniffer.style, sniffer.language); let col_ip = Column::new() .spacing(10) - .width(FillPortion(1)) + .width(FillPortion(5)) .push(col_ip_radio); let transport_active = sniffer.filters.transport; @@ -42,7 +42,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container { let col_transport = Column::new() .align_items(Alignment::Center) .spacing(10) - .width(FillPortion(2)) + .width(FillPortion(9)) .push(col_transport_radio) .push(vertical_space(FillPortion(2))) .push(button_start(sniffer.style, sniffer.language)) @@ -67,7 +67,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container { .font(font) .style(StyleTuple(sniffer.style, ElementType::Standard)); let col_app = Column::new() - .width(FillPortion(1)) + .width(FillPortion(8)) .spacing(10) .push( Text::new(application_protocol_translation(sniffer.language)) diff --git a/src/gui/pages/settings_language_page.rs b/src/gui/pages/settings_language_page.rs index 07655194..62aa2d87 100644 --- a/src/gui/pages/settings_language_page.rs +++ b/src/gui/pages/settings_language_page.rs @@ -1,4 +1,4 @@ -use iced::widget::{Column, Container, Row, Text}; +use iced::widget::{Column, Container, Text}; use iced::Length::Fixed; use iced::{Alignment, Length}; use iced_native::widget::vertical_space; @@ -18,17 +18,20 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container { let font = get_font(sniffer.style); let language_active = sniffer.language; - let col_language_radio_1 = - language_radios(language_active, &Language::COL1, font, sniffer.style); - let col_language_radio_2 = - language_radios(language_active, &Language::COL2, font, sniffer.style); - let col_language_radio_3 = - language_radios(language_active, &Language::COL3, font, sniffer.style); - let row_language_radio = Row::new() - .spacing(50) - .push(col_language_radio_1) - .push(col_language_radio_2) - .push(col_language_radio_3); + let row_language_radio_1 = + language_radios(language_active, &Language::ROW1, font, sniffer.style); + let row_language_radio_2 = + language_radios(language_active, &Language::ROW2, font, sniffer.style); + let row_language_radio_3 = + language_radios(language_active, &Language::ROW3, font, sniffer.style); + let row_language_radio_4 = + language_radios(language_active, &Language::ROW4, font, sniffer.style); + let col_language_radio_all = Column::new() + .spacing(20) + .push(row_language_radio_1) + .push(row_language_radio_2) + .push(row_language_radio_3) + .push(row_language_radio_4); let mut content = Column::new() .align_items(Alignment::Center) @@ -58,7 +61,7 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container { ) .push(vertical_space(Fixed(20.0))); - if ![Language::EN, Language::IT].contains(&sniffer.language) { + if ![Language::EN, Language::IT, Language::SV].contains(&sniffer.language) { content = content .push( Container::new( @@ -73,7 +76,7 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container { .push(vertical_space(Fixed(20.0))); } - content = content.push(row_language_radio); + content = content.push(col_language_radio_all); Container::new(content) .height(Fixed(400.0)) diff --git a/src/translations/translations.rs b/src/translations/translations.rs index 37020ed2..da0ae641 100644 --- a/src/translations/translations.rs +++ b/src/translations/translations.rs @@ -19,6 +19,7 @@ pub fn choose_adapters_translation(language: Language) -> Text<'static> { Language::PT => "Selecione o adaptador de rede a inspecionar", Language::EL => "Επίλεξε τον προσαρμογέα δικτύου για επιθεώρηση", Language::FA => "مبدل شبکه را برای بازرسی انتخاب کنید", + Language::SV => "Välj nätverksadapter att inspektera", }) } @@ -39,6 +40,7 @@ pub fn application_protocol_translation(language: Language) -> &'static str { Language::PT => "Protocolo de aplicação", Language::EL => "Πρωτόκολλο εφαρμογής", Language::FA => "پیوندنامهٔ درخواست", + Language::SV => "Applikationsprotokoll", } } @@ -59,6 +61,7 @@ pub fn select_filters_translation(language: Language) -> Text<'static> { Language::PT => "Selecione os filtros a serem aplicados no tráfego de rede", Language::EL => "Επίλεξε τα φίλτρα για εφαρμογή στην κίνηση του δικτύου", Language::FA => "صافی ها را جهت اعمال بر آمد و شد شبکه انتخاب کنید", + Language::SV => "Välj filtren som ska appliceras på nätverkstrafiken", }) } @@ -76,6 +79,7 @@ pub fn start_translation(language: Language) -> &'static str { Language::PT => "Começar!", Language::EL => "Ξεκίνα!", Language::FA => "شروع!", + Language::SV => "Starta!", } } @@ -94,6 +98,7 @@ pub fn address_translation(language: Language) -> &'static str { Language::PT => "Endereço", Language::EL => "Διεύθυνση", Language::FA => "نشانی", + Language::SV => "Adress", } } @@ -114,6 +119,7 @@ pub fn addresses_translation(language: Language) -> &'static str { Language::PT => "Endereços", Language::EL => "Διευθύνσεις", Language::FA => "نشانی ها", + Language::SV => "Adresser", } } @@ -134,6 +140,7 @@ pub fn ip_version_translation(language: Language) -> Text<'static> { Language::PT => "Versão de IP", Language::EL => "Έκδοση IP", Language::FA => "نسخهٔ IP", + Language::SV => "IP-version", }) } @@ -153,6 +160,7 @@ pub fn transport_protocol_translation(language: Language) -> &'static str { Language::RU => "Транспортный протокол", Language::EL => "Πρωτόκολλο μεταφοράς", Language::FA => "پیوندنامهٔ ترابرد", + Language::SV => "Transportprotokoll", } } @@ -173,6 +181,7 @@ pub fn traffic_rate_translation(language: Language) -> Text<'static> { Language::PT => "Taxa de tráfego", Language::EL => "Ρυθμός κίνησης", Language::FA => "نرخ آمد و شد", + Language::SV => "Datafrekvens", }) } @@ -193,6 +202,7 @@ pub fn traffic_rate_translation(language: Language) -> Text<'static> { // Language::PT => "Conexões relevantes:", // Language::EL => "Σχετικές συνδέσεις:", // Language::FA => "پیوند های خویشاوند:", +// Language::SE => "Relevanta anslutningar:", // }) // } @@ -213,6 +223,7 @@ pub fn settings_translation(language: Language) -> &'static str { Language::PT => "Configurações", Language::EL => "Ρυθμίσεις", Language::FA => "پیکربندی", + Language::SV => "Inställningar", } } @@ -223,7 +234,7 @@ pub fn yes_translation(language: Language) -> Text<'static> { Language::FR => "Oui", Language::ES => "Sí", Language::PL => "Tak", - Language::DE => "Ja", + Language::DE | Language::SV => "Ja", Language::UK => "Так", Language::ZH => "是", Language::RO => "Da", @@ -253,6 +264,7 @@ pub fn ask_quit_translation(language: Language) -> Text<'static> { Language::PT => "Tem a certeza que deseja sair desta análise?", Language::EL => "Είσαι σίγουρος ότι θες να κλείσεις την ανάλυση;", Language::FA => "آیا مطمئن هستید می خواهید از این تحلیل خارج شوید؟", + Language::SV => "Är du säker på att du vill avsluta analysen?", }) } @@ -273,6 +285,7 @@ pub fn quit_analysis_translation(language: Language) -> String { Language::PT => "Sair da análise".to_string(), Language::EL => "Έξοδος ανάλυσης".to_string(), Language::FA => "خروج از تحلیل".to_string(), + Language::SV => "Avsluta analys".to_string(), } } @@ -293,6 +306,7 @@ pub fn ask_clear_all_translation(language: Language) -> Text<'static> { Language::PT => "Tem a certeza que deseja eliminar as notificações?", Language::EL => "Είσαι σίγουρος ότι θες να κάνεις εκκαθάριση των ειδοποιήσεων;", Language::FA => "آیا مطمئن هستید می خواهید اعلان ها را پاک کنید؟", + Language::SV => "Är du säker på att du vill radera notifikationerna?", }) } @@ -313,6 +327,7 @@ pub fn clear_all_translation(language: Language) -> String { Language::PT => "Limpar tudo".to_string(), Language::EL => "Εκκαθάριση όλων".to_string(), Language::FA => "پاک کردن همه".to_string(), + Language::SV => "Radera alla".to_string(), } } @@ -333,6 +348,7 @@ pub fn hide_translation(language: Language) -> &'static str { Language::PT => "Esconder", Language::EL => "Κλείσιμο", Language::FA => "پنهان کردن", + Language::SV => "Göm", } } @@ -353,6 +369,7 @@ pub fn network_adapter_translation(language: Language) -> &'static str { Language::PT => "Adaptador de rede", Language::EL => "Προσαρμογέας δικτύου", Language::FA => "مبدل شبکه", + Language::SV => "Nätverksadapter", } } @@ -403,6 +420,9 @@ pub fn no_addresses_translation(language: Language, adapter: &str) -> Text<'stat Language::FA => format!("هیچ آمد و شدی قابل مشاهده نیست چون مبدلی که انتخاب کرده اید هیچ نشانی فعالی ندارد...\n\n\ مبدل شبکه: {adapter}\n\n\ اگر مطمئن هستید به اینترنت وصل هستید، سعی کنید مبدل متفاوتی را انتخاب کنید."), + Language::SV => format!("Det går inte att observa någon trafik eftersom den valda adaptern inte har några aktiva adresser ...\n\n\ + Nätverksadapter: {adapter}\n\n\ + Om du är säker att du är ansluten till internet, testa att välja en annan adapter."), }) } @@ -453,6 +473,9 @@ pub fn waiting_translation(language: Language, adapter: &str) -> Text<'static> { Language::FA => format!("هنوز هیچ آمد و شدی مشاهده نشده است. در حال انتظار برای بسته های شبکه...\n\n مبدل شبکه: {adapter}\n\n آیا مطمئن هستید به اینترنت وصل هستید و مبدل درست را انتخاب کرده اید؟"), + Language::SV => format!("Ingen trafik har observerats ännu. Väntar på paket ...\n\n\ + Nätverksadapter: {adapter}\n\n\ + Är du säker på att du är ansluten till internet och att du har valt rätt adapter?"), }) } @@ -478,7 +501,7 @@ pub fn some_observed_translation( Przefiltrowane pakiety: 0\n\n\ Niektóre pakiety zostały przechwycone, ale żaden nie został wybrany zgodnie z wskazanymi filtrami...\n\n{filters}"), Language::DE => format!("Anzahl der empfangenen Pakete: {observed}\n\n\ - gefilterte Pakete: 0\n\n\ + Gefilterte Pakete: 0\n\n\ Ein Paar Pakete wurden empfangen, aber es entsprechen noch keine den spezifizierten Filtern...\n\n{filters}"), Language::UK => format!("Сума перехоплених пакетів: {observed}\n\n\ Відфільтровані пакеті: 0\n\n\ @@ -507,6 +530,9 @@ pub fn some_observed_translation( Language::FA => format!("مجموع بسته های رهگیری شده: {observed}\n\n\ بسته های صاف شده: 0\n\n\ شماری از بسته ها رهگیری شده اند، ولی هنوز هیچ کدام بر اساس صافی تعیین شده شما انتخاب نشده اند...\n\n{filters}"), + Language::SV => format!("Antal fångade paket: {observed}\n\n\ + Filtrerade paket: 0\n\n\ + Några paket har fångats, men än har inget valts enligt de angivna filtren ...\n\n{filters}"), }) } @@ -527,6 +553,7 @@ pub fn filtered_packets_translation(language: Language) -> &'static str { Language::PT => "Pacotes filtrados", Language::EL => "Φιλτραρισμένα πακέτα", Language::FA => "بسته های صاف شده", + Language::SV => "Filtrerade paket", } } @@ -546,6 +573,7 @@ pub fn filtered_bytes_translation(language: Language) -> &'static str { Language::RU => "Отфильтровано байт", Language::EL => "Φιλτραρισμένα bytes", Language::FA => "بایت های صاف شده", + Language::SV => "Filtrerade bytes", } } @@ -580,6 +608,7 @@ pub fn of_total_translation(language: Language, percentage: &str) -> String { format!("({percentage} από τα συνολικά)") } Language::FA => format!("({percentage} از مجموع)"), + Language::SV => format!("({percentage} av totalen)"), } } @@ -600,6 +629,7 @@ pub fn of_total_translation(language: Language, percentage: &str) -> String { // Language::PT => "Pacotes filtrados por protocolo de aplicação:", // Language::EL => "Φιλτραρισμένα πακέτα ανά πρωτόκολλο εφαρμογής:", // Language::FA => "بسته های صاف شده برای هر پیوندنامهٔ درخواست:", +// Language::SE => "Filtrerade paket per applikationsprotokoll:", // }) // } @@ -635,6 +665,8 @@ pub fn of_total_translation(language: Language, percentage: &str) -> String { // Για να προσθέσεις μια σύνδεση στα αγαπημένα σου, κλίκαρε στο σύμβολο με το αστέρι δίπλα στη σύνδεση.", // Language::FA => "در حال حاضر هیچ چیزی برای نمایش نیست.\n\ // برای افزودن یک پیوند به پسندیده های خود، روی نشان ستاره کنار پیوند کلیک کنید.", +// Language::SE => "Inget att visa för tillfälet.\n\ +// För att lägga till anslutningar till dina favoriter, klicka på stjärnsymbolen nära anslutningen.", // }) // } @@ -700,6 +732,10 @@ pub fn error_translation(language: Language, error: &str) -> Text<'static> { "خطایی رخ داد! \n\n\ {error}" ), + Language::SV => format!( + "Ett fel inträffade! \n\n\ + {error}" + ), }) } @@ -719,6 +755,7 @@ pub fn both_translation(language: Language) -> &'static str { Language::RU => "оба", Language::EL => "αμφότερα", Language::FA => "هر دو", + Language::SV => "båda", } } @@ -732,6 +769,7 @@ pub fn both_translation(language: Language) -> &'static str { // Language::DE => "Alle Protokolle", // Language::RU => "Все протоколы", // Language::FA => "همهٔ پیوندنامه ها", +// Language::SE => "Alla protokoll", // } // } @@ -751,6 +789,7 @@ pub fn all_translation(language: Language) -> &'static str { Language::RU => "Всё", Language::EL => "Όλα", Language::FA => "همه", + Language::SV => "Alla", } } @@ -766,7 +805,7 @@ pub fn packets_translation(language: Language) -> &'static str { Language::ZH => "数据包", Language::RO => "pachete", Language::KO => "패킷", - Language::TR => "paket", + Language::TR | Language::SV => "paket", Language::RU => "пакектов", Language::PT => "pacotes", Language::EL => "πακέτα", @@ -791,12 +830,15 @@ pub fn packets_chart_translation(language: Language) -> &'static str { Language::PT => "pacotes por segundo", Language::EL => "πακέτα ανά δευτερόλεπτο", Language::FA => "بسته در ثانیه", + Language::SV => "paket per sekund", } } pub fn bytes_translation(language: Language) -> &'static str { match language { - Language::EN | Language::ES | Language::PT | Language::DE | Language::EL => "bytes", + Language::EN | Language::ES | Language::PT | Language::DE | Language::EL | Language::SV => { + "bytes" + } Language::IT => "byte", Language::FR => "octets", Language::PL => "bajty", @@ -826,6 +868,7 @@ pub fn bytes_chart_translation(language: Language) -> &'static str { Language::RU => "байтов в секунду", Language::EL => "bytes ανά δευτερόλεπτο", Language::FA => "بایت در ثانیه", + Language::SV => "bytes per sekund", } } @@ -846,6 +889,7 @@ pub fn recent_report_translation(language: Language) -> &'static str { Language::PT => "mais recente", Language::EL => "πιο πρόσφατα", Language::FA => "آخرین", + Language::SV => "senaste", } } @@ -866,6 +910,7 @@ pub fn packets_report_translation(language: Language) -> &'static str { Language::PT => "mais pacotes", Language::EL => "περισσότερα πακέτα", Language::FA => "بیشترین بسته ها", + Language::SV => "flest paket", } } @@ -886,6 +931,7 @@ pub fn bytes_report_translation(language: Language) -> &'static str { Language::PT => "mais bytes", Language::EL => "περισσότερα bytes", Language::FA => "بیشترین بایت ها", + Language::SV => "flest bytes", } } @@ -905,6 +951,7 @@ pub fn bytes_report_translation(language: Language) -> &'static str { // Language::RU => "избранное", // Language::EL => "αγαπημένα", // Language::FA => "پسندیده ها", +// Language::SE => "favoriter", // } // } @@ -925,6 +972,7 @@ pub fn notifications_title_translation(language: Language) -> Text<'static> { Language::PT => "Personalize as suas notificações", Language::EL => "Εξατομίκευση ειδοποιήσεων", Language::FA => "اعلان های خود را سفارشی کنید", + Language::SV => "Anpassa dina notifikationer", }) } @@ -945,6 +993,7 @@ pub fn appearance_title_translation(language: Language) -> Text<'static> { Language::PT => "Escolha o seu tema favorito", Language::EL => "Επίλεξε το αγαπημένο σου θέμα", Language::FA => "زمینه دلخواه خود را انتخاب کنید", + Language::SV => "Välj ditt favorittema", }) } @@ -965,6 +1014,7 @@ pub fn languages_title_translation(language: Language) -> Text<'static> { Language::PT => "Selecione o seu idioma", Language::EL => "Επίλεξε τη γλώσσα σου", Language::FA => "زبان خود را انتخاب کنید", + Language::SV => "Välj ditt språk", }) } @@ -985,6 +1035,7 @@ pub fn active_filters_translation(language: Language) -> &'static str { Language::PT => "Filtros ativos", Language::EL => "Ενεργά φίλτρα", Language::FA => "صافی های فعال", + Language::SV => "Aktiva filter", } } @@ -1005,6 +1056,7 @@ pub fn none_translation(language: Language) -> String { Language::PT => "nenhum", Language::EL => "κανένα", Language::FA => "هیچ کدام", + Language::SV => "inga", } .to_string() } @@ -1026,6 +1078,7 @@ pub fn yeti_night_translation(language: Language) -> &'static str { Language::PT => "Tema escuro original de Sniffnet", Language::EL => "Το αυθεντικό σκούρο θέμα του Sniffnet", Language::FA => "زمینه تاریک اصلی Sniffnet", + Language::SV => "Sniffnets ursprungliga mörka tema", } } @@ -1045,6 +1098,7 @@ pub fn yeti_day_translation(language: Language) -> &'static str { Language::RU => "Оригинальная светая тема Sniffnet'а", Language::EL => "Το αυθεντικό ανοιχτόχρωμο θέμα του Sniffnet", Language::FA => "زمینه روشن اصلی Sniffnet", + Language::SV => "Sniffnets ursprungliga ljusa tema", } } @@ -1065,6 +1119,7 @@ pub fn deep_sea_translation(language: Language) -> &'static str { Language::PT => "Para mergulhar no tráfego de rede", Language::EL => "Βουτιά μέσα στην κίνηση του δικτύου", Language::FA => "شیرجه رفتن در آمد و شد شبکه", + Language::SV => "För att dyka ned i nätverkstrafiken", } } @@ -1085,6 +1140,7 @@ pub fn mon_amour_translation(language: Language) -> &'static str { Language::PT => "Tema encantador feito para sonhadores", Language::EL => "Φτιαγμένο για ονειροπόλους", Language::FA => "زمینه دلپذیر ساخته شده برای رویا پردازان", + Language::SV => "Ljuvligt tema gjort för drömmare", } } @@ -1105,6 +1161,7 @@ pub fn incoming_translation(language: Language) -> &'static str { Language::PT => "Entrando", Language::EL => "Εισερχόμενα", Language::FA => "ورودی", + Language::SV => "Inkommande", } } @@ -1125,6 +1182,7 @@ pub fn outgoing_translation(language: Language) -> &'static str { Language::PT => "Saindo", Language::EL => "Εξερχόμενα", Language::FA => "خروجی", + Language::SV => "Utgående", } } @@ -1144,6 +1202,7 @@ pub fn notifications_translation(language: Language) -> &'static str { Language::PT => "Notificações", Language::EL => "Ειδοποιήσεις", Language::FA => "اعلان ها", + Language::SV => "Notifikationer", } } @@ -1153,7 +1212,7 @@ pub fn style_translation(language: Language) -> &'static str { Language::IT => "Stile", Language::ES | Language::PT => "Estilo", Language::PL => "Styl", - Language::DE | Language::RO | Language::TR => "Stil", + Language::DE | Language::RO | Language::TR | Language::SV => "Stil", Language::UK | Language::RU => "Стиль", Language::ZH => "主题", Language::KO => "스타일", @@ -1179,6 +1238,7 @@ pub fn language_translation(language: Language) -> &'static str { Language::PT => "Língua", Language::EL => "Γλώσσα", Language::FA => "زبان", + Language::SV => "Språk", } } @@ -1199,6 +1259,7 @@ pub fn overview_translation(language: Language) -> &'static str { Language::PT => "Visão geral", Language::EL => "επισκόπηση", Language::FA => "نمای کلی", + Language::SV => "Översikt", } } @@ -1219,6 +1280,7 @@ pub fn packets_threshold_translation(language: Language) -> &'static str { Language::PT => "Notifique-me quando um limite de pacotes for excedido", Language::EL => "Ειδοποίησέ με όταν το όριο τον πακέτων ξεπεραστεί", Language::FA => "به من اطلاع بده وقتی آستانه یک بسته فراتر رفت", + Language::SV => "Notifiera mig när en paketgräns har överstigits", } } @@ -1239,6 +1301,7 @@ pub fn bytes_threshold_translation(language: Language) -> &'static str { Language::PT => "Notifique-me quando um limite de bytes for excedido", Language::EL => "Ειδοποίησέ με όταν το όριο των bytes ξεπεραστεί", Language::FA => "به من اطلاع بده وقتی آستانه یک بایت فراتر رفت", + Language::SV => "Notifiera mig när en gräns för bytes har överstigits", } } @@ -1258,6 +1321,7 @@ pub fn per_second_translation(language: Language) -> &'static str { Language::RU => "(в секунду)", Language::EL => "(ανά δευτερόλεπτο)", Language::FA => "(در ثانیه)", + Language::SV => "(per sekund)", } } @@ -1278,6 +1342,7 @@ pub fn specify_multiples_translation(language: Language) -> &'static str { Language::PT => "; também pode especificar 'K', 'M' e 'G'", Language::EL => "• μπορείς επίσης να καθορίσεις τα 'K', 'M' και 'G'", Language::FA => "؛ شما همچنین می توانید 'M'، 'K' و 'G' را تعیین کنید", + Language::SV => "; du kan också ange 'K', 'M' och 'G'", } } @@ -1300,6 +1365,7 @@ pub fn favorite_notification_translation(language: Language) -> &'static str { Language::PT => "Notificar-me quando novos dados forem trocados dos meus favoritos", Language::EL => "Ειδοποίησέ με όταν νέα δεδομένα έχουν ανταλλαγεί από τα αγαπημένα μου", Language::FA => "به من اطلاع بده وقتی داده جدید از پسندیده های من مبادله شد", + Language::SV => "Notifiera mig när ny data utbyts av mina favoriter", } } @@ -1320,6 +1386,7 @@ pub fn threshold_translation(language: Language) -> String { Language::PT => "Limite".to_string(), Language::EL => "όριο".to_string(), Language::FA => "آستانه".to_string(), + Language::SV => "Gräns".to_string(), } } @@ -1337,6 +1404,7 @@ pub fn volume_translation(language: Language) -> &'static str { Language::RU => "Объём", Language::EL => "Ένταση", Language::FA => "حجم", + Language::SV => "Volym", } } @@ -1356,6 +1424,7 @@ pub fn sound_translation(language: Language) -> &'static str { Language::PT => "Som", Language::EL => "Ήχος", Language::FA => "صدا", + Language::SV => "Ljud", } } @@ -1376,6 +1445,7 @@ pub fn open_report_translation(language: Language) -> &'static str { Language::PT => "Abrir relatório completo", Language::EL => "Άνοιγμα της πλήρους αναφοράς", Language::FA => "گزارش کامل را باز کن", + Language::SV => "Öppna fullständig rapport", } } @@ -1396,6 +1466,7 @@ pub fn bytes_exceeded_translation(language: Language) -> &'static str { Language::PT => "Limite de bytes excedido!", Language::EL => "Το όριο των bytes ξεπεράστηκε!", Language::FA => "آستانه بایت فراتر رفت!", + Language::SV => "Gräns för bytes överskriden!", } } @@ -1417,6 +1488,7 @@ pub fn bytes_exceeded_value_translation(language: Language, value: &str) -> Stri Language::PT => format!("Foram trocados {trimmed_value} bytes"), Language::EL => format!("{trimmed_value} bytes έχουν ανταλλαγεί"), Language::FA => format!("{trimmed_value} بایت مبادله شده است"), + Language::SV => format!("{trimmed_value} bytes har utbytts"), } } @@ -1437,6 +1509,7 @@ pub fn packets_exceeded_translation(language: Language) -> &'static str { Language::PT => "Limite de pacotes excedido!", Language::EL => "Το όριο των πακέτων ξεπεράστηκε!", Language::FA => "آستانه بسته فراتر رفت!", + Language::SV => "Paketgräns överskriden!", } } @@ -1472,6 +1545,10 @@ pub fn packets_exceeded_value_translation(language: Language, value: u32) -> Str npackets => format!("{npackets} πακέτα έχουν ανταλλαγεί"), }, Language::FA => format!("{value} بسته مبادله شده است"), + Language::SV => match value { + 1 => "1 paket har utbytts".to_owned(), + npackets => format!("{npackets} paket har utbytts"), + }, } } @@ -1492,13 +1569,14 @@ pub fn favorite_transmitted_translation(language: Language) -> &'static str { Language::PT => "Novos dados trocados dos favoritos!", Language::EL => "Καινούρια δεδομένα έχουν ανταλλαγεί στα αγαπημένα!", Language::FA => "مبادله داده جدید از پسندیده ها!", + Language::SV => "Ny data utbytt av favoriter!", } } pub fn no_notifications_set_translation(language: Language) -> Text<'static> { Text::new(match language { Language::EN => "You haven't enabled notifications yet!\n\n\ - After you will enable them, this page will display a log of your notifications\n\n\ + After enabling them, this page will display a log of your notifications\n\n\ You can enable notifications from settings:", Language::IT => "Non hai ancora abilitato le notifiche!\n\n\ Dopo che le avrai abilitate, questa pagina mostrerà una collezione delle tue notifiche\n\n\ @@ -1542,6 +1620,9 @@ pub fn no_notifications_set_translation(language: Language) -> Text<'static> { Language::FA => "شما هنوز اعلان ها را فعال نکرده اید!\n\n\ پس از آنکه آن ها را فعال کنید، این صفحه یک کارنامه از اعلان های شما را نمایش خواهد داد\n\n شما می توانید اعلان ها را از پیکربندی فعال کنید:", + Language::SV => "Du har inte aktiverat notifikationer än!\n\n\ + Efter att du aktiverat dem så kommer denna sida att visa en logg av dina notifikationer\n\n\ + Du kan aktivera notifikationer i inställingarna", }) } @@ -1549,7 +1630,7 @@ pub fn no_notifications_received_translation(language: Language) -> Text<'static Text::new(match language { Language::EN => { "Nothing to see at the moment...\n\n\ - When you will receive a notification, it will be displayed here" + When you receive a notification, it will be displayed here" } Language::IT => { "Nulla da vedere al momento...\n\n\ @@ -1607,6 +1688,10 @@ pub fn no_notifications_received_translation(language: Language) -> Text<'static "در حال حاضر هیچ چیزی برای دیدن نیست...\n\n\ وقتی شما اعلانی دریافت می کنید، در اینجا نمایش داده خواهد شد" } + Language::SV => { + "Inget att se för tillfället ...\n\n\ + När du tar emot en notifikation så kommer den att visas här" + } }) } @@ -1627,5 +1712,6 @@ pub fn only_last_30_translation(language: Language) -> &'static str { Language::PT => "São mostradas apenas as últimas 30 notificações", Language::EL => "Μόνο οι τελευταίες 30 ειδοποιήσεις απεικονίζονται", Language::FA => "تنها ۳۰ اعلان آخر نمایش داده شده اند", + Language::SV => "Endast de senaste 30 notifikationerna visas", } } diff --git a/src/translations/translations_2.rs b/src/translations/translations_2.rs index 76cf89d8..a77f4617 100644 --- a/src/translations/translations_2.rs +++ b/src/translations/translations_2.rs @@ -9,6 +9,7 @@ pub fn new_version_available_translation(language: Language) -> &'static str { Language::RU => "Новая версия доступна на GitHub", Language::EL => "Μια νεότερη έκδοση είναι διαθέσιμη στο GitHub", Language::FA => "یک نسخه جدیدتر روی GitHub موجود است", + Language::SV => "En nyare version finns tillgänglig på GitHub", _ => "A newer version is available on GitHub", } } @@ -22,6 +23,7 @@ pub fn inspect_translation(language: Language) -> &'static str { Language::PL => "Sprawdź", Language::DE => "Überprüfen", Language::RU => "Инспектировать", + Language::SV => "Inspektera", _ => "Inspect", } } @@ -30,6 +32,7 @@ pub fn connection_details_translation(language: Language) -> &'static str { match language { Language::EN => "Connection details", Language::IT => "Dettagli della connessione", + Language::SV => "Anslutningsdetaljer", _ => "Connection details", } } @@ -38,6 +41,7 @@ pub fn dropped_packets_translation(language: Language) -> &'static str { match language { Language::EN => "Dropped packets", Language::IT => "Pacchetti mancati", + Language::SV => "Tappade paket", _ => "Dropped packets", } } @@ -46,6 +50,7 @@ pub fn data_representation_translation(language: Language) -> &'static str { match language { Language::EN => "Data representation", Language::IT => "Rappresentazione dei dati", + Language::SV => "Datarepresentation", _ => "Data representation", } } @@ -54,6 +59,7 @@ pub fn host_translation(language: Language) -> &'static str { match language { Language::EN => "Network host", Language::IT => "Host di rete", + Language::SV => "Nätverksvärd", _ => "Network host", } } @@ -62,6 +68,7 @@ pub fn only_top_30_hosts_translation(language: Language) -> &'static str { match language { Language::EN => "Only the top 30 hosts are displayed here", Language::IT => "Solo i maggiori 30 host sono mostrati qui", + Language::SV => "Endast de 30 främsta värdarna visas här", _ => "Only the top 30 hosts are displayed here", } } @@ -70,6 +77,7 @@ pub fn sort_by_translation(language: Language) -> &'static str { match language { Language::EN => "Sort by", Language::IT => "Ordina per", + Language::SV => "Sortera efter", _ => "Sort by", } } @@ -78,6 +86,7 @@ pub fn local_translation(language: Language) -> String { match language { Language::EN => "Local network", Language::IT => "Rete locale", + Language::SV => "Lokalt nätverk", _ => "Local network", } .to_string() @@ -87,6 +96,7 @@ pub fn unknown_translation(language: Language) -> String { match language { Language::EN => "Unknown location", Language::IT => "Localizzazione sconosciuta", + Language::SV => "Okänd plats", _ => "Unknown location", } .to_string() @@ -96,6 +106,7 @@ pub fn your_network_adapter_translation(language: Language) -> String { match language { Language::EN => "Your network adapter", Language::IT => "La tua scheda di rete", + Language::SV => "Din nätverksadapter", _ => "Your network adapter", } .to_string() @@ -105,6 +116,7 @@ pub fn socket_address_translation(language: Language) -> &'static str { match language { Language::EN => "Socket address", Language::IT => "Indirizzo del socket", + Language::SV => "Socketadress", _ => "Socket address", } } @@ -113,6 +125,7 @@ pub fn mac_address_translation(language: Language) -> &'static str { match language { Language::EN => "MAC address", Language::IT => "Indirizzo MAC", + Language::SV => "MAC-adress", _ => "MAC address", } } @@ -121,13 +134,14 @@ pub fn source_translation(language: Language) -> &'static str { match language { Language::EN => "Source", Language::IT => "Sorgente", + Language::SV => "Källa", _ => "Source", } } pub fn destination_translation(language: Language) -> &'static str { match language { - Language::EN => "Destination", + Language::EN | Language::SV => "Destination", Language::IT => "Destinazione", _ => "Destination", } @@ -137,6 +151,7 @@ pub fn fqdn_translation(language: Language) -> &'static str { match language { Language::EN => "Fully qualified domain name", Language::IT => "Nome di dominio completo", + Language::SV => "Fullständigt domännamn", _ => "Fully qualified domain name", } } @@ -145,6 +160,7 @@ pub fn administrative_entity_translation(language: Language) -> &'static str { match language { Language::EN => "Administrative entity", Language::IT => "Entità amministrativa", + Language::SV => "Administrativ enhet", _ => "Administrative entity", } } @@ -153,6 +169,7 @@ pub fn transmitted_data_translation(language: Language) -> &'static str { match language { Language::EN => "Transmitted data", Language::IT => "Dati trasmessi", + Language::SV => "Överförd data", _ => "Transmitted data", } } @@ -161,6 +178,7 @@ pub fn country_translation(language: Language) -> &'static str { match language { Language::EN => "Country", Language::IT => "Paese", + Language::SV => "Land", _ => "Country", } } @@ -169,6 +187,7 @@ pub fn domain_name_translation(language: Language) -> &'static str { match language { Language::EN => "Domain name", Language::IT => "Nome di dominio", + Language::SV => "Domännamn", _ => "Domain name", } } @@ -177,6 +196,7 @@ pub fn only_show_favorites_translation(language: Language) -> &'static str { match language { Language::EN => "Only show favorites", Language::IT => "Mostra solo i preferiti", + Language::SV => "Visa endast favoriter", _ => "Only show favorites", } } @@ -185,6 +205,7 @@ pub fn search_filters_translation(language: Language) -> &'static str { match language { Language::EN => "Search filters", Language::IT => "Filtri di ricerca", + Language::SV => "Sökfilter", _ => "Search filters", } } @@ -193,6 +214,7 @@ pub fn no_search_results_translation(language: Language) -> &'static str { match language { Language::EN => "No result available according to the specified search filters", Language::IT => "Nessun risultato disponibile secondo i filtri di ricerca specificati", + Language::SV => "Inga resultat tillgängliga utifrån de angivna sökfilterna", _ => "No result available according to the specified search filters", } } @@ -206,6 +228,7 @@ pub fn showing_results_translation( match language { Language::EN => format!("Showing {start}-{end} of {total} total results"), Language::IT => format!("Sono mostrati {start}-{end} di {total} risultati totali"), + Language::SV => format!("Visar {start}-{end} av {total} totala resultat"), _ => format!("Showing {start}-{end} of {total} total results"), } } @@ -215,6 +238,7 @@ pub fn color_gradients_translation(language: Language) -> &'static str { match language { Language::EN => "Apply color gradients", Language::IT => "Applica sfumature di colore", + Language::SV => "Applicera färggradient", _ => "Apply color gradients", } } diff --git a/src/translations/types/language.rs b/src/translations/types/language.rs index 44ed8ada..4f38b8af 100644 --- a/src/translations/types/language.rs +++ b/src/translations/types/language.rs @@ -33,6 +33,8 @@ pub enum Language { EL, /// Persian FA, + /// Swedish + SV, } impl Default for Language { @@ -42,27 +44,10 @@ impl Default for Language { } impl Language { - pub(crate) const COL1: [Language; 5] = [ - Language::EN, - Language::ES, - Language::IT, - Language::PT, - Language::TR, - ]; - pub(crate) const COL2: [Language; 5] = [ - Language::DE, - Language::FA, - Language::KO, - Language::RO, - Language::UK, - ]; - pub(crate) const COL3: [Language; 5] = [ - Language::EL, - Language::FR, - Language::PL, - Language::RU, - Language::ZH, - ]; + pub(crate) const ROW1: [Language; 4] = [Language::EN, Language::DE, Language::EL, Language::ES]; + pub(crate) const ROW2: [Language; 4] = [Language::FA, Language::FR, Language::IT, Language::KO]; + pub(crate) const ROW3: [Language; 4] = [Language::PL, Language::PT, Language::RO, Language::RU]; + pub(crate) const ROW4: [Language; 4] = [Language::SV, Language::TR, Language::UK, Language::ZH]; pub fn get_radio_label(&self) -> &str { match self { @@ -81,6 +66,7 @@ impl Language { Language::PT => "Português", Language::EL => "Ελληνικά", Language::FA => "فارسی", + Language::SV => "Svenska", } } } diff --git a/src/utils/countries.rs b/src/utils/countries.rs index dd407f78..edc621cd 100644 --- a/src/utils/countries.rs +++ b/src/utils/countries.rs @@ -286,24 +286,24 @@ pub const BROADCAST: &[u8] = include_bytes!("../../resources/countries_flags/4x3 pub const UNKNOWN: &[u8] = include_bytes!("../../resources/countries_flags/4x3/zz-unknown.svg"); pub const COMPUTER: &[u8] = include_bytes!("../../resources/countries_flags/4x3/zz-computer.svg"); -pub fn get_flag_from_language_code(language: &str) -> Svg { +pub fn get_flag_from_language(language: Language) -> Svg { Svg::new(Handle::from_memory(Vec::from(match language { - "ZH" => CN, - "DE" => DE, - "ES" => ES, - "FR" => FR, - "EN" => GB, - "IT" => IT, - "KO" => KR, - "PL" => PL, - "PT" => PT, - "RO" => RO, - "RU" => RU, - "TR" => TR, - "UK" => UA, - "EL" => GR, - "FA" => IR, - _ => UNKNOWN, + Language::ZH => CN, + Language::DE => DE, + Language::ES => ES, + Language::FR => FR, + Language::EN => GB, + Language::IT => IT, + Language::KO => KR, + Language::PL => PL, + Language::PT => PT, + Language::RO => RO, + Language::RU => RU, + Language::TR => TR, + Language::UK => UA, + Language::EL => GR, + Language::FA => IR, + Language::SV => SE, }))) .width(Length::Fixed(FLAGS_WIDTH_SMALL)) }