From 681ad018359655b923914ae293bf5a3e9d12623c Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sat, 25 Feb 2023 16:06:43 +0200 Subject: [PATCH] feat(i18n): added localization to first run window --- assets/locales/common.ftl | 15 ++++++ assets/locales/en/errors.ftl | 8 +++ assets/locales/en/first_run.ftl | 55 +++++++++++++++++++ assets/locales/en/main.ftl | 5 ++ assets/locales/ru/errors.ftl | 8 +++ assets/locales/ru/first_run.ftl | 57 ++++++++++++++++++++ assets/locales/ru/main.ftl | 5 ++ src/i18n.rs | 1 + src/ui/first_run/default_paths.rs | 24 ++++----- src/ui/first_run/dependencies.rs | 17 +++--- src/ui/first_run/download_components.rs | 36 ++++++------- src/ui/first_run/finish.rs | 8 +-- src/ui/first_run/main.rs | 14 ++--- src/ui/first_run/select_voiceovers.rs | 14 ++--- src/ui/first_run/tos_warning.rs | 71 ++++--------------------- src/ui/first_run/welcome.rs | 7 +-- 16 files changed, 225 insertions(+), 120 deletions(-) create mode 100644 assets/locales/common.ftl create mode 100644 assets/locales/en/first_run.ftl create mode 100644 assets/locales/ru/first_run.ftl diff --git a/assets/locales/common.ftl b/assets/locales/common.ftl new file mode 100644 index 0000000..2f25107 --- /dev/null +++ b/assets/locales/common.ftl @@ -0,0 +1,15 @@ +-company-name-1 = mi +-company-name-2 = Ho +-company-name-3 = Yo +company-name = {-company-name-1}{-company-name-2}{-company-name-3} + +-company-alter-name-1 = CO +-company-alter-name-2 = GNOS +-company-alter-name-3 = PHERE +company-alter-name = {-company-alter-name-1}{-company-alter-name-2}{-company-alter-name-3} + +-game-name-1 = Gens +-game-name-2 = hin +-game-name-3 = Imp +-game-name-4 = act +game-name = {-game-name-1}{-game-name-2} {-game-name-3}{-game-name-4} diff --git a/assets/locales/en/errors.ftl b/assets/locales/en/errors.ftl index 503c05c..2db4aff 100644 --- a/assets/locales/en/errors.ftl +++ b/assets/locales/en/errors.ftl @@ -9,3 +9,11 @@ background-downloading-failed = Failed to download background picture config-update-error = Failed to save config wine-prefix-update-failed = Failed to update wine prefix dxvk-install-failed = Failed to install DXVK + +package-not-available = Package is not available: {$package} +wine-download-error = Failed to download wine +wine-unpack-errror = Failed to unpack wine +wine-install-failed = Failed to install wine +dxvk-download-error = Failed to download dxvk +dxvk-unpack-error = Failed to unpack dxvk +dxvk-apply-error = Failed to apply DXVK diff --git a/assets/locales/en/first_run.ftl b/assets/locales/en/first_run.ftl new file mode 100644 index 0000000..070c797 --- /dev/null +++ b/assets/locales/en/first_run.ftl @@ -0,0 +1,55 @@ +welcome = Welcome + +welcome-page-message = + Hi there! Welcome to the An Anime Game Launcher + + We need to prepare some stuff and download default components before you could run the game + + +tos-violation-warning = ToS violation warning + +tos-violation-warning-message = + This launcher is an unofficial tool, in no way related to {company-name} nor {company-alter-name}. + + This tool is designed to facilitate playing {game-name} on Linux, and was built with the sole purpose of installing and running the game with less hassle. + + It does so by using existing components and making the experience simple for the user. + + However, some components used here likely break the {company-name} Terms of Service for {game-name}. + + If you are using this launcher, your player account could become identified as TOS-non-compliant by {company-name}/{company-alter-name}. + + If this happens, as your account would be disobeying TOS, {company-name}/{company-alter-name} are free to do what they want. Including banning. + + If you understand the risk of trying to play the game in an unofficial capacity, press OK and let's go researching the world of Teyvat! + + +dependencies = Dependencies +missing-dependencies-title = You're missing some dependencies! +missing-dependencies-message = You must install some packages to your system before continue installation process + + +default-paths = Default paths +choose-default-paths = Choose default paths +launcher-folder = Launcher folder +show-all-folders = I know what I'm doing +show-all-folders-subtitle = Show additional path selection settings. Do as I say... +runners-folder = Runners folder +dxvks-folder = DXVKs folder +wine-prefix-folder = Wine prefix folder +game-installation-folder = Game installation folder +patch-folder = Patch folder +temp-folder = Temp folder + + +select-voice-packages = Select voice packages + + +download-components = Download components +download-dxvk = Download DXVK +apply-dxvk = Apply DXVK + + +finish = Finish +finish-title = Everything's done! +finish-message = All the basic components were downloaded. Now you can restart the launcher and download the game. Welcome to our club! diff --git a/assets/locales/en/main.ftl b/assets/locales/en/main.ftl index 88fc2e7..e047d55 100644 --- a/assets/locales/en/main.ftl +++ b/assets/locales/en/main.ftl @@ -2,8 +2,13 @@ custom = Custom none = None default = Default details = Details + close = Close save = Save +continue = Continue +exit = Exit +check = Check +restart = Restart downloading-background-picture = Downloading background picture diff --git a/assets/locales/ru/errors.ftl b/assets/locales/ru/errors.ftl index 14f9f6d..48d4a08 100644 --- a/assets/locales/ru/errors.ftl +++ b/assets/locales/ru/errors.ftl @@ -9,3 +9,11 @@ background-downloading-failed = Не удалось загрузить фоно config-update-error = Ошибка сохранения настроек wine-prefix-update-failed = Ошибка обновления префикса Wine dxvk-install-failed = Ошибка установки DXVK + +package-not-available = Пакет недоступен: {$package} +wine-download-error = Ошибка скачивания Wine +wine-unpack-errror = Ошибка распаковки Wine +wine-install-failed = Ошибка установки Wine +dxvk-download-error = Ошибка скачивания DXVK +dxvk-unpack-error = Ошибка распаковки DXVK +dxvk-apply-error = Не удалось применить DXVK diff --git a/assets/locales/ru/first_run.ftl b/assets/locales/ru/first_run.ftl new file mode 100644 index 0000000..3b60af6 --- /dev/null +++ b/assets/locales/ru/first_run.ftl @@ -0,0 +1,57 @@ +welcome = Добро пожаловать + +welcome-page-message = + Приветствую! Добро пожаловать в An Anime Game Launcher + + Нам необходимо подготовить пару вещей и установить стандартные компоненты перед тем, как ты сможешь запустить игру + + +tos-violation-warning = Нарушение пользовательского соглашения + +tos-violation-warning-message = + Этот лаунчер является неофициальным и ни в коем случае не относится к {company-name} или {company-alter-name}. + + Он был разработан с целью предоставления возможности игры в {game-name} на Linux. + + Его главная цель - помочь установить и запустить игру с меньшими хлопотами. + + Это достигается за счет использования существующих компонентов и упрощения работы пользователя. + + Однако, некоторые компоненты, используемые здесь, вероятно нарушают пользовательское соглашение {game-name}, принадлежащей {company-name}. + + Если вы используете данный лаунчер - ваш игровой аккаунт может быть признан как нарушающий пользовательское соглашение {company-name}/{company-alter-name}. + + Если это произойдёт - поскольку ваша учетная запись будет нарушать правила, {company-name}/{company-alter-name} будут свободы делать то, что захотят, включая блокировку вашего аккаунта. + + Если вы осознаёте риск использования неофициальных средств игры - нажмите "Продолжить" и отправляйтесь исследовать мир Тейвата! + + +dependencies = Зависимости +missing-dependencies-title = У вас не установлены некоторые компоненты! +missing-dependencies-message = Вы должны установить некоторые системные пакеты чтобы продолжить процесс установки + + +default-paths = Пути по умолчанию +choose-default-paths = Выбрать пути по умолчанию +launcher-folder = Папка лаунчера +show-all-folders = Я знаю что я делаю +show-all-folders-subtitle = Отобразить дополнительные опции выбора путей +runners-folder = Папка версий Wine +dxvks-folder = Папка версий DXVK +wine-prefix-folder = Папка префикса Wine +game-installation-folder = Путь установки игры +patch-folder = Папка скачивания патча +temp-folder = Временная папка + + +select-voice-packages = Выбрать языковые пакеты + + +download-components = Скачать компоненты +download-dxvk = Скачать DXVK +apply-dxvk = Применить DXVK + + +finish = Завершение +finish-title = Работа завершена! +finish-message = Все базовые компоненты были установлены. Теперь вы можете перезапустить лаунчер и установить игру. Добро пожаловать в клуб! diff --git a/assets/locales/ru/main.ftl b/assets/locales/ru/main.ftl index 12e965b..c6a56ad 100644 --- a/assets/locales/ru/main.ftl +++ b/assets/locales/ru/main.ftl @@ -2,8 +2,13 @@ custom = Свое значение none = Нет default = По умолчанию details = Подробнее + close = Закрыть save = Сохранить +continue = Продолжить +exit = Выйти +check = Проверить +restart = Перезапустить downloading-background-picture = Загрузка фонового изображения diff --git a/src/i18n.rs b/src/i18n.rs index bc89bd4..ac4b6b3 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -4,6 +4,7 @@ use unic_langid::{langid, LanguageIdentifier}; fluent_templates::static_loader! { static LOCALES = { locales: "./assets/locales", + core_locales: "./assets/locales/common.ftl", fallback_language: "en" }; } diff --git a/src/ui/first_run/default_paths.rs b/src/ui/first_run/default_paths.rs index 7d223c8..8cacacb 100644 --- a/src/ui/first_run/default_paths.rs +++ b/src/ui/first_run/default_paths.rs @@ -57,7 +57,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { set_vexpand: true, gtk::Label { - set_label: "Choose default paths", + set_label: &tr("choose-default-paths"), add_css_class: "title-1" } }, @@ -67,7 +67,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { set_vexpand: true, adw::ActionRow { - set_title: "Launcher folder", + set_title: &tr("launcher-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -83,8 +83,8 @@ impl SimpleAsyncComponent for DefaultPathsApp { set_vexpand: true, adw::ActionRow { - set_title: "I know what I'm doing", - set_subtitle: "Show additional path selection settings. Do as I say...", + set_title: &tr("show-all-folders"), + set_subtitle: &tr("show-all-folders-subtitle"), add_suffix = >k::Switch { set_valign: gtk::Align::Center, @@ -102,7 +102,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { set_visible: model.show_additional, adw::ActionRow { - set_title: "Runners folder", + set_title: &tr("runners-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -113,7 +113,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { }, adw::ActionRow { - set_title: "DXVKs folder", + set_title: &tr("dxvks-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -124,7 +124,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { }, adw::ActionRow { - set_title: "Wine prefix folder", + set_title: &tr("wine-prefix-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -135,7 +135,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { }, adw::ActionRow { - set_title: "Game installation folder", + set_title: &tr("game-installation-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -146,7 +146,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { }, adw::ActionRow { - set_title: "Patch folder", + set_title: &tr("patch-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -157,7 +157,7 @@ impl SimpleAsyncComponent for DefaultPathsApp { }, adw::ActionRow { - set_title: "Temp folder", + set_title: &tr("temp-folder"), set_icon_name: Some("folder-symbolic"), set_activatable: true, @@ -178,14 +178,14 @@ impl SimpleAsyncComponent for DefaultPathsApp { set_spacing: 8, gtk::Button { - set_label: "Continue", + set_label: &tr("continue"), set_css_classes: &["suggested-action", "pill"], connect_clicked => DefaultPathsAppMsg::Continue }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => DefaultPathsAppMsg::Exit diff --git a/src/ui/first_run/dependencies.rs b/src/ui/first_run/dependencies.rs index d923437..b848cf6 100644 --- a/src/ui/first_run/dependencies.rs +++ b/src/ui/first_run/dependencies.rs @@ -7,6 +7,7 @@ use anime_launcher_sdk::is_available; use std::process::{Command, Stdio}; +use crate::i18n::*; use super::main::FirstRunAppMsg; pub struct DependenciesApp { @@ -36,12 +37,12 @@ impl SimpleAsyncComponent for DependenciesApp { set_vexpand: true, gtk::Label { - set_label: "You're missing some dependencies!", + set_label: &tr("missing-dependencies-title"), add_css_class: "title-1" }, gtk::Label { - set_label: "You must install some packages to your system before continue installation process", + set_label: &tr("missing-dependencies-message"), set_justify: gtk::Justification::Center, set_wrap: true, @@ -120,14 +121,14 @@ impl SimpleAsyncComponent for DependenciesApp { set_spacing: 8, gtk::Button { - set_label: "Check", + set_label: &tr("check"), set_css_classes: &["suggested-action", "pill"], connect_clicked => DependenciesAppMsg::Continue }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => DependenciesAppMsg::Exit @@ -149,13 +150,13 @@ impl SimpleAsyncComponent for DependenciesApp { }; // Decide which packaging format used in system - match Command::new("pacman").stdout(Stdio::null()).spawn() { + match Command::new("pacman").stdout(Stdio::null()).stderr(Stdio::null()).spawn() { Ok(_) => model.show_arch = true, - Err(_) => match Command::new("apt").stdout(Stdio::null()).spawn() { + Err(_) => match Command::new("apt").stdout(Stdio::null()).stderr(Stdio::null()).spawn() { Ok(_) => model.show_debian = true, - Err(_) => match Command::new("dnf").stdout(Stdio::null()).spawn() { + Err(_) => match Command::new("dnf").stdout(Stdio::null()).stderr(Stdio::null()).spawn() { Ok(_) => model.show_fedora = true, Err(_) => { @@ -181,7 +182,7 @@ impl SimpleAsyncComponent for DependenciesApp { for package in packages { if !is_available(package) { sender.output(Self::Output::Toast { - title: format!("Package is not available: {package}"), + title: tr_args("package-not-available", [("package", package.into())]), description: None }); diff --git a/src/ui/first_run/download_components.rs b/src/ui/first_run/download_components.rs index 5cbf860..9fad015 100644 --- a/src/ui/first_run/download_components.rs +++ b/src/ui/first_run/download_components.rs @@ -84,7 +84,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { set_vexpand: true, gtk::Label { - set_label: "Download components", + set_label: &tr("download-components"), add_css_class: "title-1" } }, @@ -98,7 +98,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { #[local_ref] wine_combo -> adw::ComboRow { - set_title: "Wine version", + set_title: &tr("wine-version"), #[watch] set_model: Some(>k::StringList::new(model.wine_versions.iter() @@ -109,7 +109,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { #[local_ref] dxvk_combo -> adw::ComboRow { - set_title: "DXVK version", + set_title: &tr("dxvk-version"), #[watch] set_model: Some(>k::StringList::new(model.dxvk_versions.iter() @@ -132,14 +132,14 @@ impl SimpleAsyncComponent for DownloadComponentsApp { set_spacing: 8, gtk::Button { - set_label: "Download", + set_label: &tr("download"), set_css_classes: &["suggested-action", "pill"], connect_clicked => DownloadComponentsAppMsg::DownloadWine }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => DownloadComponentsAppMsg::Exit @@ -155,7 +155,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { set_visible: model.downloading, adw::ActionRow { - set_title: "Download wine", + set_title: &tr("download-wine"), #[watch] set_icon_name: match model.downloading_wine { @@ -173,7 +173,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { }, adw::ActionRow { - set_title: "Create prefix", + set_title: &tr("create-prefix"), #[watch] set_icon_name: match model.creating_prefix { @@ -191,7 +191,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { }, adw::ActionRow { - set_title: "Download DXVK", + set_title: &tr("download-dxvk"), #[watch] set_icon_name: match model.downloading_dxvk { @@ -209,7 +209,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { }, adw::ActionRow { - set_title: "Apply DXVK", + set_title: &tr("apply-dxvk"), #[watch] set_icon_name: match model.applying_dxvk { @@ -317,7 +317,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to download wine: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to download wine"), + title: tr("wine-download-error"), description: Some(err.to_string()) }); } @@ -326,7 +326,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to unpack wine: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to unpack wine"), + title: tr("wine-unpack-errror"), description: Some(err.clone()) }); } @@ -358,7 +358,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to initialize wine installer: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to initialize wine installer"), + title: tr("wine-install-failed"), description: Some(err.to_string()) }); } @@ -391,7 +391,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to create prefix: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to create prefix"), + title: tr("wine-prefix-update-failed"), description: Some(err.to_string()) }); } @@ -410,8 +410,6 @@ impl SimpleAsyncComponent for DownloadComponentsApp { let progress_bar_input = self.progress_bar.sender().clone(); std::thread::spawn(move || { - tracing::info!("Installing wine"); - // Install DXVK tracing::info!("Installing DXVK"); @@ -434,7 +432,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to download dxvk: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to download dxvk"), + title: tr("dxvk-download-error"), description: Some(err.to_string()) }); } @@ -443,7 +441,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to unpack dxvk: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to unpack dxvk"), + title: tr("dxvk-unpack-error"), description: Some(err.clone()) }); } @@ -464,7 +462,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to initialize dxvk installer: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to initialize dxvk installer"), + title: tr("dxvk-install-failed"), description: Some(err.to_string()) }); } @@ -499,7 +497,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp { tracing::error!("Failed to apply DXVK: {err}"); sender.output(Self::Output::Toast { - title: String::from("Failed to apply DXVK"), + title: tr("dxvk-apply-error"), description: Some(err.to_string()) }); } diff --git a/src/ui/first_run/finish.rs b/src/ui/first_run/finish.rs index c2d5514..b656688 100644 --- a/src/ui/first_run/finish.rs +++ b/src/ui/first_run/finish.rs @@ -29,12 +29,12 @@ impl SimpleAsyncComponent for FinishApp { set_vexpand: true, gtk::Label { - set_label: "Everything's done!", + set_label: &tr("finish-title"), add_css_class: "title-1" }, gtk::Label { - set_label: "All the basic components were downloaded. Now you can restart the launcher and download the game. Welcome to our club!", + set_label: &tr("finish-message"), set_justify: gtk::Justification::Center, set_wrap: true, @@ -52,14 +52,14 @@ impl SimpleAsyncComponent for FinishApp { set_spacing: 8, gtk::Button { - set_label: "Restart", + set_label: &tr("restart"), set_css_classes: &["suggested-action", "pill"], connect_clicked => FinishAppMsg::Restart }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => FinishAppMsg::Exit diff --git a/src/ui/first_run/main.rs b/src/ui/first_run/main.rs index b7851b7..da8dd0c 100644 --- a/src/ui/first_run/main.rs +++ b/src/ui/first_run/main.rs @@ -134,7 +134,7 @@ impl SimpleComponent for FirstRunApp { toast_overlay, carousel, - title: String::from("Welcome") + title: tr("welcome") }; let toast_overlay = &model.toast_overlay; @@ -156,37 +156,37 @@ impl SimpleComponent for FirstRunApp { match msg { FirstRunAppMsg::ScrollToTosWarning => { - self.title = String::from("ToS Warning"); + self.title = tr("tos-violation-warning"); self.carousel.scroll_to(self.tos_warning.widget(), true); } FirstRunAppMsg::ScrollToDependencies => { - self.title = String::from("Dependencies"); + self.title = tr("dependencies"); self.carousel.scroll_to(self.dependencies.widget(), true); } FirstRunAppMsg::ScrollToDefaultPaths => { - self.title = String::from("Default paths"); + self.title = tr("default-paths"); self.carousel.scroll_to(self.default_paths.widget(), true); } FirstRunAppMsg::ScrollToSelectVoiceovers => { - self.title = String::from("Select voiceovers"); + self.title = tr("select-voice-packages"); self.carousel.scroll_to(self.select_voiceovers.widget(), true); } FirstRunAppMsg::ScrollToDownloadComponents => { - self.title = String::from("Download components"); + self.title = tr("download-components"); self.carousel.scroll_to(self.download_components.widget(), true); } FirstRunAppMsg::ScrollToFinish => { - self.title = String::from("Finish"); + self.title = tr("finish"); self.carousel.scroll_to(self.finish.widget(), true); } diff --git a/src/ui/first_run/select_voiceovers.rs b/src/ui/first_run/select_voiceovers.rs index e6d6d86..e6d26b6 100644 --- a/src/ui/first_run/select_voiceovers.rs +++ b/src/ui/first_run/select_voiceovers.rs @@ -36,7 +36,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { set_vexpand: true, gtk::Label { - set_label: "Select voice packages", + set_label: &tr("select-voice-packages"), add_css_class: "title-1" } }, @@ -46,7 +46,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { set_vexpand: true, adw::ActionRow { - set_title: "English", + set_title: &tr("english"), #[local_ref] add_suffix = english -> gtk::Switch { @@ -56,7 +56,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { }, adw::ActionRow { - set_title: "Japanese", + set_title: &tr("japanese"), #[local_ref] add_suffix = japanese -> gtk::Switch { @@ -65,7 +65,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { }, adw::ActionRow { - set_title: "Korean", + set_title: &tr("korean"), #[local_ref] add_suffix = korean -> gtk::Switch { @@ -74,7 +74,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { }, adw::ActionRow { - set_title: "Chinese", + set_title: &tr("chinese"), #[local_ref] add_suffix = chinese -> gtk::Switch { @@ -93,14 +93,14 @@ impl SimpleAsyncComponent for SelectVoiceoversApp { set_spacing: 8, gtk::Button { - set_label: "Continue", + set_label: &tr("continue"), set_css_classes: &["suggested-action", "pill"], connect_clicked => SelectVoiceoversAppMsg::Continue }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => SelectVoiceoversAppMsg::Exit diff --git a/src/ui/first_run/tos_warning.rs b/src/ui/first_run/tos_warning.rs index fc68321..9143792 100644 --- a/src/ui/first_run/tos_warning.rs +++ b/src/ui/first_run/tos_warning.rs @@ -5,6 +5,7 @@ use adw::prelude::*; use anime_launcher_sdk::is_available; +use crate::i18n::*; use super::main::FirstRunAppMsg; pub struct TosWarningApp; @@ -30,66 +31,16 @@ impl SimpleAsyncComponent for TosWarningApp { set_vexpand: true, gtk::Label { - set_label: "ToS violation warning", + set_label: &tr("tos-violation-warning"), add_css_class: "title-1" - }, + } + }, - gtk::Box { - set_orientation: gtk::Orientation::Vertical, - set_margin_top: 32, - set_spacing: 12, - set_hexpand: true, - - // TODO: use some kind of multiline text field - - gtk::Label { - set_label: "This launcher is an unofficial tool, in no way related to miHoYo nor COGNOSPHERE.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "This tool is designed to facilitate playing Genshin Impact on Linux, and was built with the sole purpose of installing and running the game with less hassle.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "It does so by using existing components and making the experience simple for the user.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "However, some components used here likely break the miHoYo Terms of Service for Genshin Impact.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "If you are using this launcher, your player account could become identified as TOS-non-compliant by miHoYo/COGNOSPHERE.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "If this happens, as your account would be disobeying TOS, miHoYo/COGNOSPHERE are free to do what they want. Including banning.", - - set_wrap: true, - set_halign: gtk::Align::Center - }, - - gtk::Label { - set_label: "If you understand the risk of trying to play the game in an unofficial capacity, press OK and let's go researching the world of Teyvat!", - - set_wrap: true, - set_halign: gtk::Align::Center - } + add = &adw::PreferencesGroup { + gtk::Label { + set_label: &tr("tos-violation-warning-message"), + set_wrap: true, + set_selectable: true } }, @@ -103,14 +54,14 @@ impl SimpleAsyncComponent for TosWarningApp { set_spacing: 8, gtk::Button { - set_label: "Continue", + set_label: &tr("continue"), set_css_classes: &["suggested-action", "pill"], connect_clicked => TosWarningAppMsg::Continue }, gtk::Button { - set_label: "Exit", + set_label: &tr("exit"), add_css_class: "pill", connect_clicked => TosWarningAppMsg::Exit diff --git a/src/ui/first_run/welcome.rs b/src/ui/first_run/welcome.rs index 5c66095..abbba8b 100644 --- a/src/ui/first_run/welcome.rs +++ b/src/ui/first_run/welcome.rs @@ -3,6 +3,7 @@ use relm4::component::*; use adw::prelude::*; +use crate::i18n::*; use super::main::FirstRunAppMsg; pub struct WelcomeApp; @@ -36,9 +37,9 @@ impl SimpleAsyncComponent for WelcomeApp { set_margin_top: 32, add_css_class: "title-1" }, - + gtk::Label { - set_label: "Hi there! Welcome to the An Anime Game Launcher. We need to prepare some stuff and download default components before you could run the game", + set_label: &tr("welcome-page-message"), set_justify: gtk::Justification::Center, set_wrap: true, @@ -56,7 +57,7 @@ impl SimpleAsyncComponent for WelcomeApp { set_spacing: 8, gtk::Button { - set_label: "Continue", + set_label: &tr("continue"), set_css_classes: &["suggested-action", "pill"], connect_clicked => WelcomeAppMsg::Continue