diff --git a/po/LINGUAS b/po/LINGUAS index e69de29..5aa7609 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -0,0 +1 @@ +uz diff --git a/po/POTFILES.in b/po/POTFILES.in index ccadc33..bd2208b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,11 @@ -data/org.xinux.NixosConfEditor.policy.in.in -data/org.xinux.NixosConfEditor.desktop.in.in -data/org.xinux.NixosConfEditor.metainfo.xml.in.in -data/org.xinux.NixosConfEditor.metainfo.gschema.xml.in +src/ui/quitdialog.rs +src/ui/optionpage.rs +src/ui/welcome.rs +src/ui/windowloading.rs +src/ui/searchpage.rs +src/ui/preferencespage.rs +src/ui/window.rs +src/ui/rebuild.rs +src/ui/about.rs +src/ui/nameentry.rs +src/ui/savechecking.rs diff --git a/po/ru.mo b/po/ru.mo new file mode 100644 index 0000000..249ba5a Binary files /dev/null and b/po/ru.mo differ diff --git a/po/ru.po b/po/ru.po new file mode 100644 index 0000000..069a277 --- /dev/null +++ b/po/ru.po @@ -0,0 +1,243 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-15 19:47+0500\n" +"PO-Revision-Date: 2025-09-16 15:26+0500\n" +"Last-Translator: BeMeritus \n" +"Language-Team: \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" + +#: src/ui/quitdialog.rs:35 +msgid "Save Changes?" +msgstr "Сохранить изменения?" + +#: src/ui/quitdialog.rs:36 +msgid "" +"Unsaved changes will be lost. You should rebuild your system now to ensure " +"you configured everything properly. You can also save your configuration, " +"however is is possible that your configuration is save in an unbuildable " +"state." +msgstr "" +"Несохранённые изменения будут потеряны. Вам следует пересобрать систему " +"сейчас, чтобы убедиться, что всё настроено правильно. Вы также можете " +"сохранить конфигурацию, однако существует вероятность, что она сохранится в " +"состоянии, не подлежащем сборке." + +#: src/ui/quitdialog.rs:38 src/ui/windowloading.rs:142 +msgid "Quit" +msgstr "Выйти" + +#: src/ui/quitdialog.rs:39 src/ui/optionpage.rs:400 src/ui/nameentry.rs:36 +msgid "Save" +msgstr "Сохранить" + +#: src/ui/quitdialog.rs:40 src/ui/window.rs:250 +msgid "Rebuild" +msgstr "Восстановить" + +#: src/ui/optionpage.rs:82 +msgid "Description" +msgstr "Описание" + +#: src/ui/optionpage.rs:132 +msgid "Type" +msgstr "Тип" + +#: src/ui/optionpage.rs:158 +msgid "Default" +msgstr "Стандартный" + +#: src/ui/optionpage.rs:211 +msgid "Example" +msgstr "Пример" + +#: src/ui/optionpage.rs:265 +msgid "Value" +msgstr "Ценить" + +#: src/ui/optionpage.rs:297 +msgid "True" +msgstr "Истинный" + +#: src/ui/optionpage.rs:306 +msgid "False" +msgstr "Ложный" + +#: src/ui/optionpage.rs:334 +msgid "Attribute Value" +msgstr "Значение атрибута" + +#: src/ui/optionpage.rs:379 src/ui/savechecking.rs:142 +msgid "Reset" +msgstr "Сбросить" + +#: src/ui/optionpage.rs:387 +msgid "Clear" +msgstr "Чистый" + +#: src/ui/welcome.rs:56 +msgid "Welcome the NixOS Configuration Editor!" +msgstr "Добро пожаловать в Редактор конфигурации NixOS!" + +#: src/ui/welcome.rs:61 +msgid "" +"If your configuration file is not in the default location, you can change it " +"here." +msgstr "" +"Если ваш файл конфигурации не находится в местоположении по умолчанию, вы " +"можете изменить его здесь." + +#: src/ui/welcome.rs:69 src/ui/preferencespage.rs:59 +msgid "Configuration file" +msgstr "Файл конфигурации" + +#: src/ui/welcome.rs:106 src/ui/preferencespage.rs:109 +msgid "Flake file" +msgstr "Флаковый файл" + +#: src/ui/welcome.rs:107 +msgid "" +"If you are using flakes, you can specify the path to your flake.nix file " +"here." +msgstr "" +"Если вы используете флаки, вы можете указать путь к вашему файлу flake.nix " +"здесь." + +#: src/ui/welcome.rs:153 +msgid "Continue" +msgstr "Продолжить" + +#: src/ui/windowloading.rs:38 +msgid "Could not load cache" +msgstr "Не удалось загрузить кэш" + +#: src/ui/windowloading.rs:40 +msgid "Try connecting to the internet or launching the application again" +msgstr "Попробуйте подключиться к интернету или снова запустить приложение" + +#: src/ui/windowloading.rs:52 +msgid "Could not load options" +msgstr "Не удалось загрузить параметры" + +#: src/ui/windowloading.rs:53 src/ui/windowloading.rs:99 +msgid "Try launching the application again" +msgstr "Попробуйте запустить приложение снова" + +#: src/ui/windowloading.rs:64 src/ui/windowloading.rs:98 +msgid "Error loading configuration file" +msgstr "Ошибка загрузки файла конфигурации" + +#: src/ui/windowloading.rs:140 +msgid "Retry" +msgstr "Повторить попытку" + +#: src/ui/windowloading.rs:141 +msgid "Preferences" +msgstr "Предпочтения" + +#: src/ui/searchpage.rs:35 src/ui/window.rs:276 +msgid "Attributes" +msgstr "Атрибуты" + +#: src/ui/searchpage.rs:37 src/ui/window.rs:312 +msgid "Options" +msgstr "Параметры" + +#: src/ui/searchpage.rs:58 +msgid "No options found!" +msgstr "Вариантов нет!" + +#: src/ui/searchpage.rs:59 +msgid "Try a different search" +msgstr "Попробуйте другой поиск" + +#: src/ui/preferencespage.rs:91 +msgid "Use nix flakes" +msgstr "Использовать никс флаки" + +#: src/ui/preferencespage.rs:149 +msgid "Flake arguments (--flake path/to/flake.nix#<THIS ENTRY>)" +msgstr "Флейковые аргументы (--flake path/to/flake.nix#<THIS ENTRY>)" + +#: src/ui/window.rs:190 +msgid "Configuration Editor" +msgstr "Редактор конфигураций" + +#: src/ui/window.rs:270 +msgid "Loading..." +msgstr "Загрузка..." + +#: src/ui/window.rs:286 +msgid "" +msgstr "" + +#: src/ui/rebuild.rs:81 +msgid "Building..." +msgstr "Здание..." + +#: src/ui/rebuild.rs:95 +msgid "Done!" +msgstr "Готово!" + +#: src/ui/rebuild.rs:99 +msgid "Rebuild successful!" +msgstr "Восстановитесь успешно!" + +#: src/ui/rebuild.rs:113 +msgid "Error!" +msgstr "Ошибка!" + +#: src/ui/rebuild.rs:117 +msgid "Rebuild failed! See below for error message." +msgstr "Восстановление не удалось! Для получения сообщения об ошибке см. ниже." + +#: src/ui/rebuild.rs:150 +msgid "Close" +msgstr "Закрыть" + +#: src/ui/rebuild.rs:159 +msgid "Save Anyways" +msgstr "Сохранить в любом случае" + +#: src/ui/rebuild.rs:167 +msgid "Reset Changes" +msgstr "Сбросить изменения" + +#: src/ui/rebuild.rs:175 +msgid "Keep Editing" +msgstr "Продолжить редактирование" + +#: src/ui/nameentry.rs:34 +msgid "Enter a new value" +msgstr "Введите новое значение " + +#: src/ui/nameentry.rs:37 +msgid "Cancel" +msgstr "Отменить" + +#: src/ui/savechecking.rs:136 +msgid "Invalid configuration" +msgstr "Неверная конфигурация" + +#: src/ui/savechecking.rs:137 +msgid "Please fix the errors and try again." +msgstr "Пожалуйста, исправьте ошибки и попробуйте снова." + +#: src/ui/savechecking.rs:141 +msgid "Keep changes" +msgstr "Сохранить изменения" + +#: src/ui/savechecking.rs:143 +msgid "Edit" +msgstr "Редактировать" diff --git a/po/translations.pot b/po/translations.pot new file mode 100644 index 0000000..add4b8a --- /dev/null +++ b/po/translations.pot @@ -0,0 +1,234 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-15 19:47+0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/ui/quitdialog.rs:35 +msgid "Save Changes?" +msgstr "" + +#: src/ui/quitdialog.rs:36 +msgid "" +"Unsaved changes will be lost. You should rebuild your system now to ensure " +"you configured everything properly. You can also save your configuration, " +"however is is possible that your configuration is save in an unbuildable " +"state." +msgstr "" + +#: src/ui/quitdialog.rs:38 src/ui/windowloading.rs:142 +msgid "Quit" +msgstr "" + +#: src/ui/quitdialog.rs:39 src/ui/optionpage.rs:400 src/ui/nameentry.rs:36 +msgid "Save" +msgstr "" + +#: src/ui/quitdialog.rs:40 src/ui/window.rs:250 +msgid "Rebuild" +msgstr "" + +#: src/ui/optionpage.rs:82 +msgid "Description" +msgstr "" + +#: src/ui/optionpage.rs:132 +msgid "Type" +msgstr "" + +#: src/ui/optionpage.rs:158 +msgid "Default" +msgstr "" + +#: src/ui/optionpage.rs:211 +msgid "Example" +msgstr "" + +#: src/ui/optionpage.rs:265 +msgid "Value" +msgstr "" + +#: src/ui/optionpage.rs:297 +msgid "True" +msgstr "" + +#: src/ui/optionpage.rs:306 +msgid "False" +msgstr "" + +#: src/ui/optionpage.rs:334 +msgid "Attribute Value" +msgstr "" + +#: src/ui/optionpage.rs:379 src/ui/savechecking.rs:142 +msgid "Reset" +msgstr "" + +#: src/ui/optionpage.rs:387 +msgid "Clear" +msgstr "" + +#: src/ui/welcome.rs:56 +msgid "Welcome the NixOS Configuration Editor!" +msgstr "" + +#: src/ui/welcome.rs:61 +msgid "" +"If your configuration file is not in the default location, you can change it " +"here." +msgstr "" + +#: src/ui/welcome.rs:69 src/ui/preferencespage.rs:59 +msgid "Configuration file" +msgstr "" + +#: src/ui/welcome.rs:106 src/ui/preferencespage.rs:109 +msgid "Flake file" +msgstr "" + +#: src/ui/welcome.rs:107 +msgid "" +"If you are using flakes, you can specify the path to your flake.nix file " +"here." +msgstr "" + +#: src/ui/welcome.rs:153 +msgid "Continue" +msgstr "" + +#: src/ui/windowloading.rs:38 +msgid "Could not load cache" +msgstr "" + +#: src/ui/windowloading.rs:40 +msgid "Try connecting to the internet or launching the application again" +msgstr "" + +#: src/ui/windowloading.rs:52 +msgid "Could not load options" +msgstr "" + +#: src/ui/windowloading.rs:53 src/ui/windowloading.rs:99 +msgid "Try launching the application again" +msgstr "" + +#: src/ui/windowloading.rs:64 src/ui/windowloading.rs:98 +msgid "Error loading configuration file" +msgstr "" + +#: src/ui/windowloading.rs:140 +msgid "Retry" +msgstr "" + +#: src/ui/windowloading.rs:141 +msgid "Preferences" +msgstr "" + +#: src/ui/searchpage.rs:35 src/ui/window.rs:276 +msgid "Attributes" +msgstr "" + +#: src/ui/searchpage.rs:37 src/ui/window.rs:312 +msgid "Options" +msgstr "" + +#: src/ui/searchpage.rs:58 +msgid "No options found!" +msgstr "" + +#: src/ui/searchpage.rs:59 +msgid "Try a different search" +msgstr "" + +#: src/ui/preferencespage.rs:91 +msgid "Use nix flakes" +msgstr "" + +#: src/ui/preferencespage.rs:149 +msgid "Flake arguments (--flake path/to/flake.nix#<THIS ENTRY>)" +msgstr "" + +#: src/ui/window.rs:190 +msgid "Configuration Editor" +msgstr "" + +#: src/ui/window.rs:270 +msgid "Loading..." +msgstr "" + +#: src/ui/window.rs:286 +msgid "" +msgstr "" + +#: src/ui/rebuild.rs:81 +msgid "Building..." +msgstr "" + +#: src/ui/rebuild.rs:95 +msgid "Done!" +msgstr "" + +#: src/ui/rebuild.rs:99 +msgid "Rebuild successful!" +msgstr "" + +#: src/ui/rebuild.rs:113 +msgid "Error!" +msgstr "" + +#: src/ui/rebuild.rs:117 +msgid "Rebuild failed! See below for error message." +msgstr "" + +#: src/ui/rebuild.rs:150 +msgid "Close" +msgstr "" + +#: src/ui/rebuild.rs:159 +msgid "Save Anyways" +msgstr "" + +#: src/ui/rebuild.rs:167 +msgid "Reset Changes" +msgstr "" + +#: src/ui/rebuild.rs:175 +msgid "Keep Editing" +msgstr "" + +#: src/ui/nameentry.rs:34 +msgid "Enter a new value" +msgstr "" + +#: src/ui/nameentry.rs:37 +msgid "Cancel" +msgstr "" + +#: src/ui/savechecking.rs:136 +msgid "Invalid configuration" +msgstr "" + +#: src/ui/savechecking.rs:137 +msgid "Please fix the errors and try again." +msgstr "" + +#: src/ui/savechecking.rs:141 +msgid "Keep changes" +msgstr "" + +#: src/ui/savechecking.rs:143 +msgid "Edit" +msgstr "" diff --git a/po/uz.mo b/po/uz.mo new file mode 100644 index 0000000..ff59d72 Binary files /dev/null and b/po/uz.mo differ diff --git a/po/uz.po b/po/uz.po new file mode 100644 index 0000000..bf7d482 --- /dev/null +++ b/po/uz.po @@ -0,0 +1,244 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-15 19:47+0500\n" +"PO-Revision-Date: 2025-09-15 19:49+0500\n" +"Last-Translator: BeMeritus \n" +"Language-Team: \n" +"Language: uz\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" + +#: src/ui/quitdialog.rs:35 +msgid "Save Changes?" +msgstr "O‘zgarishlar saqlansinmi?" + +#: src/ui/quitdialog.rs:36 +msgid "" +"Unsaved changes will be lost. You should rebuild your system now to ensure " +"you configured everything properly. You can also save your configuration, " +"however is is possible that your configuration is save in an unbuildable " +"state." +msgstr "" +"Saqlanmagan o‘zgarishlar o‘chib ketadi. Hamma narsani to‘g‘ri " +"sozlaganingizga ishonch hosil qilish uchun tizimingizni hoziroq qayta " +"qurishingiz kerak. Konfiguratsiyangizni saqlashingiz ham mumkin, lekin " +"konfiguratsiyangiz qurilmaydigan holatda saqlangan bo‘lishi mumkin." + +#: src/ui/quitdialog.rs:38 src/ui/windowloading.rs:142 +msgid "Quit" +msgstr "Chiqish" + +#: src/ui/quitdialog.rs:39 src/ui/optionpage.rs:400 src/ui/nameentry.rs:36 +msgid "Save" +msgstr "Saqlash" + +#: src/ui/quitdialog.rs:40 src/ui/window.rs:250 +msgid "Rebuild" +msgstr "Qayta qurmoq" + +#: src/ui/optionpage.rs:82 +msgid "Description" +msgstr "Tavsif" + +#: src/ui/optionpage.rs:132 +msgid "Type" +msgstr "Tur" + +#: src/ui/optionpage.rs:158 +msgid "Default" +msgstr "Standart" + +#: src/ui/optionpage.rs:211 +msgid "Example" +msgstr "Misol" + +#: src/ui/optionpage.rs:265 +msgid "Value" +msgstr "Qiymat" + +#: src/ui/optionpage.rs:297 +msgid "True" +msgstr "To‘g‘ri" + +#: src/ui/optionpage.rs:306 +msgid "False" +msgstr "Xato" + +#: src/ui/optionpage.rs:334 +msgid "Attribute Value" +msgstr "Yolg‘on" + +#: src/ui/optionpage.rs:379 src/ui/savechecking.rs:142 +msgid "Reset" +msgstr "Asliga qaytarish" + +#: src/ui/optionpage.rs:387 +msgid "Clear" +msgstr "Tiniq" + +#: src/ui/welcome.rs:56 +msgid "Welcome the NixOS Configuration Editor!" +msgstr "NixOS konfiguratsiya muharririga xush kelibsiz!" + +#: src/ui/welcome.rs:61 +msgid "" +"If your configuration file is not in the default location, you can change it " +"here." +msgstr "" +"Agar konfiguratsiya faylingiz birlamchi joylashuvda bo‘lmasa, uni bu yerda " +"o‘zgartirishingiz mumkin." + +#: src/ui/welcome.rs:69 src/ui/preferencespage.rs:59 +msgid "Configuration file" +msgstr "Konfiguratsiya fayli" + +#: src/ui/welcome.rs:106 src/ui/preferencespage.rs:109 +msgid "Flake file" +msgstr "Flake fayl" + +#: src/ui/welcome.rs:107 +msgid "" +"If you are using flakes, you can specify the path to your flake.nix file " +"here." +msgstr "" +"Agar flakes ishlatayotgan bo‘lsangiz, bu yerda flake.nix fayliga yo‘lni " +"ko‘rsatishingiz mumkin." + +#: src/ui/welcome.rs:153 +msgid "Continue" +msgstr "Davom ettirish" + +#: src/ui/windowloading.rs:38 +msgid "Could not load cache" +msgstr "Kesh yuklanmadi" + +#: src/ui/windowloading.rs:40 +msgid "Try connecting to the internet or launching the application again" +msgstr "Internetga ulaning yoki ilovani qaytadan ishga tushiring" + +#: src/ui/windowloading.rs:52 +msgid "Could not load options" +msgstr "Variantlar yuklanmadi" + +#: src/ui/windowloading.rs:53 src/ui/windowloading.rs:99 +msgid "Try launching the application again" +msgstr "Ilovani qaytadan ishga tushiring" + +#: src/ui/windowloading.rs:64 src/ui/windowloading.rs:98 +msgid "Error loading configuration file" +msgstr "Konfiguratsiya faylini yuklashda xatolik yuz berdi" + +#: src/ui/windowloading.rs:140 +msgid "Retry" +msgstr "Qayta urinish" + +#: src/ui/windowloading.rs:141 +msgid "Preferences" +msgstr "Sozlamalar" + +#: src/ui/searchpage.rs:35 src/ui/window.rs:276 +msgid "Attributes" +msgstr "Atributlar" + +#: src/ui/searchpage.rs:37 src/ui/window.rs:312 +msgid "Options" +msgstr "Variantlar" + +#: src/ui/searchpage.rs:58 +msgid "No options found!" +msgstr "Hech qanday variant topilmadi!" + +#: src/ui/searchpage.rs:59 +msgid "Try a different search" +msgstr "Boshqa qidiruvni sinang" + +#: src/ui/preferencespage.rs:91 +msgid "Use nix flakes" +msgstr "Niks fleyklardan foydalaning" + +#: src/ui/preferencespage.rs:149 +msgid "Flake arguments (--flake path/to/flake.nix#<THIS ENTRY>)" +msgstr "Fleyk argumentlari (--flake path/to/flake.nix#<THIS ENTRY>)" + +#: src/ui/window.rs:190 +msgid "Configuration Editor" +msgstr "Konfiguratsiya muharriri" + +#: src/ui/window.rs:270 +msgid "Loading..." +msgstr "Yuklanmoqda..." + +#: src/ui/window.rs:286 +msgid "" +msgstr "" + +#: src/ui/rebuild.rs:81 +msgid "Building..." +msgstr "Qurilmoqda..." + +#: src/ui/rebuild.rs:95 +msgid "Done!" +msgstr "Bo‘ldi!" + +#: src/ui/rebuild.rs:99 +msgid "Rebuild successful!" +msgstr "Qayta qurish muvaffaqiyatli amalga oshirildi!" + +#: src/ui/rebuild.rs:113 +msgid "Error!" +msgstr "Xato!" + +#: src/ui/rebuild.rs:117 +msgid "Rebuild failed! See below for error message." +msgstr "" +"Qayta qurish amalga oshmadi! Xatolik xabari uchun quyidagilarga qarang." + +#: src/ui/rebuild.rs:150 +msgid "Close" +msgstr "Yopish" + +#: src/ui/rebuild.rs:159 +msgid "Save Anyways" +msgstr "Baribir saqlash" + +#: src/ui/rebuild.rs:167 +msgid "Reset Changes" +msgstr "O‘zgarishlarni tiklash" + +#: src/ui/rebuild.rs:175 +msgid "Keep Editing" +msgstr "Tahrirlashda davom etish" + +#: src/ui/nameentry.rs:34 +msgid "Enter a new value" +msgstr "Yangi qiymatini kiriting" + +#: src/ui/nameentry.rs:37 +msgid "Cancel" +msgstr "Bekor qilish" + +#: src/ui/savechecking.rs:136 +msgid "Invalid configuration" +msgstr "Konfiguratsiya yaroqsiz" + +#: src/ui/savechecking.rs:137 +msgid "Please fix the errors and try again." +msgstr "Iltimos, xatolarni tuzating va qayta urining." + +#: src/ui/savechecking.rs:141 +msgid "Keep changes" +msgstr "O‘zgarishlarni saqlash" + +#: src/ui/savechecking.rs:143 +msgid "Edit" +msgstr "Tahrirlash" diff --git a/src/ui/about.rs b/src/ui/about.rs index 062470e..16c344b 100644 --- a/src/ui/about.rs +++ b/src/ui/about.rs @@ -27,6 +27,7 @@ impl SimpleComponent for AboutPageModel { set_developers: &[ "Orzklv https://github.com/orzklv", "bahrom04 https://github.com/bahrom04", + "BeMeritus https://github.com/bemeritus", "Victor Fuentes https://github.com/vlinkz" ], } diff --git a/src/ui/nameentry.rs b/src/ui/nameentry.rs index 7725855..24821d1 100644 --- a/src/ui/nameentry.rs +++ b/src/ui/nameentry.rs @@ -1,5 +1,6 @@ use super::window::*; use adw::prelude::*; +use gettextrs::gettext; use relm4::*; pub struct NameEntryModel { @@ -30,10 +31,10 @@ impl SimpleComponent for NameEntryModel { set_modal: true, #[watch] set_visible: !model.hidden, - set_text: Some("Enter a new value"), + set_text: Some(&gettext("Enter a new value")), set_secondary_text: None, - add_button: ("Save", gtk::ResponseType::Accept), - add_button: ("Cancel", gtk::ResponseType::Cancel), + add_button: (&gettext("Save"), gtk::ResponseType::Accept), + add_button: (&gettext("Cancel"), gtk::ResponseType::Cancel), connect_response[sender] => move |_, resp| { sender.input(match resp { gtk::ResponseType::Accept => NameEntryMsg::Save, diff --git a/src/ui/optionpage.rs b/src/ui/optionpage.rs index 77af606..f9ef7c0 100644 --- a/src/ui/optionpage.rs +++ b/src/ui/optionpage.rs @@ -2,6 +2,7 @@ use super::savechecking::*; use super::window::*; use crate::parse::options::OptionData; use adw::prelude::*; +use gettextrs::gettext; use html2pango; use log::*; use pandoc::{self, MarkdownExtension}; @@ -78,7 +79,7 @@ impl SimpleComponent for OptPageModel { gtk::Label { set_halign: gtk::Align::Start, add_css_class: "heading", - set_label: "Description", + set_label: &gettext("Description"), } }, #[name(desc)] @@ -128,7 +129,7 @@ impl SimpleComponent for OptPageModel { gtk::Label { set_halign: gtk::Align::Start, add_css_class: "heading", - set_label: "Type", + set_label: &gettext("Type"), } }, gtk::Label { @@ -154,7 +155,7 @@ impl SimpleComponent for OptPageModel { gtk::Label { set_halign: gtk::Align::Start, add_css_class: "heading", - set_label: "Default", + set_label: &gettext("Default"), } }, gtk::Frame { @@ -207,7 +208,7 @@ impl SimpleComponent for OptPageModel { set_halign: gtk::Align::Start, add_css_class: "heading", add_css_class: "h4", - set_label: "Example", + set_label: &gettext("Example"), } }, gtk::Frame { @@ -261,7 +262,7 @@ impl SimpleComponent for OptPageModel { append = >k::Label { set_halign: gtk::Align::Start, add_css_class: "heading", - set_label: "Value", + set_label: &gettext("Value"), } }, #[name(valuestack)] @@ -293,7 +294,7 @@ impl SimpleComponent for OptPageModel { set_orientation: gtk::Orientation::Horizontal, #[name(truebtn)] gtk::ToggleButton { - set_label: "True", + set_label: &gettext("True"), connect_toggled[sender] => move |x| { if x.is_active() { sender.input(OptPageMsg::UpdateConfMod(String::from("true"))) @@ -302,7 +303,7 @@ impl SimpleComponent for OptPageModel { }, #[name(falsebtn)] gtk::ToggleButton { - set_label: "False", + set_label: &gettext("False"), set_group: Some(&truebtn), connect_toggled[sender] => move |x| { if x.is_active() { @@ -330,7 +331,7 @@ impl SimpleComponent for OptPageModel { gtk::Label { set_halign: gtk::Align::Start, add_css_class: "heading", - set_label: "Attribute Value", + set_label: &gettext("Attribute Value"), } }, gtk::Frame { @@ -375,7 +376,7 @@ impl SimpleComponent for OptPageModel { set_orientation: gtk::Orientation::Horizontal, set_spacing: 10, gtk::Button { - set_label: "Reset", + set_label: &gettext("Reset"), #[watch] set_sensitive: model.conf != model.modifiedconf, connect_clicked[sender] => move |_| { @@ -383,7 +384,7 @@ impl SimpleComponent for OptPageModel { } }, gtk::Button { - set_label: "Clear", + set_label: &gettext("Clear"), #[watch] set_sensitive: !model.modifiedconf.is_empty(), connect_clicked[sender] => move |_| { @@ -396,7 +397,7 @@ impl SimpleComponent for OptPageModel { set_hexpand: true, #[name(savebtn)] gtk::Button { - set_label: "Save", + set_label: &gettext("Save"), add_css_class: "suggested-action", #[watch] set_sensitive: model.conf != model.modifiedconf, diff --git a/src/ui/preferencespage.rs b/src/ui/preferencespage.rs index 80fd9f8..4278cb6 100644 --- a/src/ui/preferencespage.rs +++ b/src/ui/preferencespage.rs @@ -1,5 +1,6 @@ use super::window::AppMsg; use adw::prelude::*; +use gettextrs::gettext; use nix_data::config::configfile::NixDataConfig; use relm4::*; use relm4_components::open_dialog::*; @@ -55,7 +56,7 @@ impl SimpleComponent for PreferencesPageModel { add = &adw::PreferencesPage { add = &adw::PreferencesGroup { add = &adw::ActionRow { - set_title: "Configuration file", + set_title: &gettext("Configuration file"), add_suffix = >k::Box { set_orientation: gtk::Orientation::Horizontal, set_halign: gtk::Align::End, @@ -87,7 +88,7 @@ impl SimpleComponent for PreferencesPageModel { } }, add = &adw::ActionRow { - set_title: "Use nix flakes", + set_title: &gettext("Use nix flakes"), add_suffix = >k::Switch { set_valign: gtk::Align::Center, connect_state_set[sender] => move |_, b| { @@ -105,7 +106,7 @@ impl SimpleComponent for PreferencesPageModel { } }, add = &adw::ActionRow { - set_title: "Flake file", + set_title: &gettext("Flake file"), #[watch] set_visible: model.flake.is_some(), add_suffix = >k::Box { @@ -145,7 +146,7 @@ impl SimpleComponent for PreferencesPageModel { add = &adw::EntryRow { #[watch] set_visible: model.flake.is_some(), - set_title: "Flake arguments (--flake path/to/flake.nix#<THIS ENTRY>)", + set_title: &gettext("Flake arguments (--flake path/to/flake.nix#<THIS ENTRY>)"), connect_changed[sender] => move |x| { sender.input(PreferencesPageMsg::SetFlakeArg({ let text = x.text().to_string(); diff --git a/src/ui/quitdialog.rs b/src/ui/quitdialog.rs index 81ab3f1..079f584 100644 --- a/src/ui/quitdialog.rs +++ b/src/ui/quitdialog.rs @@ -1,5 +1,6 @@ use super::window::AppMsg; use adw::prelude::*; +use gettextrs::gettext; use relm4::*; pub struct QuitCheckModel { @@ -31,12 +32,12 @@ impl SimpleComponent for QuitCheckModel { set_resizable: false, #[watch] set_sensitive: !model.busy, - set_text: Some("Save Changes?"), - set_secondary_text: Some("Unsaved changes will be lost. You should rebuild your system now to ensure you configured everything properly. You can also save your configuration, however is is possible that your configuration is save in an unbuildable state."), + set_text: Some(&gettext("Save Changes?")), + set_secondary_text: Some(&gettext("Unsaved changes will be lost. You should rebuild your system now to ensure you configured everything properly. You can also save your configuration, however is is possible that your configuration is save in an unbuildable state.")), set_default_width: 500, - add_button: ("Quit", gtk::ResponseType::Close), - add_button: ("Save", gtk::ResponseType::Reject), - add_button: ("Rebuild", gtk::ResponseType::Accept), + add_button: (&gettext("Quit"), gtk::ResponseType::Close), + add_button: (&gettext("Save"), gtk::ResponseType::Reject), + add_button: (&gettext("Rebuild"), gtk::ResponseType::Accept), connect_response[sender] => move |_, resp| { sender.input(match resp { gtk::ResponseType::Accept => QuitCheckMsg::Rebuild, diff --git a/src/ui/rebuild.rs b/src/ui/rebuild.rs index a36a6f7..26f1d48 100644 --- a/src/ui/rebuild.rs +++ b/src/ui/rebuild.rs @@ -1,6 +1,7 @@ use super::window::AppMsg; use crate::config::LIBEXECDIR; use adw::prelude::*; +use gettextrs::gettext; use gtk::{gio, glib}; use relm4::*; use std::io::Write; @@ -77,7 +78,7 @@ impl SimpleComponent for RebuildModel { set_height_request: 60, }, gtk::Label { - set_label: "Building...", + set_label: &gettext("Building..."), add_css_class: "title-1", }, }, @@ -91,11 +92,11 @@ impl SimpleComponent for RebuildModel { set_pixel_size: 128, }, gtk::Label { - set_label: "Done!", + set_label: &gettext("Done!"), add_css_class: "title-1", }, gtk::Label { - set_label: "Rebuild successful!", + set_label: &gettext("Rebuild successful!"), add_css_class: "dim-label", } }, @@ -109,11 +110,11 @@ impl SimpleComponent for RebuildModel { set_pixel_size: 128, }, gtk::Label { - set_label: "Error!", + set_label: &gettext("Error!"), add_css_class: "title-1", }, gtk::Label { - set_label: "Rebuild failed! See below for error message.", + set_label: &gettext("Rebuild failed! See below for error message."), add_css_class: "dim-label", } } @@ -146,7 +147,7 @@ impl SimpleComponent for RebuildModel { #[track(model.changed(RebuildModel::status()))] set_visible: model.status != RebuildStatus::Building, gtk::Button { - set_label: "Close", + set_label: &gettext("Close"), #[track(model.changed(RebuildModel::status()))] set_visible: model.status == RebuildStatus::Success, connect_clicked[sender] => move |_| { @@ -155,7 +156,7 @@ impl SimpleComponent for RebuildModel { }, gtk::Button { add_css_class: "destructive-action", - set_label: "Save Anyways", + set_label: &gettext("Save Anyways"), #[track(model.changed(RebuildModel::status()))] set_visible: model.status == RebuildStatus::Error, connect_clicked[sender] => move |_| { @@ -163,7 +164,7 @@ impl SimpleComponent for RebuildModel { } }, gtk::Button { - set_label: "Reset Changes", + set_label: &gettext("Reset Changes"), #[track(model.changed(RebuildModel::status()))] set_visible: model.status == RebuildStatus::Error, connect_clicked[sender] => move |_| { @@ -171,7 +172,7 @@ impl SimpleComponent for RebuildModel { } }, gtk::Button { - set_label: "Keep Editing", + set_label: &gettext("Keep Editing"), #[track(model.changed(RebuildModel::status()))] set_visible: model.status == RebuildStatus::Error, connect_clicked[sender] => move |_| { diff --git a/src/ui/savechecking.rs b/src/ui/savechecking.rs index 1a1e86c..ab9720b 100644 --- a/src/ui/savechecking.rs +++ b/src/ui/savechecking.rs @@ -1,6 +1,7 @@ use super::window::AppMsg; use crate::ui::optionpage::OptPageMsg; use adw::prelude::*; +use gettextrs::gettext; use log::{debug, info}; use relm4::*; use sourceview5::prelude::*; @@ -132,14 +133,14 @@ impl SimpleComponent for SaveErrorModel { set_modal: true, #[watch] set_visible: !model.hidden, - set_text: Some("Invalid configuration"), - set_secondary_text: Some("Please fix the errors and try again."), + set_text: Some(&gettext("Invalid configuration")), + set_secondary_text: Some(&gettext("Please fix the errors and try again.")), #[watch] set_default_height: -1, set_default_width: 500, - add_button: ("Keep changes", gtk::ResponseType::DeleteEvent), - add_button: ("Reset", gtk::ResponseType::Reject), - add_button: ("Edit", gtk::ResponseType::Cancel), + add_button: (&gettext("Keep changes"), gtk::ResponseType::DeleteEvent), + add_button: (&gettext("Reset"), gtk::ResponseType::Reject), + add_button: (&gettext("Edit"), gtk::ResponseType::Cancel), connect_response[sender] => move |_, resp| { sender.input(match resp { gtk::ResponseType::DeleteEvent => SaveErrorMsg::SaveError, diff --git a/src/ui/searchpage.rs b/src/ui/searchpage.rs index 38807c1..93d4f8f 100644 --- a/src/ui/searchpage.rs +++ b/src/ui/searchpage.rs @@ -1,6 +1,7 @@ use super::{searchfactory::SearchOption, window::*}; use crate::parse::config::opconfigured; use adw::prelude::*; +use gettextrs::gettext; use relm4::{factory::*, *}; use std::{cmp::Ordering, collections::HashMap}; @@ -31,9 +32,9 @@ impl SimpleComponent for SearchPageModel { set_transition_type: gtk::StackTransitionType::Crossfade, #[name(options)] adw::PreferencesPage { - set_title: "Attributes", + set_title: &gettext("Attributes"), add = &adw::PreferencesGroup { - set_title: "Options", + set_title: &gettext("Options"), #[local_ref] add = oplstbox -> gtk::ListBox { add_css_class: "boxed-list", @@ -54,8 +55,8 @@ impl SimpleComponent for SearchPageModel { set_valign: gtk::Align::Center, adw::StatusPage { set_icon_name: Some("edit-find-symbolic"), - set_title: "No options found!", - set_description: Some("Try a different search"), + set_title: &gettext("No options found!"), + set_description: Some(&gettext("Try a different search")), }, } } diff --git a/src/ui/welcome.rs b/src/ui/welcome.rs index b95384e..64fd8d0 100644 --- a/src/ui/welcome.rs +++ b/src/ui/welcome.rs @@ -1,5 +1,6 @@ use super::window::AppMsg; use adw::prelude::*; +use gettextrs::gettext; use log::info; use nix_data::config::configfile::NixDataConfig; use relm4::*; @@ -52,12 +53,12 @@ impl SimpleComponent for WelcomeModel { set_spacing: 10, gtk::Label { add_css_class: "title-1", - set_text: "Welcome the NixOS Configuration Editor!", + set_text: &gettext("Welcome the NixOS Configuration Editor!"), set_justify: gtk::Justification::Center, }, gtk::Label { add_css_class: "dim-label", - set_text: "If your configuration file is not in the default location, you can change it here.", + set_text: &gettext("If your configuration file is not in the default location, you can change it here."), }, }, gtk::ListBox { @@ -65,7 +66,7 @@ impl SimpleComponent for WelcomeModel { set_halign: gtk::Align::Fill, set_selection_mode: gtk::SelectionMode::None, adw::ActionRow { - set_title: "Configuration file", + set_title: &gettext("Configuration file"), add_suffix = >k::Button { set_halign: gtk::Align::Center, set_valign: gtk::Align::Center, @@ -102,8 +103,8 @@ impl SimpleComponent for WelcomeModel { set_halign: gtk::Align::Fill, set_selection_mode: gtk::SelectionMode::None, adw::ActionRow { - set_title: "Flake file", - set_subtitle: "If you are using flakes, you can specify the path to your flake.nix file here.", + set_title: &gettext("Flake file"), + set_subtitle: &gettext("If you are using flakes, you can specify the path to your flake.nix file here."), add_suffix = >k::Button { set_halign: gtk::Align::Center, set_valign: gtk::Align::Center, @@ -149,7 +150,7 @@ impl SimpleComponent for WelcomeModel { set_sensitive: model.confpath.is_some(), add_css_class: "pill", add_css_class: "suggested-action", - set_label: "Continue", + set_label: &gettext("Continue"), set_hexpand: false, set_halign: gtk::Align::Center, connect_clicked[sender] => move |_| { diff --git a/src/ui/window.rs b/src/ui/window.rs index ac73cd4..0cb6352 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -32,6 +32,7 @@ use crate::ui::rebuild::RebuildMsg; use crate::ui::searchentry::SearchEntryMsg; use crate::ui::windowloading::LoadErrorMsg; use adw::prelude::*; +use gettextrs::gettext; use log::*; use nix_data::config::configfile::NixDataConfig; use relm4::gtk::glib::object::Cast; @@ -186,7 +187,7 @@ impl SimpleComponent for AppModel { set_transition_type: gtk::StackTransitionType::Crossfade, #[name(title)] gtk::Label { - set_label: "Configuration Editor", + set_label: &gettext("Configuration Editor"), }, #[name(buttons)] @@ -246,7 +247,7 @@ impl SimpleComponent for AppModel { }, }, pack_start = >k::Button { - set_label: "Rebuild", + set_label: &gettext("Rebuild"), connect_clicked[sender] => move |_| { sender.input(AppMsg::Rebuild); }, @@ -266,13 +267,13 @@ impl SimpleComponent for AppModel { set_height_request: 80, }, gtk::Label { - set_label: "Loading...", + set_label: &gettext("Loading..."), }, }, #[name(treeview)] adw::PreferencesPage { add: attrgroup = &adw::PreferencesGroup { - set_title: "Attributes", + set_title: &gettext("Attributes"), #[track(model.changed(AppModel::position()))] set_visible: !model.attributes.is_empty() || model.nameorstar != AddAttrOptions::None, #[local_ref] @@ -282,7 +283,7 @@ impl SimpleComponent for AppModel { append: addrow = &adw::PreferencesRow { // Change to suffix once libadwaita-rs 0.2 is out #[track(model.changed(AppModel::nameorstar()))] set_visible: model.nameorstar != AddAttrOptions::None, - set_title: "", + set_title: &gettext(""), #[wrap(Some)] set_child = >k::Box { set_margin_all: 15, @@ -308,7 +309,7 @@ impl SimpleComponent for AppModel { }, }, add = &adw::PreferencesGroup { - set_title: "Options", + set_title: &gettext("Options"), #[track(model.changed(AppModel::position()))] set_visible: !model.options.is_empty(), #[local_ref] diff --git a/src/ui/windowloading.rs b/src/ui/windowloading.rs index 761d000..8c3ec86 100644 --- a/src/ui/windowloading.rs +++ b/src/ui/windowloading.rs @@ -2,6 +2,7 @@ use super::window::{AppMsg, LoadValues}; use crate::parse::config::parseconfig; use crate::parse::options::read; use crate::parse::preferences::editconfig; +use gettextrs::gettext; use log::*; use nix_data::config::configfile::NixDataConfig; use relm4::adw::prelude::*; @@ -34,10 +35,10 @@ impl Worker for WindowAsyncHandler { Err(e) => { error!("{}", e); let _ = sender.output(AppMsg::LoadError( - String::from("Could not load cache"), - String::from( + String::from(&gettext("Could not load cache")), + String::from(&gettext( "Try connecting to the internet or launching the application again", - ), + )), )); return; } @@ -48,8 +49,8 @@ impl Worker for WindowAsyncHandler { Err(e) => { error!("{}", e); let _ = sender.output(AppMsg::LoadError( - String::from("Could not load options"), - String::from("Try launching the application again"), + String::from(&gettext("Could not load options")), + String::from(&gettext("Try launching the application again")), )); return; } @@ -60,7 +61,7 @@ impl Worker for WindowAsyncHandler { Err(e) => { error!("{}", e); let _ = sender.output(AppMsg::LoadError( - String::from("Error loading configuration file"), + String::from(&gettext("Error loading configuration file")), format!("{} may be an invalid configuration file", path), )); return; @@ -94,8 +95,8 @@ impl Worker for WindowAsyncHandler { let _ = match editconfig(cfg) { Ok(_) => sender.output(AppMsg::TryLoad), Err(_) => sender.output(AppMsg::LoadError( - String::from("Error loading configuration file"), - String::from("Try launching the application again"), + String::from(&gettext("Error loading configuration file")), + String::from(&gettext("Try launching the application again")), )), }; } @@ -136,9 +137,9 @@ impl SimpleComponent for LoadErrorModel { set_secondary_text: Some(&model.msg2), set_use_markup: true, set_secondary_use_markup: true, - add_button: ("Retry", gtk::ResponseType::Accept), - add_button: ("Preferences", gtk::ResponseType::Help), - add_button: ("Quit", gtk::ResponseType::Close), + add_button: (&gettext("Retry"), gtk::ResponseType::Accept), + add_button: (&gettext("Preferences"), gtk::ResponseType::Help), + add_button: (&gettext("Quit"), gtk::ResponseType::Close), connect_response[sender] => move |_, resp| { sender.input(match resp { gtk::ResponseType::Accept => LoadErrorMsg::Retry,