Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ukrainian translation #94

Merged
merged 8 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions resources/fonts/full/subset_characters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,56 @@ 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.
5 changes: 4 additions & 1 deletion src/enums/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub enum Language {
PL,
/// German,
DE,
/// Ukrainian
UK,
/// Simplified Chinese
ZH,
}
Expand All @@ -27,7 +29,7 @@ impl Default for Language {

impl Language {
pub(crate) const COL1: [Language; 4] = [Language::EN, Language::FR, Language::ES, Language::ZH];
pub(crate) const COL2: [Language; 3] = [Language::DE, Language::IT, Language::PL];
pub(crate) const COL2: [Language; 4] = [Language::DE, Language::IT, Language::PL, Language::UK];
pub fn get_radio_label(&self) -> &str {
match self {
Language::EN => "English",
Expand All @@ -36,6 +38,7 @@ impl Language {
Language::ES => "Español",
Language::PL => "Polski",
Language::DE => "Deutsch",
Language::UK => "Українська",
Language::ZH => "简体中文",
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/components/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::enums::message::Message;
use crate::enums::sound::Sound;
use crate::structs::notifications::{BytesNotification, FavoriteNotification, PacketsNotification};
use crate::structs::style_tuple::StyleTuple;
use crate::utility::countries::get_flag;
use crate::utility::countries::get_flag_from_language_code;
use crate::utility::style_constants::FONT_SIZE_SUBTITLE;
use crate::utility::translations::{
ip_version_translation, relevant_connections_translation, sound_translation,
Expand Down Expand Up @@ -101,7 +101,7 @@ pub fn language_radios(
))),
)
.push(horizontal_space(Length::Fixed(5.0)))
.push(get_flag(&format!("{option:?}"))),
.push(get_flag_from_language_code(&format!("{option:?}"))),
);
}
ret_val
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/notifications_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::enums::traffic_type::TrafficType;
use crate::gui::components::header::get_button_settings;
use crate::gui::components::tab::get_pages_tabs;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::countries::get_flag;
use crate::utility::countries::get_flag_from_country_code;
use crate::utility::get_formatted_strings::get_formatted_bytes_string;
use crate::utility::style_constants::{get_font, FONT_SIZE_FOOTER, HEIGHT_BODY, ICONS};
use crate::utility::translations::{
Expand Down Expand Up @@ -349,9 +349,9 @@ fn favorite_notification_log(
.push(Text::new(dst_str).font(font));
if !country.is_empty() {
if traffic_type.eq(&TrafficType::Outgoing) {
row_dst_flag = row_dst_flag.push(get_flag(&country));
row_dst_flag = row_dst_flag.push(get_flag_from_country_code(&country));
} else {
row_src_flag = row_src_flag.push(get_flag(&country));
row_src_flag = row_src_flag.push(get_flag_from_country_code(&country));
}
}
let content = Row::new()
Expand Down
4 changes: 2 additions & 2 deletions src/gui/pages/overview_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::gui::components::radio::{chart_radios, report_radios};
use crate::gui::components::tab::get_pages_tabs;
use crate::structs::sniffer::Sniffer;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::countries::{get_flag, FLAGS_WIDTH};
use crate::utility::countries::{get_flag_from_country_code, FLAGS_WIDTH};
use crate::utility::get_formatted_strings::{
get_active_filters_string, get_active_filters_string_nobr, get_app_count_string,
get_connection_color, get_formatted_bytes_string, get_percentage_string, get_report_path,
Expand Down Expand Up @@ -238,7 +238,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
.push(Text::new(" "));
} else {
entry_row = entry_row
.push(get_flag(&key_val.1.country))
.push(get_flag_from_country_code(&key_val.1.country))
.push(Text::new(" "));
}
entry_row = entry_row
Expand Down
21 changes: 18 additions & 3 deletions src/utility/countries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,22 @@ pub const ZW: &[u8] =
include_bytes!("../../resources/countries_flags/png-16/zimbabwe-16x16-33150.png");
pub const UNKNOWN: &[u8] = include_bytes!("../../resources/countries_flags/png-16/question.png");

pub fn get_flag(country: &str) -> Image {
pub fn get_flag_from_language_code(language: &str) -> Image {
Image::new(Handle::from_memory(Vec::from(match language {
"ZH" => CN,
"DE" => DE,
"ES" => ES,
"FR" => FR,
"EN" => GB,
"IT" => IT,
"PL" => PL,
"UK" => UA,
_ => UNKNOWN,
})))
.width(Length::Fixed(FLAGS_WIDTH))
}

pub fn get_flag_from_country_code(country: &str) -> Image {
Image::new(Handle::from_memory(Vec::from(match country {
"AD" => AD,
"AE" => AE,
Expand Down Expand Up @@ -553,7 +568,7 @@ pub fn get_flag(country: &str) -> Image {
"CK" => CK,
"CL" => CL,
"CM" => CM,
"CN" | "ZH" => CN,
"CN" => CN,
"CO" => CO,
"CR" => CR,
"CU" => CU,
Expand Down Expand Up @@ -582,7 +597,7 @@ pub fn get_flag(country: &str) -> Image {
"FO" => FO,
"FR" => FR,
"GA" => GA,
"GB" | "EN" => GB,
"GB" => GB,
"GD" => GD,
"GE" => GE,
"GF" => GF,
Expand Down
Loading