uudoc: make tldr attribution and disclaimer translatable

This commit is contained in:
Sylvestre Ledru
2026-03-22 09:44:42 +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)
}
+4
View File
@@ -80,3 +80,7 @@ checksum-failed-open-file = { $count ->
*[other] { $count } listed files could not be read
}
checksum-error-algo-bad-format = { $file }: { $line }: improperly formatted { $algo } checksum line
# uudoc tldr examples messages
uudoc-tldr-attribution = 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).
uudoc-tldr-disclaimer = Please note that, as uutils is a work in progress, some examples might fail.
+4
View File
@@ -74,3 +74,7 @@ checksum-failed-open-file = { $count ->
*[other] { $count } fichiers passés n'ont pas pu être lu
}
checksum-error-algo-bad-format = { $file }: { $line }: ligne invalide pour { $algo }
# Messages uudoc pour les exemples tldr
uudoc-tldr-attribution = Les exemples sont fournis par le [projet tldr-pages](https://tldr.sh) sous la [licence CC BY 4.0](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md).
uudoc-tldr-disclaimer = Veuillez noter que, uutils étant en cours de développement, certains exemples peuvent échouer.