uudoc: make tldr attribution and disclaimer translatable

This commit is contained in:
Sylvestre Ledru
2026-03-22 17:27:49 +01:00
parent 05b8585820
commit e2cc2ec536
3 changed files with 13 additions and 8 deletions
+5 -8
View File
@@ -25,6 +25,7 @@ use zip::ZipArchive;
use coreutils::validation;
use uucore::Args;
use uucore::locale::get_message;
include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));
@@ -246,6 +247,8 @@ fn main() -> io::Result<()> {
}
}
let utils = util_map::<Box<dyn Iterator<Item = OsString>>>();
// Initialize localization for uucore common strings (used by tldr example attribution)
let _ = uucore::locale::setup_localization("uudoc");
match std::fs::create_dir("docs/src/utils/") {
Err(e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
x => x,
@@ -693,15 +696,9 @@ fn format_examples(content: String, output_markdown: bool) -> Result<String, std
}
}
writeln!(s)?;
writeln!(
s,
"> The examples are provided by the [tldr-pages project](https://tldr.sh) under the [CC BY 4.0 License](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md)."
)?;
writeln!(s, "> {}", get_message("uudoc-tldr-attribution"))?;
writeln!(s, ">")?;
writeln!(
s,
"> Please note that, as uutils is a work in progress, some examples might fail."
)?;
writeln!(s, "> {}", get_message("uudoc-tldr-disclaimer"))?;
Ok(s)
}