From 98b3ba5e8e66091aa09eed1f2826d4ddb2dd4223 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Wed, 28 May 2025 01:38:40 +0200 Subject: [PATCH] Remove `concat!` macro from localized strings This is done in preparation for a proc macro which extracts strings which are passed to `gettext`. Because the `concat!` macro would get expanded after the proc macro, the proc macro would still see the `concat!`, which it cannot handle. --- src/builtins/fg.rs | 5 +---- src/builtins/read.rs | 5 +---- src/builtins/shared.rs | 6 ++---- src/parse_execution.rs | 5 +---- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/builtins/fg.rs b/src/builtins/fg.rs index 7f9c49cf5..7b562751e 100644 --- a/src/builtins/fg.rs +++ b/src/builtins/fg.rs @@ -97,10 +97,7 @@ pub fn fg(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Built job_pos = Some(pos); job = if !j.wants_job_control() { streams.err.append(wgettext_fmt!( - concat!( - "%ls: Can't put job %d, '%ls' to foreground because ", - "it is not under job control\n" - ), + "%ls: Can't put job %d, '%ls' to foreground because it is not under job control\n", cmd, raw_pid, j.command() diff --git a/src/builtins/read.rs b/src/builtins/read.rs index b706a5e5b..9f7f4e74d 100644 --- a/src/builtins/read.rs +++ b/src/builtins/read.rs @@ -107,10 +107,7 @@ fn parse_cmd_opts( } 'i' => { streams.err.append(wgettext_fmt!( - concat!( - "%ls: usage of -i for --silent is deprecated. Please ", - "use -s or --silent instead.\n" - ), + "%ls: usage of -i for --silent is deprecated. Please use -s or --silent instead.\n", cmd )); return Err(STATUS_INVALID_ARGS); diff --git a/src/builtins/shared.rs b/src/builtins/shared.rs index 5d36c20bc..2fb854d9e 100644 --- a/src/builtins/shared.rs +++ b/src/builtins/shared.rs @@ -26,10 +26,8 @@ pub const BUILTIN_ERR_MISSING: &str = "%ls: %ls: option requires an argument\n"; /// Error message on missing man page. -pub const BUILTIN_ERR_MISSING_HELP: &str = concat!( - "fish: %ls: missing man page\nDocumentation may not be installed.\n`help %ls` will ", - "show an online version\n" -); +pub const BUILTIN_ERR_MISSING_HELP: &str = + "fish: %ls: missing man page\nDocumentation may not be installed.\n`help %ls` will show an online version\n"; /// Error message on multiple scope levels for variables. pub const BUILTIN_ERR_GLOCAL: &str = diff --git a/src/parse_execution.rs b/src/parse_execution.rs index b8bc0cecc..38cad8380 100644 --- a/src/parse_execution.rs +++ b/src/parse_execution.rs @@ -278,10 +278,7 @@ fn handle_command_not_found( ctx, STATUS_NOT_EXECUTABLE, &statement.command, - concat!( - "Unknown command. A component of '%ls' is not a ", - "directory. Check your $PATH." - ), + "Unknown command. A component of '%ls' is not a directory. Check your $PATH.", cmd ); } else {