From 4434fb4c32bca2354c2c1624d2d8724da5cde2d4 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 5 Apr 2023 10:27:27 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 + source/main.cc | 4 +- source/ubl-settings-bootloader.cc | 136 +++++++++++++++--------------- 3 files changed, 73 insertions(+), 70 deletions(-) diff --git a/Makefile b/Makefile index ebf196f..0e20dbe 100644 --- a/Makefile +++ b/Makefile @@ -123,6 +123,9 @@ install: check uninstall @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "logo-background.png" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg" + @install -Dm644 -t /usr/share/${PKGNAME}/ boot-options.csv + @install -Dm644 -t /usr/share/${PKGNAME}/ input-options.csv + @install -Dm644 -t /usr/share/${PKGNAME}/ output-options.csv @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ update-desktop-database --quiet &>/dev/null || true; \ diff --git a/source/main.cc b/source/main.cc index d73c089..ba163a9 100644 --- a/source/main.cc +++ b/source/main.cc @@ -62,13 +62,13 @@ void pars_flag(int index_start, int argc, char* argv[]) { exit(1); } else if (str_argv == "--version" || str_argv == "-v"){ - string version = string(gettext("ubl-settings-bootloader version: ")) + version_application + "\n"; + string version = string(_("ubl-settings-bootloader version: ")) + version_application + "\n"; cout << version.c_str(); exit(1); } else{ if (index_start == 1){ - cout << (gettext("Argument not recognized\n")) << endl; + cout << (_("Argument not recognized\n")) << endl; } } diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 8576d9e..579eb42 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -49,7 +49,7 @@ SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr build int MainWindow::check_root() { if (geteuid() != 0) { - //lblMessageSudo->set_text(gettext("The program must be run with \nsuperuser privileges!")); + //lblMessageSudo->set_text(_("The program must be run with \nsuperuser privileges!")); //mess_sudo->show(); return 1; } @@ -96,7 +96,7 @@ void MainWindow::settings(){ boxSave->set_sensitive(false); imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU); info_status_app("boxInfoMessError"); - lblWarning->set_text(gettext("The program must be run as root")); + lblWarning->set_text(_("The program must be run as root")); this->set_active_boot_second(); this->event(); } @@ -415,9 +415,9 @@ vector MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel:: } void MainWindow::view_add_colums(Gtk::TreeView &treeView) { - treeView.append_column_editable(gettext("Active"), m_columns.check_button); - treeView.append_column(gettext("Option"), m_columns.name); - treeView.append_column(gettext("Description"), m_columns.description); + treeView.append_column_editable(_("Active"), m_columns.check_button); + treeView.append_column(_("Option"), m_columns.name); + treeView.append_column(_("Description"), m_columns.description); } void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , std::array, 5> &arr_view , size_t index) { @@ -425,8 +425,8 @@ void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtrtm_year; - string str_authors = string(gettext("Copyright © UBSoft LLC, 2022 - ")) + to_string(year); + string str_authors = string(_("Copyright © UBSoft LLC, 2022 - ")) + to_string(year); aboutWindows->set_copyright(str_authors); - aboutWindows->set_comments(gettext("ubl-settings-bootloader")); - aboutWindows->set_website(gettext("https://wiki.ublinux.com")); - aboutWindows->set_version(gettext(version_application.c_str())); - aboutWindows->set_website_label(gettext("Project Home Page")); - lblInfoHead->set_text(gettext("Configuring system boot parameters")); - lblHeaderName->set_text(gettext("ubl-settings-bootloader")); - aboutWindows->set_comments(gettext("Setting bootloader")); - aboutWindows->set_website_label(gettext("Project Home Page")); - lblInfoCommand->set_text(gettext("Command line parameters:")); - lblInfoCommand1->set_text(gettext("Command line parameters:")); - lblInfoCommand2->set_text(gettext("Command line parameters:")); - lblInfoDefaultDonw->set_text(gettext("Default download")); - lblInfoSeconds->set_text(gettext("Seconds")); - lblLoadMenu->set_text(gettext("Download menu")); - lblInfoInputTerminal->set_text(gettext("Terminal for input")); - lblInfoOutputTerminal->set_text(gettext("Terminal for output")); + aboutWindows->set_comments(_("ubl-settings-bootloader")); + aboutWindows->set_website(_("https://wiki.ublinux.com")); + aboutWindows->set_version(_(version_application.c_str())); + aboutWindows->set_website_label(_("Project Home Page")); + lblInfoHead->set_text(_("Configuring system boot parameters")); + lblHeaderName->set_text(_("ubl-settings-bootloader")); + aboutWindows->set_comments(_("Setting bootloader")); + aboutWindows->set_website_label(_("Project Home Page")); + lblInfoCommand->set_text(_("Command line parameters:")); + lblInfoCommand1->set_text(_("Command line parameters:")); + lblInfoCommand2->set_text(_("Command line parameters:")); + lblInfoDefaultDonw->set_text(_("Default download")); + lblInfoSeconds->set_text(_("Seconds")); + lblLoadMenu->set_text(_("Download menu")); + lblInfoInputTerminal->set_text(_("Terminal for input")); + lblInfoOutputTerminal->set_text(_("Terminal for output")); - chbLoadVariantSelectionTimer->set_label(gettext("Load variant selection timer")); - chbLastSelectionWillBecome->set_label(gettext("The last selection will become the default boot choice")); - btnSynopsis->set_label(gettext("Help")); - btnAbout->set_label(gettext("About")); - btnSaveLocalGlob->set_label(gettext("Save to global and local configuration")); - btnSaveLocal->set_label(gettext("Save local configuration")); - btnSaveGlob->set_label(gettext("Save global configuration")); - btnLoadGlob->set_label(gettext("Load global configuration")); - btnLoadLocal->set_label(gettext("Load local configuration")); - btnSave->set_label(gettext("Save")); - btnLoad->set_label(gettext("Load")); - this->set_title(gettext("ubl-settings-bootloader")); - - lblDownloadMode->set_text(gettext("Download mode:")); - lblSecurityLogin->set_text(gettext("Security login:")); - lblPasswordProtec->set_text(gettext("Password protection:")); - - chbSecurityLogin->append(gettext("Default")); - chbSecurityLogin->append(gettext("Mine")); - - chbPasswordProtecc->append(gettext("Default")); - chbPasswordProtecc->append(gettext("Mine")); - chbPasswordProtecc->append(gettext("Disabled")); - - cmbDownloadMode->append(gettext("Loading animation, full log")); - cmbDownloadMode->append(gettext("Loading animation, no log")); - cmbDownloadMode->append(gettext("No loading animation, full log.")); - cmbDownloadMode->append(gettext("No loading animation, minimal log.")); + chbLoadVariantSelectionTimer->set_label(_("Load variant selection timer")); + chbLastSelectionWillBecome->set_label(_("The last selection will become the default boot choice")); + btnSynopsis->set_label(_("Help")); + btnAbout->set_label(_("About")); + btnSaveLocalGlob->set_label(_("Save to global and local configuration")); + btnSaveLocal->set_label(_("Save local configuration")); + btnSaveGlob->set_label(_("Save global configuration")); + btnLoadGlob->set_label(_("Load global configuration")); + btnLoadLocal->set_label(_("Load local configuration")); + btnSave->set_label(_("Save")); + btnLoad->set_label(_("Load")); + this->set_title(_("ubl-settings-bootloader")); + + lblDownloadMode->set_text(_("Download mode:")); + lblSecurityLogin->set_text(_("Security login:")); + lblPasswordProtec->set_text(_("Password protection:")); + + chbSecurityLogin->append(_("Default")); + chbSecurityLogin->append(_("Mine")); + + chbPasswordProtecc->append(_("Default")); + chbPasswordProtecc->append(_("Mine")); + chbPasswordProtecc->append(_("Disabled")); + + cmbDownloadMode->append(_("Loading animation, full log")); + cmbDownloadMode->append(_("Loading animation, no log")); + cmbDownloadMode->append(_("No loading animation, full log.")); + cmbDownloadMode->append(_("No loading animation, minimal log.")); } vector MainWindow::get_setting_entry_all(string key, string cmd, Gtk::Entry &entry_text, std::map &map_temp) { @@ -567,7 +567,7 @@ vector MainWindow::get_setting_entry_all(string key, string cmd, Gtk::En bool MainWindow::focus_out_txt_password(GdkEventFocus*) { if (entryPasswordProtecc->get_text().length() == 0) { info_status_app("boxInfoMessError"); - lblWarning->set_text(gettext("Enter your password")); + lblWarning->set_text(_("Enter your password")); boxSave->set_sensitive(false); } else { @@ -579,7 +579,7 @@ bool MainWindow::focus_out_txt_password(GdkEventFocus*) { bool MainWindow::focus_out_txt_login(GdkEventFocus*) { if (entrySecurityLogin->get_text().length() == 0) { info_status_app("boxInfoMessError"); - lblWarning->set_text(gettext("Enter login")); + lblWarning->set_text(_("Enter login")); boxSave->set_sensitive(false); } else { @@ -1030,7 +1030,7 @@ void MainWindow::set_row(Glib::RefPtr &list_store, int size, std } void MainWindow::synopsis_show() { - string cmd = "xdg-open " + string(gettext("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/")) + app_name + " &"; + string cmd = "xdg-open " + string(_("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/")) + app_name + " &"; if (geteuid() == 0) { string response_user = getlogin(); cmd = "su -l " + response_user + " -c \" DISPLAY=$DISPLAY " + cmd + " \""; @@ -1061,23 +1061,23 @@ void MainWindow::info_warning_error(int mess) { index_error = 0; string mess_error = ""; if (mess == 0) { - mess_error = string(gettext("Local configuration reading error")) + str_cmd_error; + mess_error = string(_("Local configuration reading error")) + str_cmd_error; lblWarning->set_text(mess_error); } else if (mess == 1) { - mess_error = string(gettext("Global configuration read error")) + str_cmd_error; + mess_error = string(_("Global configuration read error")) + str_cmd_error; lblWarning->set_text(mess_error); } else if (mess == 2) { - mess_error = string(gettext("Local configuration write error")) + str_cmd_error; + mess_error = string(_("Local configuration write error")) + str_cmd_error; lblWarning->set_text(mess_error); } else if (mess == 3) { - mess_error = string(gettext("Global configuration write error")) + str_cmd_error; + mess_error = string(_("Global configuration write error")) + str_cmd_error; lblWarning->set_text(mess_error); } else if (mess == 4) { - mess_error = string(gettext("Error saved local and global configuration")) + str_cmd_error; + mess_error = string(_("Error saved local and global configuration")) + str_cmd_error; lblWarning->set_text(mess_error); } str_cmd_error = ""; @@ -1086,22 +1086,22 @@ void MainWindow::info_warning_error(int mess) { info_status_app("boxInfoMessOK"); imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU); if (mess == 0) { - lblWarning->set_text(gettext("Local configuration downloaded successfully")); + lblWarning->set_text(_("Local configuration downloaded successfully")); } else if (mess == 1) { - lblWarning->set_text(gettext("Global configuration downloaded successfully")); + lblWarning->set_text(_("Global configuration downloaded successfully")); } else if (mess == 2) { - lblWarning->set_text(gettext("Local configuration successfully written")); + lblWarning->set_text(_("Local configuration successfully written")); } else if (mess == 3) { - lblWarning->set_text(gettext("Global configuration successfully written")); + lblWarning->set_text(_("Global configuration successfully written")); } else if (mess == 4) { - lblWarning->set_text(gettext("Successfully saved local and global configuration")); + lblWarning->set_text(_("Successfully saved local and global configuration")); } else if (mess == 5) { - lblWarning->set_text(gettext("Nothing to save!")); + lblWarning->set_text(_("Nothing to save!")); } } } @@ -1178,7 +1178,7 @@ void MainWindow::add_CSS(){ } void help() { - string version = string(gettext("ubl-settings-bootloader version: ")) + version_application + "\n"; + string version = string(_("ubl-settings-bootloader version: ")) + version_application + "\n"; cout << version.c_str(); string help; help = "GTK settings bootloader for UBLinux\n\n" @@ -1186,7 +1186,7 @@ void help() { "Options:\n" " -h, --help Show this help\n" " -V, --version Show package version\n"; - cout << gettext(help.c_str()); + cout << _(help.c_str()); }