From 05c236481f1fb99583fac7599baadbaa8a27d3c0 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Mon, 2 Feb 2026 01:58:07 +0100 Subject: [PATCH] gettext: remove leading spaces Now, non of the localizable strings in Rust have any more leading or trailing spaces, making it easier to use them with Fluent. Again, there are some slight issues with Chinese translations, which now have additional whitespace. Part of #12405 --- localization/po/de.po | 20 ++++++++++---------- localization/po/en.po | 20 ++++++++++---------- localization/po/fr.po | 20 ++++++++++---------- localization/po/pl.po | 20 ++++++++++---------- localization/po/pt_BR.po | 20 ++++++++++---------- localization/po/sv.po | 20 ++++++++++---------- localization/po/zh_CN.po | 20 ++++++++++---------- localization/po/zh_TW.po | 20 ++++++++++---------- src/builtins/set.rs | 6 ++++-- src/builtins/type.rs | 7 +++++-- src/parser.rs | 3 ++- 11 files changed, 91 insertions(+), 85 deletions(-) diff --git a/localization/po/de.po b/localization/po/de.po index 03f38a294..0d5793d0c 100644 --- a/localization/po/de.po +++ b/localization/po/de.po @@ -24,16 +24,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr " eine Pfadvariable" - -#, c-format -msgid " with arguments '%s'" -msgstr "mit den Parametern '%s'" - -msgid " with definition" -msgstr " mit Definition" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "" @@ -1733,6 +1723,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "eine Pfadvariable" + msgid "array indices start at 1, not 0." msgstr "Array-Indizes beginnen mit 1, nicht 0" @@ -1875,6 +1868,13 @@ msgstr "" msgid "unlimited" msgstr "unbegrenzt" +#, c-format +msgid "with arguments '%s'" +msgstr "mit den Parametern '%s'" + +msgid "with definition" +msgstr "mit Definition" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "|& ist ungültig. In fish, nutze &| um stdout und stderr gleichzeitig zu pipen" diff --git a/localization/po/en.po b/localization/po/en.po index d039005ed..0a32ccb95 100644 --- a/localization/po/en.po +++ b/localization/po/en.po @@ -24,16 +24,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "" - -#, c-format -msgid " with arguments '%s'" -msgstr "" - -msgid " with definition" -msgstr "" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "" @@ -1733,6 +1723,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "" + msgid "array indices start at 1, not 0." msgstr "" @@ -1875,6 +1868,13 @@ msgstr "" msgid "unlimited" msgstr "" +#, c-format +msgid "with arguments '%s'" +msgstr "" + +msgid "with definition" +msgstr "" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "" diff --git a/localization/po/fr.po b/localization/po/fr.po index 536630a68..5e490452a 100644 --- a/localization/po/fr.po +++ b/localization/po/fr.po @@ -153,16 +153,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr " une variable de chemin" - -#, c-format -msgid " with arguments '%s'" -msgstr " avec les arguments « %s »" - -msgid " with definition" -msgstr " avec la définition" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "$# n’est pas supporté. Dans fish, veuillez utiliser « count $argv »." @@ -1862,6 +1852,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "une variable de chemin" + msgid "array indices start at 1, not 0." msgstr "" @@ -2004,6 +1997,13 @@ msgstr "" msgid "unlimited" msgstr "" +#, c-format +msgid "with arguments '%s'" +msgstr "avec les arguments « %s »" + +msgid "with definition" +msgstr "avec la définition" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "" diff --git a/localization/po/pl.po b/localization/po/pl.po index d97ccc95b..f3c906d72 100644 --- a/localization/po/pl.po +++ b/localization/po/pl.po @@ -20,16 +20,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "" - -#, c-format -msgid " with arguments '%s'" -msgstr "" - -msgid " with definition" -msgstr "" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "$# nie jest obsługiwane. W fish używane jest 'count $argv'." @@ -1729,6 +1719,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "" + msgid "array indices start at 1, not 0." msgstr "" @@ -1871,6 +1864,13 @@ msgstr "" msgid "unlimited" msgstr "" +#, c-format +msgid "with arguments '%s'" +msgstr "" + +msgid "with definition" +msgstr "" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "" diff --git a/localization/po/pt_BR.po b/localization/po/pt_BR.po index 8b252c810..7da3dc493 100644 --- a/localization/po/pt_BR.po +++ b/localization/po/pt_BR.po @@ -25,16 +25,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "" - -#, c-format -msgid " with arguments '%s'" -msgstr "" - -msgid " with definition" -msgstr " com definição" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "" @@ -1734,6 +1724,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "" + msgid "array indices start at 1, not 0." msgstr "" @@ -1876,6 +1869,13 @@ msgstr "" msgid "unlimited" msgstr "" +#, c-format +msgid "with arguments '%s'" +msgstr "" + +msgid "with definition" +msgstr "com definição" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "" diff --git a/localization/po/sv.po b/localization/po/sv.po index f54118fde..ac7d541aa 100644 --- a/localization/po/sv.po +++ b/localization/po/sv.po @@ -21,16 +21,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "" - -#, c-format -msgid " with arguments '%s'" -msgstr "" - -msgid " with definition" -msgstr "" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "" @@ -1730,6 +1720,9 @@ msgstr "" msgid "[: the last argument must be ']'" msgstr "" +msgid "a path variable" +msgstr "" + msgid "array indices start at 1, not 0." msgstr "" @@ -1872,6 +1865,13 @@ msgstr "" msgid "unlimited" msgstr "" +#, c-format +msgid "with arguments '%s'" +msgstr "" + +msgid "with definition" +msgstr "" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "" diff --git a/localization/po/zh_CN.po b/localization/po/zh_CN.po index be33c3e74..2f0908cac 100644 --- a/localization/po/zh_CN.po +++ b/localization/po/zh_CN.po @@ -45,16 +45,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "路径变量" - -#, c-format -msgid " with arguments '%s'" -msgstr ",参数为 '%s'" - -msgid " with definition" -msgstr ",定义为" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "不支持 $#。在 fish 中,请使用 'count $argv'。" @@ -1757,6 +1747,9 @@ msgstr "写/读通用变量存储" msgid "[: the last argument must be ']'" msgstr "[:最后的参数必须是 ']'" +msgid "a path variable" +msgstr "路径变量" + msgid "array indices start at 1, not 0." msgstr "数组索引起始为 1,而不是 0。" @@ -1902,6 +1895,13 @@ msgstr "未知修饰符 '%s' 于 '%s'" msgid "unlimited" msgstr "无限制" +#, c-format +msgid "with arguments '%s'" +msgstr ",参数为 '%s'" + +msgid "with definition" +msgstr ",定义为" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "|& 无效。在 fish 中,用 &| 来同时管道链接 stdout 和 stderr。" diff --git a/localization/po/zh_TW.po b/localization/po/zh_TW.po index 894f0be51..0b4b7fc5d 100644 --- a/localization/po/zh_TW.po +++ b/localization/po/zh_TW.po @@ -18,16 +18,6 @@ msgstr "" msgid "fish-section-tier1-from-rust" msgstr "" -msgid " a path variable" -msgstr "路徑變數" - -#, c-format -msgid " with arguments '%s'" -msgstr ",引數為「%s」" - -msgid " with definition" -msgstr ",定義為" - msgid "$# is not supported. In fish, please use 'count $argv'." msgstr "不支援 $#。在 fish 中請使用「count $argv」。" @@ -1732,6 +1722,9 @@ msgstr "通域變數存檔寫入/讀取" msgid "[: the last argument must be ']'" msgstr "[:最後一個引數必須是「]」" +msgid "a path variable" +msgstr "路徑變數" + msgid "array indices start at 1, not 0." msgstr "陣列索引值從 1 開始而非 0。" @@ -1877,6 +1870,13 @@ msgstr "未知的修飾鍵「%s」,於「%s」" msgid "unlimited" msgstr "無限制" +#, c-format +msgid "with arguments '%s'" +msgstr ",引數為「%s」" + +msgid "with definition" +msgstr ",定義為" + msgid "|& is not valid. In fish, use &| to pipe both stdout and stderr." msgstr "|& 無效。在 fish 中請使用 &| 來同時管道傳輸 stdout 和 stderr。" diff --git a/src/builtins/set.rs b/src/builtins/set.rs index d33ae3f7e..f6344fab7 100644 --- a/src/builtins/set.rs +++ b/src/builtins/set.rs @@ -652,9 +652,11 @@ fn show_scope(var_name: &wstr, scope: EnvMode, streams: &mut IoStreams, vars: &d wgettext!("unexported") }; let pathvarv = if var.is_pathvar() { - wgettext!(" a path variable") + let mut pathvarv = L!(" ").to_owned(); + pathvarv.push_utfstr(wgettext!("a path variable")); + pathvarv } else { - L!("") + L!("").to_owned() }; let vals = var.as_list(); streams.out.append(&wgettext_fmt!( diff --git a/src/builtins/type.rs b/src/builtins/type.rs index f88c99c3c..136c270c2 100644 --- a/src/builtins/type.rs +++ b/src/builtins/type.rs @@ -135,8 +135,11 @@ pub fn r#type(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> B streams.out.appendln(path); } } else if !opts.short_output { - streams.out.append(&wgettext_fmt!("%s is a function", arg)); - streams.out.appendln(wgettext!(" with definition")); + streams.out.append(&sprintf!( + "%s %s\n", + wgettext_fmt!("%s is a function", arg), + wgettext!("with definition") + )); let mut def = WString::new(); def.push_utfstr(&sprintf!( "# %s\n%s", diff --git a/src/parser.rs b/src/parser.rs index de19fa64a..c82323edd 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1402,8 +1402,9 @@ fn append_block_description_to_stack_trace( } } if !args_str.is_empty() { + trace.push(' '); // TODO: Escape these. - trace.push_utfstr(&wgettext_fmt!(" with arguments '%s'", args_str)); + trace.push_utfstr(&wgettext_fmt!("with arguments '%s'", args_str)); } trace.push('\n'); print_source_location = true;