mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
l10n: port nohup for translation + add french
This commit is contained in:
parent
0a1a36d900
commit
f98f2c130b
3 changed files with 47 additions and 13 deletions
|
@ -5,3 +5,12 @@ nohup-after-help = If standard input is terminal, it'll be replaced with /dev/nu
|
|||
If standard output is terminal, it'll be appended to nohup.out instead,
|
||||
or $HOME/nohup.out, if nohup.out open failed.
|
||||
If standard error is terminal, it'll be redirected to stdout.
|
||||
|
||||
# Error messages
|
||||
nohup-error-cannot-detach = Cannot detach from console
|
||||
nohup-error-cannot-replace = Cannot replace { $name }: { $err }
|
||||
nohup-error-open-failed = failed to open { $path }: { $err }
|
||||
nohup-error-open-failed-both = failed to open { $first_path }: { $first_err }\nfailed to open { $second_path }: { $second_err }
|
||||
|
||||
# Status messages
|
||||
nohup-ignoring-input-appending-output = ignoring input and appending output to { $path }
|
||||
|
|
16
src/uu/nohup/locales/fr-FR.ftl
Normal file
16
src/uu/nohup/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,16 @@
|
|||
nohup-about = Exécuter COMMANDE en ignorant les signaux de raccrochage.
|
||||
nohup-usage = nohup COMMANDE [ARG]...
|
||||
nohup OPTION
|
||||
nohup-after-help = Si l'entrée standard est un terminal, elle sera remplacée par /dev/null.
|
||||
Si la sortie standard est un terminal, elle sera ajoutée à nohup.out à la place,
|
||||
ou $HOME/nohup.out, si l'ouverture de nohup.out a échoué.
|
||||
Si l'erreur standard est un terminal, elle sera redirigée vers la sortie standard.
|
||||
|
||||
# Messages d'erreur
|
||||
nohup-error-cannot-detach = Impossible de se détacher de la console
|
||||
nohup-error-cannot-replace = Impossible de remplacer { $name } : { $err }
|
||||
nohup-error-open-failed = échec de l'ouverture de { $path } : { $err }
|
||||
nohup-error-open-failed-both = échec de l'ouverture de { $first_path } : { $first_err }\néchec de l'ouverture de { $second_path } : { $second_err }
|
||||
|
||||
# Messages de statut
|
||||
nohup-ignoring-input-appending-output = entrée ignorée et sortie ajoutée à { $path }
|
|
@ -8,6 +8,7 @@
|
|||
use clap::{Arg, ArgAction, Command};
|
||||
use libc::{SIG_IGN, SIGHUP};
|
||||
use libc::{c_char, dup2, execvp, signal};
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::ffi::CString;
|
||||
use std::fs::{File, OpenOptions};
|
||||
|
@ -19,7 +20,8 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{UClapError, UError, UResult, set_exit_code};
|
||||
use uucore::{format_usage, show_error};
|
||||
|
||||
use uucore::locale::get_message;
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
|
||||
static NOHUP_OUT: &str = "nohup.out";
|
||||
// exit codes that match the GNU implementation
|
||||
static EXIT_CANCELED: i32 = 125;
|
||||
|
@ -33,20 +35,21 @@ mod options {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
enum NohupError {
|
||||
#[error("Cannot detach from console")]
|
||||
#[error("{}", get_message("nohup-error-cannot-detach"))]
|
||||
CannotDetach,
|
||||
|
||||
#[error("Cannot replace {name}: {err}", name = .0, err = .1)]
|
||||
#[error("{}", get_message_with_args("nohup-error-cannot-replace", HashMap::from([("name".to_string(), _0.to_string()), ("err".to_string(), _1.to_string())])))]
|
||||
CannotReplace(&'static str, #[source] Error),
|
||||
|
||||
#[error("failed to open {path}: {err}", path = NOHUP_OUT.quote(), err = .1)]
|
||||
#[error("{}", get_message_with_args("nohup-error-open-failed", HashMap::from([("path".to_string(), NOHUP_OUT.quote().to_string()), ("err".to_string(), _1.to_string())])))]
|
||||
OpenFailed(i32, #[source] Error),
|
||||
|
||||
#[error("failed to open {first_path}: {first_err}\nfailed to open {second_path}: {second_err}",
|
||||
first_path = NOHUP_OUT.quote(),
|
||||
first_err = .1,
|
||||
second_path = .2.quote(),
|
||||
second_err = .3)]
|
||||
#[error("{}", get_message_with_args("nohup-error-open-failed-both", HashMap::from([
|
||||
("first_path".to_string(), NOHUP_OUT.quote().to_string()),
|
||||
("first_err".to_string(), _1.to_string()),
|
||||
("second_path".to_string(), _2.quote().to_string()),
|
||||
("second_err".to_string(), _3.to_string())
|
||||
])))]
|
||||
OpenFailed2(i32, #[source] Error, String, Error),
|
||||
}
|
||||
|
||||
|
@ -141,8 +144,11 @@ fn find_stdout() -> UResult<File> {
|
|||
{
|
||||
Ok(t) => {
|
||||
show_error!(
|
||||
"ignoring input and appending output to {}",
|
||||
NOHUP_OUT.quote()
|
||||
"{}",
|
||||
get_message_with_args(
|
||||
"nohup-ignoring-input-appending-output",
|
||||
HashMap::from([("path".to_string(), NOHUP_OUT.quote().to_string())])
|
||||
)
|
||||
);
|
||||
Ok(t)
|
||||
}
|
||||
|
@ -157,8 +163,11 @@ fn find_stdout() -> UResult<File> {
|
|||
match OpenOptions::new().create(true).append(true).open(&homeout) {
|
||||
Ok(t) => {
|
||||
show_error!(
|
||||
"ignoring input and appending output to {}",
|
||||
homeout_str.quote()
|
||||
"{}",
|
||||
get_message_with_args(
|
||||
"nohup-ignoring-input-appending-output",
|
||||
HashMap::from([("path".to_string(), homeout_str.quote().to_string())])
|
||||
)
|
||||
);
|
||||
Ok(t)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue