i18n: Use gettext function instead of wrapper

No need to deviate from the default here.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/170>
This commit is contained in:
Sophie Herold 2023-04-11 00:02:28 +02:00 • committed by Christopher Davis
parent 695693cf74
commit f8cc9f5f84
16 changed files with 83 additions and 274 deletions

View file

@ -2,7 +2,7 @@
use super::*;
use crate::decoder::tiling::{self, FrameBufferExt};
use crate::deps::*;
use crate::i18n::*;
use crate::util::gettext::*;
use gtk::prelude::*;
use anyhow::Context;
@ -28,7 +28,7 @@ impl Heif {
log::debug!("Loading HEIF");
updater.spawn_error_handled(move || {
let ctx = HeifContext::read_from_file(&path.display().to_string())
.context(i18n("Failed to read image"))?;
.context(gettext("Failed to read image"))?;
let handle = ctx.primary_image_handle()?;
tiles.set_original_dimensions((handle.width(), handle.height()));
@ -61,7 +61,7 @@ impl Heif {
let mut image = LIBHEIF
.decode(&handle, ColorSpace::Rgb(rgb_chroma), None)
.context(i18n("Failed to decode image"))?;
.context(gettext("Failed to decode image"))?;
let plane = image
.planes_mut()

View file

@ -2,7 +2,7 @@
use super::*;
use crate::decoder::tiling::{self, FrameBufferExt};
use crate::deps::*;
use crate::i18n::*;
use crate::util::gettext::*;
use anyhow::Context;
use arc_swap::ArcSwap;
@ -35,7 +35,8 @@ impl ImageRsOther {
path: &Path,
format: image_rs::ImageFormat,
) -> anyhow::Result<image_rs::io::Reader<BufReader<File>>> {
let mut reader = image_rs::io::Reader::open(path).context(i18n("Failed to open image"))?;
let mut reader =
image_rs::io::Reader::open(path).context(gettext("Failed to open image"))?;
reader.set_format(format);
Ok(reader)
}
@ -88,7 +89,7 @@ impl ImageRsOther {
reader.limits(image_rs::io::Limits::no_limits());
let dynamic_image = reader.decode().context(i18n("Failed to decode image"))?;
let dynamic_image = reader.decode().context(gettext("Failed to decode image"))?;
let decoded_image = Decoded { dynamic_image };

View file

@ -7,7 +7,7 @@ pub use image_rs_other::ImageRsOther;
pub use svg::{Svg, RSVG_MAX_SIZE};
use super::{Decoder, DecoderUpdate, UpdateSender};
use crate::i18n::*;
use crate::util::gettext::*;
#[derive(Clone, Copy, Debug)]
pub enum ImageFormat {
@ -52,9 +52,9 @@ impl std::fmt::Display for ImageFormat {
write!(f, "{}", debug)
}
}
Self::AnimatedGif => write!(f, "{}", i18n("Animated GIF")),
Self::AnimatedWebP => write!(f, "{}", i18n("Animated WebP")),
Self::AnimatedPng => write!(f, "{}", i18n("Animated PNG")),
Self::AnimatedGif => write!(f, "{}", gettext("Animated GIF")),
Self::AnimatedWebP => write!(f, "{}", gettext("Animated WebP")),
Self::AnimatedPng => write!(f, "{}", gettext("Animated PNG")),
Self::Heif => write!(f, "HEIF Container"),
Self::Svg => write!(f, "SVG"),
}