Skip to content

Commit

Permalink
👷 add translations to installer type selection
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Feb 17, 2024
1 parent c06d456 commit 0a162f9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions i18n/en/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ section-installer = INSTALLATION
section-support = SUPPORT
section-project = PROJECT
# Main Page (launch installer)
recommended = recommended
calamares-install-type = Calamares install type
# Main Page (body)
offline-error = Unable to start online installation! No internet connection
tweaksbrowser-label = Apps/Tweaks
Expand Down
4 changes: 4 additions & 0 deletions i18n/ru/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ section-installer = УСТАНОВКА
section-support = ПОДДЕРЖКА
section-project = ПРОЕКТ
# Main Page (launch installer)
recommended = рекомендовано
calamares-install-type = Calamares тип установки
# Main Page (body)
offline-error = Не удается запустить онлайн-установку! Нет подключения к Интернету
tweaksbrowser-label = Приложения/Настройки
Expand Down
5 changes: 2 additions & 3 deletions src/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ pub fn get_available_languages() -> Result<Vec<unic_langid::LanguageIdentifier>,

/// Check if language is available
pub fn check_language_valid(requested_language: &str) -> bool {
let requested_lang_id: LanguageIdentifier = requested_language
.parse()
.unwrap_or_else(|_| "en_US".parse().expect("failed to fallback"));
let requested_lang_id: LanguageIdentifier =
requested_language.parse().unwrap_or_else(|_| "en_US".parse().expect("failed to fallback"));

let available_languages = get_available_languages().unwrap();
available_languages.iter().any(|x| *x == requested_lang_id)
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ static G_SAVE_JSON: Lazy<Mutex<serde_json::Value>> = Lazy::new(|| {
});
static mut G_HELLO_WINDOW: Option<Arc<HelloWindow>> = None;

fn quick_message(message: &'static str) {
fn quick_message(message: String) {
// Create the widgets
let window_ref = unsafe { &G_HELLO_WINDOW.as_ref().unwrap().window };
let dialog = gtk::Dialog::builder()
.transient_for(window_ref)
.title(message)
.title(&message)
.modal(true)
.expand(true)
.destroy_with_parent(true)
.build();

dialog.add_button("_Offline", gtk::ResponseType::No);
dialog.add_button("_Online (recommended)", gtk::ResponseType::Yes);
dialog.add_button(&format!("_Online ({})", fl!("recommended")), gtk::ResponseType::Yes);
let content_area = dialog.content_area();
let label = gtk::Label::new(Some(message));
let label = gtk::Label::new(Some(&message));

// Add the label, and show everything we’ve added
content_area.add(&label);
Expand Down Expand Up @@ -503,7 +503,7 @@ fn on_action_clicked(param: &[glib::Value]) -> Option<glib::Value> {
let widget = param[0].get::<gtk::Widget>().unwrap();
return match widget.widget_name().as_str() {
"install" => {
quick_message("Calamares install type");
quick_message(fl!("calamares-install-type"));
None
},
"autostart" => {
Expand Down

0 comments on commit 0a162f9

Please sign in to comment.