1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-13 11:36:12 +02:00

Continue i18n change

This commit is contained in:
Elisabeth Henry 2023-08-19 02:41:12 +02:00
parent 682cc039a3
commit e2fa7aff3c
2 changed files with 10 additions and 5 deletions

View File

@ -9,3 +9,7 @@ error:
no_char: "%{s} is not a char"
no_i32: "%{s} is not an i32"
no_f32: "%{s} is not a f32"
renderer:
no_output: This renderer does not support the auto output
file_creation: "could not create file '%{file}': '%{err}"
write: "could not write book content to file '{file}': {err}"

View File

@ -21,6 +21,7 @@ use crate::error::{Error, Result, Source};
use std::fs::File;
use std::io::Write;
use std::path::Path;
use rust_i18n::t;
/// Trait that must be implemented by the various renderers to render a whole book.
@ -29,7 +30,7 @@ pub trait BookRenderer: Sync {
fn auto_path(&self, _book_file: &str) -> Result<String> {
Err(Error::default(
Source::empty(),
lformat!("This renderer does not support the auto output"),
t!("error.renderer.no_output"),
))
}
@ -47,8 +48,8 @@ pub trait BookRenderer: Sync {
let mut file = File::create(path).map_err(|err| {
Error::default(
Source::empty(),
lformat!(
"could not create file '{file}': {err}",
t!(
"error.renderer.file_creation",
file = path.display(),
err = err
),
@ -57,8 +58,8 @@ pub trait BookRenderer: Sync {
file.write_all(&content).map_err(|err| {
Error::default(
Source::empty(),
lformat!(
"could not write book content to file '{file}': {err}",
t!(
"error.renderer.write",
file = path.display(),
err = err
),