diff --git a/src/uu/pwd/locales/en-US.ftl b/src/uu/pwd/locales/en-US.ftl index 52a4a2283..ffed18f37 100644 --- a/src/uu/pwd/locales/en-US.ftl +++ b/src/uu/pwd/locales/en-US.ftl @@ -1,2 +1,10 @@ pwd-about = Display the full filename of the current working directory. -pwd-usage = pwd [OPTION]... [FILE]... +pwd-usage = pwd [OPTION]... + +# Help messages +pwd-help-logical = use PWD from environment, even if it contains symlinks +pwd-help-physical = avoid all symlinks + +# Error messages +pwd-error-failed-to-get-current-directory = failed to get current directory +pwd-error-failed-to-print-current-directory = failed to print current directory diff --git a/src/uu/pwd/locales/fr-FR.ftl b/src/uu/pwd/locales/fr-FR.ftl new file mode 100644 index 000000000..95a79a362 --- /dev/null +++ b/src/uu/pwd/locales/fr-FR.ftl @@ -0,0 +1,10 @@ +pwd-about = Afficher le nom de fichier complet du répertoire de travail actuel. +pwd-usage = pwd [OPTION]... + +# Messages d'aide +pwd-help-logical = utiliser PWD de l'environnement, même s'il contient des liens symboliques +pwd-help-physical = éviter tous les liens symboliques + +# Messages d'erreur +pwd-error-failed-to-get-current-directory = échec de l'obtention du répertoire actuel +pwd-error-failed-to-print-current-directory = échec de l'affichage du répertoire actuel diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index f1f398d9b..5abe5aae0 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -119,7 +119,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } else { physical_path() } - .map_err_context(|| "failed to get current directory".to_owned())?; + .map_err_context(|| get_message("pwd-error-failed-to-get-current-directory"))?; // \\?\ is a prefix Windows gives to paths under certain circumstances, // including when canonicalizing them. @@ -132,8 +132,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .map(Into::into) .unwrap_or(cwd); - println_verbatim(cwd).map_err_context(|| "failed to print current directory".to_owned())?; - + println_verbatim(cwd) + .map_err_context(|| get_message("pwd-error-failed-to-print-current-directory"))?; Ok(()) } @@ -147,7 +147,7 @@ pub fn uu_app() -> Command { Arg::new(OPT_LOGICAL) .short('L') .long(OPT_LOGICAL) - .help("use PWD from environment, even if it contains symlinks") + .help(get_message("pwd-help-logical")) .action(ArgAction::SetTrue), ) .arg( @@ -155,7 +155,7 @@ pub fn uu_app() -> Command { .short('P') .long(OPT_PHYSICAL) .overrides_with(OPT_LOGICAL) - .help("avoid all symlinks") + .help(get_message("pwd-help-physical")) .action(ArgAction::SetTrue), ) } diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index 77826b878..bee42a603 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -38,7 +38,7 @@ fn test_deleted_dir() { let output = Command::new("sh") .arg("-c") .arg(format!( - "cd '{}'; mkdir foo; cd foo; rmdir ../foo; exec '{}' {}", + "cd '{}'; mkdir foo; cd foo; rmdir ../foo; LANG=C exec '{}' {}", at.root_dir_resolved(), ts.bin_path.to_str().unwrap(), ts.util_name, @@ -48,8 +48,8 @@ fn test_deleted_dir() { assert!(!output.status.success()); assert!(output.stdout.is_empty()); assert_eq!( - output.stderr, - b"pwd: failed to get current directory: No such file or directory\n" + String::from_utf8_lossy(&output.stderr), + "pwd: failed to get current directory: No such file or directory\n" ); }