Skip to content

Commit

Permalink
Merge pull request #213 from vcrn/swedish-translation
Browse files Browse the repository at this point in the history
Swedish translation
  • Loading branch information
GyulyVGC authored May 26, 2023
2 parents 1e47b71 + 6e0f03e commit bf0205a
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 84 deletions.
2 changes: 2 additions & 0 deletions resources/fonts/full/subset_characters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ z
}
¡
¿
Ä
Ê
Î
Ö
Expand All @@ -103,6 +104,7 @@ z
â
ã
ä
å
ç
è
é
Expand Down
Binary file modified resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf
Binary file not shown.
Binary file modified resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf
Binary file not shown.
46 changes: 25 additions & 21 deletions src/gui/components/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
<StyleTuple as Into<iced::theme::Radio>>::into(StyleTuple(
style,
ElementType::Standard,
)),
),
)
.spacing(7)
.font(font)
.size(15)
.style(<StyleTuple as Into<iced::theme::Radio>>::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
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/initial_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container<Message> {
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;
Expand All @@ -42,7 +42,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container<Message> {
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))
Expand All @@ -67,7 +67,7 @@ pub fn initial_page(sniffer: &Sniffer) -> Container<Message> {
.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))
Expand Down
31 changes: 17 additions & 14 deletions src/gui/pages/settings_language_page.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,17 +18,20 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container<Message> {
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)
Expand Down Expand Up @@ -58,7 +61,7 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container<Message> {
)
.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(
Expand All @@ -73,7 +76,7 @@ pub fn settings_language_page(sniffer: &Sniffer) -> Container<Message> {
.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))
Expand Down
Loading

0 comments on commit bf0205a

Please sign in to comment.