amethyst: finish adding strings to i18n file

i18n
Fries 2 years ago committed by fries1234
parent 8f9ce37a78
commit 73387e35d3

@ -1,4 +1,4 @@
fallback_language = "en-US"
fallback_language = "en"
[fluent]
assets_dir = "i18n"

@ -1,21 +0,0 @@
run-as-root = Running Amethyst as root is disallowed as it can lead to system breakage. Instead, Amethyst will prompt you when it needs superuser permissions.
following-packages = The following packages were found in the AUR:
aur-warning =
The AUR is a source of user-submitted packages/scripts and isn't always safe to use.
Please make sure to review the PKGBUILD of anything you download from the AUR before installing it, as some PKGBUILDs may potentially be malicious.
This warning can be toggled in the configuration file.
are-you-sure = Are you sure that you want to continue?
exiting = Exiting
uninstalling-packages = Uninstalling packages: {$packages}
system-upgrade = Performing system upgrade
removing-orphans = Removing orphaned packages
couldnt-find-packages = Couldn't find packages: {$packages} in repos or the AUR
searching-repos = Searching repos for {$query}
searching-aur = Searching AUR for {$query}
no-results = No results found
results = Results:
installed-repo-packages = Installed Repo Packages:
installed-aur-packages = Installed AUR Packages:
installed-packages = Installed Packages:
invalid-shell = Invalid shell, {$shell}
zsh-error = Zsh shell completions are currently unsupported due to a bug in the clap_completion crate

@ -0,0 +1,151 @@
# used across files
exiting = Exiting
packages = { $pkgNum ->
[one] package
*[other] packages
}
missing-deps = Missing dependencies
continue = Continue?
# main
run-as-root = Running Amethyst as root is disallowed as it can lead to system breakage. Instead, Amethyst will prompt you when it needs superuser permissions.
following-packages = The following packages were found in the AUR:
aur-warning =
The AUR is a source of user-submitted packages/scripts and isn't always safe to use.
Please make sure to review the PKGBUILD of anything you download from the AUR before installing it, as some PKGBUILDs may potentially be malicious.
This warning can be toggled in the configuration file.
are-you-sure = Are you sure that you want to continue?
uninstalling-packages = Uninstalling packages: {$packages}
system-upgrade = Performing system upgrade
removing-orphans = Removing orphaned packages
couldnt-find-packages = Couldn't find packages: {$packages} in repos or the AUR
searching-repos = Searching repos for {$query}
searching-aur = Searching AUR for {$query}
no-results = No results found
results = Results:
installed-repo-packages = Installed Repo Packages:
installed-aur-packages = Installed AUR Packages:
installed-packages = Installed Packages:
invalid-shell = Invalid shell, {$shell}
zsh-error = Zsh shell completions are currently unsupported due to a bug in the clap_completion crate
# operations::clean
no-orphans = No orphaned packages found
removing-orphans-would =
Removing orphans would uninstall the following packages:
{$packages}
failed-remove-orphans = Failed to remove orphans
success-remove-orphans = Successfully removed orphans
clear-pkgbuild-cache = Clear Amethyst's internal PKGBUILD cache?
clear-pacman-cache = Also clear Pacman's package cache?
failed-clear-cache = Failed to clear package cache, {$error}
success-clear-cache = Successfully cleared package cache
# operations::install
installing-packages-from-repos = Installing packages {$packages} from repos
error-install = An error occured while installing packages: {$error}, aborting
# operations::search
out-of-date = out of date: since
installed = installed
# operations::uninstall
failed-remove-pkgs = Failed to remove packages
# operations::upgrade
failed-upgrade-repo-pkgs = Failed to upgrade repo packages, continue to upgrading AUR packages?
success-upgrade-repo-pkgs = Successfully upgraded repo packages
couldnt-find-remote-pkg = Could not find the remote package for {$pkg}
no-upgrades-aur-package = No upgrades available for installed AUR packages
scanning-for-pacnew = Scanning for .pacnew files post-upgrade
# logging::output
repo-dependencies = Repo dependencies
aur-dependencies = AUR dependencies
repo-make-dependencies = Repo make dependencies
aur-make-dependencies = AUR make dependencies
version = version
votes = votes
capital-installed = Installed
# operations::aur_install::aur_fetch
fetching-pkg-info = Fetching package information
couldnt-find-all-pkgs = Couldn't find all packages
all-pkgs-found = All packages found
some-pkgs-already-installed = Some packages are already installed. Continue anyway?
do-you-want-to-install = Do you want to install these packages and package dependencies?
# operations::aur_install::common
downloading-sources = Downloading sources
pulling-latest-changes = Pulling latest changes
cloning-aur-repo = Cloning aur repository
down-and-ext-files = Downloading and extracting files
downloaded = Downloaded!
dependency-cycle = Dependency cycle detected. Aborting installation.
building-packages = Building packages
built = Built
installing-packages = Installing packages
building-package = Building Package
build-failed = Build failed!
couldnt-find-pkg-produced = Could not find package {$pkg} in produced packages
review-build-log = Do you want to review the build log?
# operations::aur_install::aur_review
select-pkgs-review = Select packages to review
do-you-still-want-to-install = Do you still want to install those packages?
reviewing = Reviewing
select-file-review = Select a file to review
done-reviewing-pkg = Done reviewing {$pkg}
# operations::aur_install::aur_download
all-sources-ready = All sources are ready.
# interact::theme
no-selections = No selections
# operations::aur_install::repo_dependency_installation
installing-repo-deps = Installing repo dependencies
# operations::aur_install::aur_dependency_installation
installing-from-aur = Installing {$amountOfPkgs} from the AUR
# operations::aur_install::make_dependency_removal
remove-installed-make-deps = Do you want to remove the installed make dependencies?
done = Done!
# operations::aur_install
aur-rpc-crash = AUR RPC Call failed with
failed-to-build = Failed to build
makepkg-failed = makepkg failed
unknown-error = Unknown error
# internal::error
non-zero-exit = Exited with non zero code
build-step-violation = AUR build violated build steps
build-error = Failed to build package
user-cancel = Cancelled by user
makepkg-err = Failed to run makepkg
error-occurred = An error occurred
# internal::detect
sudo-prompt-failed = Sudo prompt failed
scanning-pacnew-files = Scanning for pacnew files"
no-pacnew-found = No .pacnew files found
pacnew-found = pacnew files found
pacnew-warning =
It appears that at least one program you have installed / upgraded has installed a .pacnew config file.
These are created when you have modified a program's configuration, and a package upgrade could not automatically merge the new file.
You can deal with those files by running
run-pacdiff-now = Would you like to run pacdiff now?
pacdiff-warning =
Pacdiff uses vimdiff by default to edit files for merging. You can focus panes by mousing over them and pressing left click, and scroll up and down using your mouse's scroll wheel (or the arrow keys). To exit vimdiff, press the following key combination: ESC, :qa!, ENTER
You can surpress this warning in the future by setting `pacdiff_warn` to "false" in ~/.config/ame/config.toml
# internal::config
config-docs = # See https://getcryst.al/docs/amethyst/config for more information on config keys
# internal::paging
quit = quit
search = search
next-result = next result
previous-result = previous-result

@ -1,6 +1,7 @@
use std::env;
use std::fmt::Write;
use crate::fl;
use crate::internal::error::AppError;
use crate::internal::error::AppResult;
use crate::with_suspended_output;
@ -11,7 +12,13 @@ pub fn page_string<S: ToString>(content: S) -> AppResult<()> {
let mut pager = Pager::new();
pager.set_prompt(
env::args().collect::<Vec<String>>().join(" ")
+ " | Q: quit | /: Search | n: next result | p: previous result",
+ &format!(
" | Q: {} | /: {} | n: {} | p: {}",
fl!("quit"),
fl!("search"),
fl!("next-result"),
fl!("previous-result")
),
)?;
writeln!(pager, "{}", content.to_string())?;
with_suspended_output!({ minus::page_all(pager).map_err(AppError::from) })

@ -2,7 +2,7 @@ use crossterm::style::Stylize;
use dialoguer::theme::Theme;
use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};
use crate::internal::utils::wrap_text;
use crate::{fl, internal::utils::wrap_text};
const ERR_SYMBOL: &str = "X";
const PROMPT_SYMBOL: &str = "?";
@ -151,7 +151,7 @@ impl Theme for AmeTheme {
) -> std::fmt::Result {
write!(f, " {}: ", prompt.bold())?;
if selections.is_empty() {
write!(f, "{}", "No selections".italic())?;
write!(f, "{}", format!("{}", fl!("no-selections")).italic())?;
} else {
for (idx, sel) in selections.iter().enumerate() {
write!(f, "{}{}", if idx == 0 { "" } else { ", " }, sel)?;

@ -5,6 +5,8 @@ use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::fs;
use crate::fl;
use super::utils::get_config_dir;
#[derive(Default, Debug, Deserialize, Serialize)]
@ -63,7 +65,11 @@ impl Config {
} else {
let default_conf = Config::default();
let toml_string = toml::ser::to_string_pretty(&default_conf).unwrap();
fs::write(config_path, format!("{}\n\n{}", "# See https://getcryst.al/docs/amethyst/config for more information on config keys", toml_string)).unwrap();
fs::write(
config_path,
format!("{}\n\n{}", fl!("config-docs"), toml_string),
)
.unwrap();
default_conf
}
}

@ -3,16 +3,18 @@ use crossterm::style::Stylize;
use crate::builder::pacdiff::PacdiffBuilder;
use crate::internal::config::Config;
use crate::logging::get_logger;
use crate::prompt;
use crate::{fl, prompt};
use super::prompt_sudo_single;
/// Searches the filesystem for .pacnew files and helps the user deal with them.
#[tracing::instrument(level = "trace")]
pub async fn detect() {
prompt_sudo_single().await.expect("Sudo prompt failed");
prompt_sudo_single()
.await
.expect(&fl!("sudo-prompt-failed").clone());
let pb = get_logger().new_progress_spinner();
pb.set_message("Scanning for pacnew files");
pb.set_message(fl!("scanning-pacnew-files"));
let mut pacnew = vec![];
@ -27,26 +29,24 @@ pub async fn detect() {
// If pacnew files are found, warn the user and prompt to pacdiff
if pacnew.is_empty() {
pb.finish_with_message("No .pacnew files found".bold().to_string());
pb.finish_with_message(format!("{}", fl!("no-pacnew-found")).bold().to_string());
get_logger().reset_output_type();
} else {
pb.finish_with_message("pacnew files found".bold().to_string());
pb.finish_with_message(format!("{}", fl!("pacnew-found")).bold().to_string());
get_logger().reset_output_type();
tracing::info!(
"It appears that at least one program you have installed / upgraded has installed a .pacnew config file. \
These are created when you have modified a program's configuration, and a package upgrade could not automatically merge the new file. \
You can deal with those files by running {}.",
"{} {}.",
fl!("pacnew-warning"),
"sudo pacdiff".reset().magenta()
);
let choice = prompt!(default no, "Would you like to run pacdiff now?");
let choice = prompt!(default no, "{}", fl!("run-pacdiff-now"));
if choice {
let config = Config::get();
if config.base.pacdiff_warn {
tracing::warn!("Pacdiff uses vimdiff by default to edit files for merging. You can focus panes by mousing over them and pressing left click, and scroll up and down using your mouse's scroll wheel (or the arrow keys). To exit vimdiff, press the following key combination: ESC, :qa!, ENTER");
tracing::warn!("You can surpress this warning in the future by setting `pacdiff_warn` to \"false\" in ~/.config/ame/config.toml");
tracing::warn!("{}", fl!("pacdiff-warning"));
if prompt!(default no, "Continue?") {
if prompt!(default no, "{}", fl!("continue")) {
PacdiffBuilder::pacdiff().await.unwrap();
}
} else {

@ -2,8 +2,8 @@ use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::io;
use crate::crash;
use crate::internal::exit_code::AppExitCode;
use crate::{crash, fl};
pub type AppResult<T> = Result<T, AppError>;
@ -30,14 +30,16 @@ impl Display for AppError {
AppError::Io(io) => Display::fmt(io, f),
AppError::Rpc(e) => Display::fmt(e, f),
AppError::Other(s) => Display::fmt(s, f),
AppError::NonZeroExit => Display::fmt("exited with non zero code", f),
AppError::BuildStepViolation => Display::fmt("AUR build violated build steps", f),
AppError::BuildError { pkg_name } => write!(f, "Failed to build package {pkg_name}"),
AppError::UserCancellation => write!(f, "Cancelled by user"),
AppError::NonZeroExit => Display::fmt(&format!("{}", fl!("non-zero-exit")), f),
AppError::BuildStepViolation => {
Display::fmt(&format!("{}", fl!("build-step-violation")), f)
}
AppError::BuildError { pkg_name } => write!(f, "{} {pkg_name}", fl!("build-error")),
AppError::UserCancellation => write!(f, "{}", fl!("user-cancel")),
AppError::MissingDependencies(deps) => {
write!(f, "Missing dependencies {}", deps.join(", "))
write!(f, "{} {}", fl!("missing-deps"), deps.join(", "))
}
AppError::MakePkg(msg) => write!(f, "Failed to run makepkg {msg}"),
AppError::MakePkg(msg) => write!(f, "{} {msg}", fl!("makepkg-err")),
AppError::MinusError(e) => Display::fmt(e, f),
AppError::FmtError(e) => Display::fmt(e, f),
AppError::AlpmError(e) => Display::fmt(e, f),
@ -99,7 +101,7 @@ impl<T> SilentUnwrap<T> for AppResult<T> {
Ok(val) => val,
Err(e) => {
tracing::debug!("{e}");
crash!(exit_code, "An error occurred")
crash!(exit_code, "{}", fl!("error-occurred"))
}
}
}

@ -4,7 +4,9 @@ use aur_rpc::PackageInfo;
use console::Alignment;
use crossterm::style::Stylize;
use crate::{builder::pacman::PacmanQueryBuilder, internal::dependencies::DependencyInformation};
use crate::{
builder::pacman::PacmanQueryBuilder, fl, internal::dependencies::DependencyInformation,
};
use super::get_logger;
@ -35,27 +37,27 @@ pub async fn print_dependency_list(dependencies: &[DependencyInformation]) -> bo
let mut empty = true;
if !deps_repo.is_empty() {
tracing::info!("Repo dependencies");
tracing::info!("{}", fl!("repo-dependencies"));
get_logger().print_list(&deps_repo, " ", 2);
empty = false;
get_logger().print_newline();
}
if !deps_aur.is_empty() {
tracing::info!("AUR dependencies");
tracing::info!("{}", fl!("aur-dependencies"));
print_aur_package_list(&deps_aur).await;
empty = false;
get_logger().print_newline();
}
if !makedeps_repo.is_empty() {
tracing::info!("Repo make dependencies");
tracing::info!("{}", fl!("repo-make-dependencies"));
get_logger().print_list(&makedeps_repo, " ", 2);
empty = false;
get_logger().print_newline();
}
if !makedeps_aur.is_empty() {
tracing::info!("AUR make dependencies");
tracing::info!("{}", fl!("aur-make-dependencies"));
print_aur_package_list(&makedeps_aur).await;
empty = false;
get_logger().print_newline();
@ -81,14 +83,16 @@ pub async fn print_aur_package_list(packages: &[&PackageInfo]) -> bool {
get_logger().print_list(
packages.iter().map(|pkg| {
format!(
"{} version {} ({} votes) {}",
"{} {} {} ({} {}) {}",
console::pad_str(&pkg.metadata.name, 30, Alignment::Left, Some("...")).bold(),
fl!("version"),
pkg.metadata.version.clone().dim(),
pkg.metadata.num_votes,
fl!("votes"),
if installed.contains_key(&pkg.metadata.name) {
"(Installed)"
format!("({})", fl!("capital-installed"))
} else {
""
"".to_string()
}
.bold()
.magenta()

@ -3,8 +3,9 @@ use futures::future;
use crate::{
builder::{makepkg::MakePkgBuilder, pacman::PacmanInstallBuilder},
fl,
internal::{dependencies::DependencyInformation, error::AppResult},
multi_progress, normal_output, numeric,
multi_progress, normal_output,
operations::{
aur_install::common::{build_and_install, create_dependency_batches, download_aur_source},
BuildContext,
@ -30,8 +31,15 @@ impl AurDependencyInstallation {
if !aur_dependencies.is_empty() {
tracing::info!(
"Installing {} from the aur",
numeric!(aur_dependencies.len(), "package"["s"])
"{}",
fl!(
"installing-from-aur",
amountOfPkgs = format!(
"{} {}",
aur_dependencies.len(),
fl!("packages", pkgNum = aur_dependencies.len())
)
)
);
let batches = create_dependency_batches(aur_dependencies);
tracing::debug!("aur install batches: {batches:?}");

@ -3,6 +3,7 @@ use aur_rpc::PackageInfo;
use futures::future;
use crate::{
fl,
internal::{dependencies::DependencyInformation, error::AppResult, structs::Options},
multi_progress, normal_output,
operations::BuildContext,
@ -32,7 +33,7 @@ impl AurDownload {
.await?;
normal_output!();
tracing::info!("All sources are ready.");
tracing::info!("{}", fl!("all-sources-ready"));
Ok(AurReview {
options: self.options,

@ -2,6 +2,7 @@ use crossterm::style::Stylize;
use futures::future;
use crate::{
fl,
internal::{
dependencies::DependencyInformation,
error::{AppError, AppResult},
@ -21,14 +22,18 @@ pub struct AurFetch {
impl AurFetch {
#[tracing::instrument(level = "trace", skip_all)]
pub async fn fetch_package_info(self) -> AppResult<AurDownload> {
let pb = spinner!("Fetching package information");
let pb = spinner!("{}", fl!("fetching-pkg-info"));
let package_infos = aur_rpc::info(&self.packages).await?;
tracing::debug!("package info = {package_infos:?}");
if package_infos.len() != self.packages.len() {
pb.finish_with_message("Couldn't find all packages".red().to_string());
pb.finish_with_message(
format!("{}", fl!("couldnt-find-all-pkgs"))
.red()
.to_string(),
);
let mut not_found = self.packages.clone();
package_infos
.iter()
@ -36,18 +41,18 @@ impl AurFetch {
return Err(AppError::MissingDependencies(not_found));
}
pb.finish_with_message("All packages found".green().to_string());
pb.finish_with_message(format!("{}", fl!("all-pkgs-found")).green().to_string());
normal_output!();
if print_aur_package_list(&package_infos.iter().collect::<Vec<_>>()).await
&& !self.options.noconfirm
&& !self.options.upgrade
&& !prompt!(default yes, "Some packages are already installed. Continue anyway?")
&& !prompt!(default yes, "{}", fl!("some-pkgs-already-installed"))
{
return Err(AppError::UserCancellation);
}
let pb = spinner!("Fetching package information");
let pb = spinner!("{}", fl!("fetching-pkg-info"));
let dependencies = future::try_join_all(
package_infos
@ -61,9 +66,7 @@ impl AurFetch {
print_dependency_list(&dependencies).await;
if !self.options.noconfirm
&& !prompt!(default yes, "Do you want to install these packages and package dependencies?")
{
if !self.options.noconfirm && !prompt!(default yes, "{}", fl!("do-you-want-to-install")) {
Err(AppError::UserCancellation)
} else {
Ok(AurDownload {

@ -1,7 +1,7 @@
use crate::{
builder::{makepkg::MakePkgBuilder, pacman::PacmanInstallBuilder},
fl,
internal::{dependencies::DependencyInformation, error::AppResult, structs::Options},
numeric,
operations::aur_install::{
common::build_and_install, make_dependency_removal::MakeDependencyRemoval,
},
@ -19,8 +19,9 @@ impl AurPackageInstall {
#[tracing::instrument(level = "trace", skip_all)]
pub async fn install_packages(self) -> AppResult<MakeDependencyRemoval> {
tracing::info!(
"Installing {}",
numeric!(self.contexts.len(), "package"["s"])
"Installing {} {}",
self.contexts.len(),
fl!("packages", pkgNum = self.contexts.len())
);
build_and_install(
self.contexts,

@ -2,6 +2,7 @@ use tokio::fs;
use crate::{
builder::pager::PagerBuilder,
fl,
internal::{
dependencies::DependencyInformation,
error::{AppError, AppResult},
@ -24,12 +25,12 @@ impl AurReview {
#[tracing::instrument(level = "trace", skip_all)]
pub async fn review_pkgbuild(self) -> AppResult<RepoDependencyInstallation> {
if !self.options.noconfirm {
let to_review = multi_select!(&self.packages, "Select packages to review");
let to_review = multi_select!(&self.packages, "{}", fl!("select-pkgs-review"));
for pkg in to_review.into_iter().filter_map(|i| self.packages.get(i)) {
self.review_single_package(pkg).await?;
}
if !prompt!(default yes, "Do you still want to install those packages?") {
if !prompt!(default yes, "{}", fl!("do-you-still-want-to-install")) {
return Err(AppError::UserCancellation);
}
}
@ -41,7 +42,7 @@ impl AurReview {
}
async fn review_single_package(&self, pkg: &str) -> AppResult<()> {
tracing::info!("Reviewing {pkg}");
tracing::info!("{} {pkg}", fl!("reviewing"));
let mut files_iter = fs::read_dir(get_cache_dir().join(pkg)).await?;
let mut files = Vec::new();
@ -59,7 +60,7 @@ impl AurReview {
.map(|f| f.to_string_lossy())
.collect::<Vec<_>>();
while let Some(selection) = select_opt!(&file_names, "Select a file to review") {
while let Some(selection) = select_opt!(&file_names, "{}", fl!("select-file-review")) {
if let Some(path) = files.get(selection) {
if let Err(e) = PagerBuilder::default().path(path).open().await {
tracing::debug!("Pager error {e}");
@ -69,7 +70,7 @@ impl AurReview {
}
}
tracing::info!("Done reviewing {pkg}");
tracing::info!("{}", fl!("done-reviewing-pkg", pkg = pkg));
Ok(())
}

@ -22,7 +22,7 @@ use crate::{
pacman::PacmanInstallBuilder,
pager::PagerBuilder,
},
crash,
crash, fl,
internal::{
alpm::{Alpm, PackageFrom},
error::{AppError, AppResult},
@ -30,7 +30,7 @@ use crate::{
utils::{get_cache_dir, wrap_text},
},
logging::piped_stdio::StdioReader,
multi_progress, normal_output, numeric,
multi_progress, normal_output,
operations::PackageArchives,
prompt, spinner,
};
@ -41,23 +41,29 @@ use super::{BuildContext, BuildPath, BuildStep};
pub async fn download_aur_source(mut ctx: BuildContext) -> AppResult<BuildContext> {
let pkg_name = &ctx.package.metadata.name;
let base_pkg = &ctx.package.metadata.package_base;
let pb = spinner!("{}: Downloading sources", pkg_name.clone().bold());
let pb = spinner!(
"{}: {}",
pkg_name.clone().bold(),
fl!("downloading-sources")
);
let cache_dir = get_cache_dir();
let pkg_dir = cache_dir.join(&pkg_name);
if pkg_dir.exists() {
pb.set_message(format!(
"{}: Pulling latest changes",
pkg_name.clone().bold()
"{}: {}",
pkg_name.clone().bold(),
fl!("pulling-latest-changes")
));
GitPullBuilder::default().directory(&pkg_dir).pull().await?;
} else {
let aur_url = crate::internal::rpc::URL;
let repository_url = format!("{aur_url}/{base_pkg}");
pb.set_message(format!(
"{}: Cloning aur repository",
pkg_name.clone().bold()
"{}: {}",
pkg_name.clone().bold(),
fl!("cloning-aur-repo")
));
GitCloneBuilder::default()
@ -67,8 +73,9 @@ pub async fn download_aur_source(mut ctx: BuildContext) -> AppResult<BuildContex
.await?;
pb.set_message(format!(
"{}: Downloading and extracting files",
pkg_name.clone().bold()
"{}: {}",
pkg_name.clone().bold(),
fl!("down-and-ext-files")
));
MakePkgBuilder::default()
@ -83,7 +90,7 @@ pub async fn download_aur_source(mut ctx: BuildContext) -> AppResult<BuildContex
pb.finish_with_message(format!(
"{}: {}",
pkg_name.clone().bold(),
"Downloaded!".green()
format!("{}", fl!("downloaded")).green()
));
ctx.step = BuildStep::Build(BuildPath(pkg_dir));
@ -133,10 +140,7 @@ pub fn create_dependency_batches(deps: Vec<&PackageInfo>) -> Vec<Vec<&PackageInf
if current_batch.is_empty() {
if relaxed {
crash!(
AppExitCode::Other,
"Dependency cycle detected. Aborting installation."
);
crash!(AppExitCode::Other, "{}", fl!("dependency-cycle"));
}
relaxed = true;
@ -157,7 +161,7 @@ pub async fn build_and_install(
make_opts: MakePkgBuilder,
install_opts: PacmanInstallBuilder,
) -> AppResult<()> {
tracing::info!("Building packages");
tracing::info!("{}", fl!("building-packages"));
multi_progress!();
let results = future::join_all(
ctxs.into_iter()
@ -173,8 +177,13 @@ pub async fn build_and_install(
}
}
tracing::info!("Built {}", numeric!(ctxs.len(), "package"["s"]));
tracing::info!("Installing packages");
tracing::info!(
"{} {} {}",
fl!("built"),
ctxs.len(),
fl!("packages", pkgNum = ctxs.len())
);
tracing::info!("{}", fl!("installing-packages"));
install_packages(ctxs, install_opts).await?;
@ -188,7 +197,7 @@ async fn build_package(
) -> AppResult<BuildContext> {
let pkg_name = &ctx.package.metadata.name;
let build_path = ctx.build_path()?;
let pb = spinner!("{}: Building Package", pkg_name.as_str().bold());
let pb = spinner!("{}: {}", pkg_name.as_str().bold(), fl!("building-package"));
let mut child = make_opts
.directory(build_path)
@ -214,7 +223,7 @@ async fn build_package(
pb.finish_with_message(format!(
"{}: {}",
pkg_name.as_str().bold(),
"Build failed!".red(),
format!("{}", fl!("build-failed")).red(),
));
return Err(AppError::BuildError {
pkg_name: pkg_name.to_owned(),
@ -236,12 +245,16 @@ async fn build_package(
let pkg_to_install = pkgs_produced.get(pkg_name).ok_or_else(|| {
AppError::Other(format!(
"Could not find package {} in produced packages",
pkg_name.clone()
"{}",
fl!("couldnt-find-pkg-produced", pkg = pkg_name.clone())
))
})?;
pb.finish_with_message(format!("{}: {}", pkg_name.clone().bold(), "Built!".green()));
pb.finish_with_message(format!(
"{}: {}!",
pkg_name.clone().bold(),
format!("{}", fl!("built")).green()
));
ctx.step = BuildStep::Install(PackageArchives(vec![pkg_to_install.to_path_buf()]));
Ok(ctx)
@ -314,7 +327,7 @@ async fn handle_build_error<E: Into<AppError>>(err: E) -> AppResult<()> {
#[tracing::instrument(level = "trace")]
async fn review_build_log(log_file: &Path) -> AppResult<()> {
if prompt!(default yes, "Do you want to review the build log?") {
if prompt!(default yes, "{}", fl!("review-build-log")) {
PagerBuilder::default().path(log_file).open().await?;
}

@ -1,5 +1,6 @@
use crate::{
builder::pacman::PacmanUninstallBuilder,
fl,
internal::{dependencies::DependencyInformation, error::AppResult, structs::Options},
prompt,
};
@ -19,7 +20,7 @@ impl MakeDependencyRemoval {
.collect::<Vec<_>>();
if !make_depends.is_empty()
&& !self.options.noconfirm
&& prompt!(default yes, "Do you want to remove the installed make dependencies?")
&& prompt!(default yes, "{}", fl!("remove-installed-make-deps"))
{
PacmanUninstallBuilder::default()
.packages(make_depends)
@ -28,7 +29,7 @@ impl MakeDependencyRemoval {
.await?;
}
tracing::info!("Done!");
tracing::info!("{}", fl!("done"));
Ok(())
}

@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use crate::internal::error::{AppError, AppResult};
use crate::internal::exit_code::AppExitCode;
use crate::{cancelled, crash, Options};
use crate::{cancelled, crash, fl, Options};
use self::aur_fetch::AurFetch;
@ -96,13 +96,17 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
if let Err(e) = aur_install_internal(AurInstall::new(options, packages)).await {
match e {
AppError::Rpc(e) => {
crash!(AppExitCode::RpcError, "AUR RPC Call failed with {e}")
crash!(AppExitCode::RpcError, "{} {e}", fl!("aur-rpc-crash"))
}
AppError::BuildStepViolation => {
crash!(AppExitCode::MakePkgError, "Failed to build")
crash!(AppExitCode::MakePkgError, "{}", fl!("failed-to-build"))
}
AppError::BuildError { pkg_name } => {
crash!(AppExitCode::MakePkgError, "Failed to build {pkg_name}")
crash!(
AppExitCode::MakePkgError,
"{} {pkg_name}",
fl!("failed-to-build")
)
}
AppError::UserCancellation => {
cancelled!();
@ -110,14 +114,15 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
AppError::MissingDependencies(deps) => {
crash!(
AppExitCode::MissingDeps,
"Missing dependencies {}",
"{} {}",
fl!("missing-deps"),
deps.join(", ")
)
}
AppError::MakePkg(msg) => {
crash!(AppExitCode::MakePkgError, "makepkg failed {msg}")
crash!(AppExitCode::MakePkgError, "{} {msg}", fl!("makepkg-failed"))
}
_ => crash!(AppExitCode::Other, "Unknown error"),
_ => crash!(AppExitCode::Other, "{}", fl!("unknown-error")),
}
}
}

@ -2,6 +2,7 @@ use std::collections::HashSet;
use crate::{
builder::pacman::PacmanInstallBuilder,
fl,
internal::{dependencies::DependencyInformation, error::AppResult, structs::Options},
};
@ -23,7 +24,7 @@ impl RepoDependencyInstallation {
.collect();
if !repo_dependencies.is_empty() {
tracing::info!("Installing repo dependencies");
tracing::info!("{}", fl!("installing-repo-deps"));
PacmanInstallBuilder::default()
.as_deps(true)
.packages(repo_dependencies)

@ -25,12 +25,15 @@ pub async fn clean(options: Options) {
if orphaned_packages.stdout.as_str().is_empty() {
// If no orphaned packages found, do nothing
tracing::info!("No orphaned packages found");
tracing::info!("{}", fl!("no-orphans"));
} else {
// Prompt users whether to remove orphaned packages
tracing::info!(
"Removing orphans would uninstall the following packages: \n{}",
&orphaned_packages.stdout.trim_end()
"{}",
fl!(
"removing-orphans-would",
packages = orphaned_packages.stdout.trim_end()
)
);
let cont = noconfirm || prompt!(default no, "Continue?");
if !cont {
@ -58,15 +61,14 @@ pub async fn clean(options: Options) {
.await;
if result.is_err() {
crash!(AppExitCode::PacmanError, "Failed to remove orphans");
crash!(AppExitCode::PacmanError, "{}", fl!("failed-remove-orphans"));
} else {
tracing::info!("Successfully removed orphans");
tracing::info!("{}", fl!("success-remove-orphans"));
}
}
// Prompt the user whether to clear the Amethyst cache
let clear_ame_cache =
noconfirm || prompt!(default no, "Clear Amethyst's internal PKGBUILD cache?");
let clear_ame_cache = noconfirm || prompt!(default no, "{}", fl!("clear-pkgbuild-cache"));
if clear_ame_cache {
let cache_dir = get_cache_dir();
@ -80,7 +82,7 @@ pub async fn clean(options: Options) {
}
// Prompt the user whether to clear cache or not
let clear_pacman_cache = noconfirm || prompt!(default no, "Also clear pacman's package cache?");
let clear_pacman_cache = noconfirm || prompt!(default no, "{}", fl!("clear-pacman-cache"));
if clear_pacman_cache {
// Clear pacman's cache
@ -96,11 +98,11 @@ pub async fn clean(options: Options) {
if let Err(e) = result {
crash!(
AppExitCode::PacmanError,
"Failed to clear package cache, {}",
e
"{}",
fl!("failed-clear-cache", error = e.to_string())
)
} else {
tracing::info!("Successfully cleared package cache");
tracing::info!("{}", fl!("success-clear-cache"));
}
}
}

@ -1,10 +1,16 @@
use crate::builder::pacman::PacmanInstallBuilder;
use crate::internal::exit_code::AppExitCode;
use crate::{crash, Options};
use crate::{crash, fl, Options};
#[tracing::instrument(level = "trace")]
pub async fn install(packages: Vec<String>, options: Options) {
tracing::info!("Installing packages {} from repos", &packages.join(", "));
tracing::info!(
"{}",
fl!(
"installing-packages-from-repos",
packages = packages.join(", ")
)
);
if !packages.is_empty() {
tracing::debug!("Installing from repos: {:?}", &packages);
@ -17,8 +23,8 @@ pub async fn install(packages: Vec<String>, options: Options) {
if result.is_err() {
crash!(
AppExitCode::PacmanError,
"An error occured while installing packages: {}, aborting",
packages.join(", "),
"{}",
fl!("error-install", error = packages.join(", "))
);
}

@ -2,6 +2,7 @@ use std::fmt::Display;
use std::fmt::Formatter;
use std::str::FromStr;
use crate::fl;
use crate::internal::alpm::Alpm;
use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
@ -49,7 +50,8 @@ impl Display for PackageSearchResult {
};
let out_of_date = if let Some(out_of_date) = self.out_of_date {
format!(
" [out of date: since {}]",
" [{} {}]",
fl!("out-of-date"),
Local
.timestamp(out_of_date.try_into().unwrap(), 0)
.date_naive()
@ -58,7 +60,7 @@ impl Display for PackageSearchResult {
String::new()
};
let installed = if self.installed {
" [installed]".to_string()
format!(" [{}]", fl!("installed"))
} else {
String::new()
};
@ -96,7 +98,8 @@ impl Printable for PackageSearchResult {
.blue();
let out_of_date = if let Some(out_of_date) = self.out_of_date {
format!(
" [out of date: since {}]",
" [{} {}]",
fl!("out-of-date"),
Local
.timestamp(out_of_date.try_into().unwrap(), 0)
.date_naive()
@ -107,7 +110,7 @@ impl Printable for PackageSearchResult {
.bold()
.red();
let installed = if self.installed {
" [installed]".to_string()
format!(" [{}]", fl!("installed"))
} else {
"".to_string()
}

@ -4,7 +4,7 @@ use tokio::fs;
use crate::builder::pacman::PacmanUninstallBuilder;
use crate::internal::exit_code::AppExitCode;
use crate::{crash, Options};
use crate::{crash, fl, Options};
/// Uninstalls the given packages
#[tracing::instrument(level = "trace")]
@ -18,7 +18,7 @@ pub async fn uninstall(packages: Vec<String>, options: Options) {
.uninstall()
.await
.unwrap_or_else(|_| {
crash!(AppExitCode::PacmanError, "Failed to remove packages");
crash!(AppExitCode::PacmanError, "{}", fl!("failed-remove-pkgs"));
});
for package in packages {

@ -5,7 +5,7 @@ use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::rpcinfo;
use crate::operations::aur_install::aur_install;
use crate::{prompt, Options};
use crate::{fl, prompt, Options};
/// Upgrades all installed packages
#[tracing::instrument(level = "trace")]
@ -37,14 +37,14 @@ async fn upgrade_repo(options: Options) {
if result.is_err() {
let continue_upgrading = prompt!(default no,
"Failed to upgrade repo packages, continue to upgrading AUR packages?",
"{}", fl!("failed-upgrade-repo-pkgs")
);
if !continue_upgrading {
tracing::info!("Exiting");
std::process::exit(AppExitCode::PacmanError as i32);
}
} else {
tracing::info!("Successfully upgraded repo packages");
tracing::info!("{}", fl!("success-upgrade-repo-pkgs"));
}
}
@ -76,7 +76,7 @@ async fn upgrade_aur(options: Options) {
aur_upgrades.push(pkg.name);
}
} else {
tracing::warn!("Could not find the remote package for {}", pkg.name);
tracing::warn!("{}", fl!("couldnt-find-remote-pkg", pkg = pkg.name));
}
}
@ -87,9 +87,9 @@ async fn upgrade_aur(options: Options) {
};
aur_install(aur_upgrades, options).await;
} else {
tracing::info!("No upgrades available for installed AUR packages");
tracing::info!("{}", fl!("no-upgrades-aur-package"));
}
tracing::info!("Scanning for .pacnew files post-upgrade");
tracing::info!("{}", fl!("scanning-for-pacnew"));
detect().await;
}

Loading…
Cancel
Save