From a317a6acd9839e55bcbf55b122bd1619d22a5efa Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Sun, 8 Jun 2025 01:45:51 +0200 Subject: [PATCH] Unconditionally include gettext message Definitions of localizable strings should not be guarded by `cfg`, because then they might not end up being exported, depending on the compilation config. --- po/de.po | 13 +++++++++++++ po/en.po | 17 +++++++++++------ po/fr.po | 17 +++++++++++------ po/pl.po | 17 +++++++++++------ po/pt_BR.po | 17 +++++++++++------ po/sv.po | 17 +++++++++++------ po/zh_CN.po | 13 +++++++++++++ src/builtins/status.rs | 19 +++++++++++-------- src/signal.rs | 32 ++++++++++++++++++++++++++------ 9 files changed, 118 insertions(+), 44 deletions(-) diff --git a/po/de.po b/po/de.po index cc454a1df..28df63a9f 100644 --- a/po/de.po +++ b/po/de.po @@ -700,6 +700,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls: Erwartete numerischen Wert" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "%ls: Brauche Funktionsnamen" @@ -1179,6 +1184,10 @@ msgstr "Illegale Instruktion" msgid "Incomplete escape sequence '%ls'" msgstr "Unvollständige Escapesequenz '%ls'" +# +msgid "Information request" +msgstr "" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "Ganzzahl %lld in '%ls' gefolgt von nicht-Ziffer" @@ -1709,6 +1718,10 @@ msgstr "Nicht passender Platzhalter" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "" +# +msgid "Unused signal" +msgstr "" + msgid "Urgent socket condition" msgstr "Vorrangige Socket-Bedingung" diff --git a/po/en.po b/po/en.po index 9e6a0c5f1..2f570a166 100644 --- a/po/en.po +++ b/po/en.po @@ -698,6 +698,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls: expected a numeric value" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "" @@ -1177,6 +1182,9 @@ msgstr "Illegal instruction" msgid "Incomplete escape sequence '%ls'" msgstr "" +msgid "Information request" +msgstr "Information request" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "" @@ -1707,6 +1715,9 @@ msgstr "" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "" +msgid "Unused signal" +msgstr "Unused signal" + msgid "Urgent socket condition" msgstr "Urgent socket condition" @@ -79398,15 +79409,9 @@ msgstr "" #~ msgid "Virtual timer expired" #~ msgstr "Virtual timer expired" -#~ msgid "Information request" -#~ msgstr "Information request" - #~ msgid "Emulator trap" #~ msgstr "Emulator trap" -#~ msgid "Unused signal" -#~ msgstr "Unused signal" - #~ msgid "Process file after the compiler reads in the standard specs file, in order to override the defaults that the gcc driver program uses when determining what switches to pass to cc1, cc1plus, as, ld, etc" #~ msgstr "Process file after the compiler reads in the standard specs file, in order to override the defaults that the gcc driver program uses when determining what switches to pass to cc1, cc1plus, as, ld, etc" diff --git a/po/fr.po b/po/fr.po index 0ff2bfffd..5381e6d7b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -799,6 +799,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls : valeur numérique attendue" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "" @@ -1278,6 +1283,9 @@ msgstr "Instruction illégale" msgid "Incomplete escape sequence '%ls'" msgstr "" +msgid "Information request" +msgstr "Demande d'information" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "" @@ -1808,6 +1816,9 @@ msgstr "" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "Usage de '=' non supporté. Dans fish, veuillez utiliser 'set %ls %ls'." +msgid "Unused signal" +msgstr "Signal inutilisé" + msgid "Urgent socket condition" msgstr "Condition urgente de socket" @@ -80784,15 +80795,9 @@ msgstr "" #~ msgid "Virtual timer expired" #~ msgstr "Délai virtuel expiré" -#~ msgid "Information request" -#~ msgstr "Demande d'information" - #~ msgid "Emulator trap" #~ msgstr "Déroutement d'émulation" -#~ msgid "Unused signal" -#~ msgstr "Signal inutilisé" - #, c-format #~ msgid "getcwd() failed with errno %d/%s" #~ msgstr "getcwd() a échoué avec l’erreur %d/%s" diff --git a/po/pl.po b/po/pl.po index f98cf10ef..b34766aed 100644 --- a/po/pl.po +++ b/po/pl.po @@ -694,6 +694,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls: oczekiwano wartości liczbowej" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "" @@ -1173,6 +1178,9 @@ msgstr "Niedozwolona instrukcja" msgid "Incomplete escape sequence '%ls'" msgstr "" +msgid "Information request" +msgstr "Żądanie informacji" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "" @@ -1703,6 +1711,9 @@ msgstr "" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "Nieobsługiwane użycie '='. W fish używane jest 'set %ls %ls'." +msgid "Unused signal" +msgstr "Niewykorzystywany sygnał" + msgid "Urgent socket condition" msgstr "" @@ -79219,12 +79230,6 @@ msgstr "" #~ msgid "Could not return shell to foreground" #~ msgstr "Nie można przywrócić powłoki na pierwszy plan" -#~ msgid "Information request" -#~ msgstr "Żądanie informacji" - -#~ msgid "Unused signal" -#~ msgstr "Niewykorzystywany sygnał" - #, c-format #~ msgid "Send job %d '%ls' to background\n" #~ msgstr "Wyślij zadanie %d '%ls' w tło\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 94d31ed2c..adf6f7fcc 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -699,6 +699,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls: esperava valor numérico" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "" @@ -1178,6 +1183,9 @@ msgstr "Instrução ilegal" msgid "Incomplete escape sequence '%ls'" msgstr "" +msgid "Information request" +msgstr "Requisição de informação" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "" @@ -1708,6 +1716,9 @@ msgstr "" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "" +msgid "Unused signal" +msgstr "Sinal não utilizado" + msgid "Urgent socket condition" msgstr "Condição urgente de socket" @@ -79275,15 +79286,9 @@ msgstr "" #~ msgid "Virtual timer expired" #~ msgstr "Temporizador virtual expirado" -#~ msgid "Information request" -#~ msgstr "Requisição de informação" - #~ msgid "Emulator trap" #~ msgstr "Armadilha de emulador" -#~ msgid "Unused signal" -#~ msgstr "Sinal não utilizado" - #~ msgid "Use new incremental GNU format" #~ msgstr "Use new incremental GNU format" diff --git a/po/sv.po b/po/sv.po index c579dbd65..ea8a974ae 100644 --- a/po/sv.po +++ b/po/sv.po @@ -695,6 +695,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "" @@ -1174,6 +1179,9 @@ msgstr "Ogiltig instruktion" msgid "Incomplete escape sequence '%ls'" msgstr "" +msgid "Information request" +msgstr "Informationsbegäran" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "" @@ -1704,6 +1712,9 @@ msgstr "" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "" +msgid "Unused signal" +msgstr "Oanvänd signal" + msgid "Urgent socket condition" msgstr "Viktig socket-situation" @@ -79266,15 +79277,9 @@ msgstr "" #~ msgid "Virtual timer expired" #~ msgstr "Virtuell timer utlöst" -#~ msgid "Information request" -#~ msgstr "Informationsbegäran" - #~ msgid "Emulator trap" #~ msgstr "Emulatorfälla" -#~ msgid "Unused signal" -#~ msgstr "Oanvänd signal" - #~ msgid "Use new incremental GNU format" #~ msgstr "Använd nytt inkrementellt GNU-format" diff --git a/po/zh_CN.po b/po/zh_CN.po index 42b400ecc..fd7ab7855 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -692,6 +692,11 @@ msgstr "" msgid "%ls: expected a numeric value" msgstr "%ls: 预期数字类型值" +# +#, c-format +msgid "%ls: fish was not built with embedded files" +msgstr "" + #, c-format msgid "%ls: function name required" msgstr "%ls: 函数名称是必须的" @@ -1171,6 +1176,10 @@ msgstr "" msgid "Incomplete escape sequence '%ls'" msgstr "不完整的转义序列 '%ls'" +# +msgid "Information request" +msgstr "" + #, c-format msgid "Integer %lld in '%ls' followed by non-digit" msgstr "整数 %lld 在 '%ls' 中,后面跟随着非数字" @@ -1701,6 +1710,10 @@ msgstr "未匹配的通配符" msgid "Unsupported use of '='. In fish, please use 'set %ls %ls'." msgstr "不支持使用'='. 在fish类中,请使用'set %ls %ls'." +# +msgid "Unused signal" +msgstr "" + msgid "Urgent socket condition" msgstr "" diff --git a/src/builtins/status.rs b/src/builtins/status.rs index 13346d2f8..0b273de46 100644 --- a/src/builtins/status.rs +++ b/src/builtins/status.rs @@ -327,6 +327,11 @@ fn parse_cmd_opts( struct Docs; pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> BuiltinResult { + localizable_consts!( + #[allow(dead_code)] + NO_EMBEDDED_FILES_MSG "%ls: fish was not built with embedded files" + ); + let cmd = args[0]; let argc = args.len(); @@ -474,10 +479,9 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B } #[cfg(not(feature = "embed-data"))] { - streams.err.appendln(wgettext_fmt!( - "%ls: fish was not built with embedded files", - cmd, - )); + streams + .err + .appendln(sprintf!(NO_EMBEDDED_FILES_MSG.localize(), cmd)); return Err(STATUS_CMD_ERROR); } } @@ -520,10 +524,9 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B } #[cfg(not(feature = "embed-data"))] { - streams.err.appendln(wgettext_fmt!( - "%ls: fish was not built with embedded files", - cmd, - )); + streams + .err + .appendln(sprintf!(NO_EMBEDDED_FILES_MSG.localize(), cmd)); return Err(STATUS_CMD_ERROR); } } diff --git a/src/signal.rs b/src/signal.rs index c8a9397fe..8c4eca57b 100644 --- a/src/signal.rs +++ b/src/signal.rs @@ -365,13 +365,16 @@ const fn new(signal: i32, name: &'static wstr, desc: LocalizableString) -> Self } macro_rules! signal_entry { - ($name:ident, $desc:expr) => { + ($name:ident, $desc:literal) => { LookupEntry::new( libc::$name, L!(stringify!($name)), localizable_string!($desc), ) }; + ($name:ident, $desc:expr) => { + LookupEntry::new(libc::$name, L!(stringify!($name)), $desc) + }; } // Lookup table used to convert between signal names and signal ids, etc. @@ -409,24 +412,41 @@ macro_rules! signal_entry { signal_entry!(SIGIOT, "Abort (Alias for SIGABRT)"), #[cfg(any(apple, bsd))] - signal_entry!(SIGEMT, "Unused signal"), + signal_entry!(SIGEMT, SIGEMT_DESC), #[cfg(any(apple, bsd))] - signal_entry!(SIGINFO, "Information request"), + signal_entry!(SIGINFO, SIGINFO_DESC), #[cfg(target_os = "linux")] - signal_entry!(SIGSTKFLT, "Stack fault"), + signal_entry!(SIGSTKFLT, SIGSTKFLT_DESC), #[cfg(target_os = "linux")] - signal_entry!(SIGIOT, "Abort (Alias for SIGABRT)"), + signal_entry!(SIGIOT, SIGIOT_DESC), #[cfg(target_os = "linux")] - signal_entry!(SIGPWR, "Power failure"), + signal_entry!(SIGPWR, SIGPWR_DESC), // TODO: determine whether SIGWIND is defined on any platform. //signal_entry!(SIGWIND, "Window size change"), ]; +localizable_consts!( + #[allow(dead_code)] + SIGEMT_DESC "Unused signal" + + #[allow(dead_code)] + SIGINFO_DESC "Information request" + + #[allow(dead_code)] + SIGSTKFLT_DESC "Stack fault" + + #[allow(dead_code)] + SIGIOT_DESC "Abort (Alias for SIGABRT)" + + #[allow(dead_code)] + SIGPWR_DESC "Power failure" +); + // Return true if two strings are equal, ignoring ASCII case. fn equals_ascii_icase(left: &wstr, right: &wstr) -> bool { if left.len() != right.len() {