From 014e3b3affc2b38baed1ac73b6c7a33e3e73e472 Mon Sep 17 00:00:00 2001 From: Nahor Date: Tue, 31 Mar 2026 12:34:00 -0700 Subject: [PATCH] math: fix error message Fix badly formatted error message, and make it translatable Part of #12594 --- localization/po/de.po | 3 +++ localization/po/en.po | 3 +++ localization/po/es.po | 3 +++ localization/po/fr.po | 3 +++ localization/po/ja_JP.po | 3 +++ localization/po/pl.po | 3 +++ localization/po/pt_BR.po | 3 +++ localization/po/sv.po | 3 +++ localization/po/zh_CN.po | 3 +++ localization/po/zh_TW.po | 3 +++ src/builtins/math.rs | 3 +-- tests/checks/math.fish | 3 ++- 12 files changed, 33 insertions(+), 3 deletions(-) diff --git a/localization/po/de.po b/localization/po/de.po index 1fc02e7ea..6fb333268 100644 --- a/localization/po/de.po +++ b/localization/po/de.po @@ -1818,6 +1818,9 @@ msgstr "Ungültige Genauigkeitsangabe: %s" msgid "missing hexadecimal number in escape" msgstr "fehlende Hexadezimal-Zahl in Escapesequenz" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/en.po b/localization/po/en.po index e527f058e..f7c594225 100644 --- a/localization/po/en.po +++ b/localization/po/en.po @@ -1818,6 +1818,9 @@ msgstr "invalid precision: %s" msgid "missing hexadecimal number in escape" msgstr "missing hexadecimal number in escape" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/es.po b/localization/po/es.po index d56ee5df1..be91cf8d6 100644 --- a/localization/po/es.po +++ b/localization/po/es.po @@ -1821,6 +1821,9 @@ msgstr "precisión inválida: %s" msgid "missing hexadecimal number in escape" msgstr "falta un número hexadecimal en la secuencia de escape" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "solo se soportan f1 hasta f%d, no ‘f%s’" diff --git a/localization/po/fr.po b/localization/po/fr.po index d2eb2b699..9620c637f 100644 --- a/localization/po/fr.po +++ b/localization/po/fr.po @@ -1947,6 +1947,9 @@ msgstr "précision invalide : %s" msgid "missing hexadecimal number in escape" msgstr "nombre hexadécimal manquant dans l’échappement" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/ja_JP.po b/localization/po/ja_JP.po index b74aa8b5b..1082e9fde 100644 --- a/localization/po/ja_JP.po +++ b/localization/po/ja_JP.po @@ -1820,6 +1820,9 @@ msgstr "無効な精度: %s" msgid "missing hexadecimal number in escape" msgstr "エスケープ内に16進数がありません" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "f1からf%dまでのみサポートされています。'f%s'はサポートされていません" diff --git a/localization/po/pl.po b/localization/po/pl.po index c18fcbf3e..09e984c9c 100644 --- a/localization/po/pl.po +++ b/localization/po/pl.po @@ -1814,6 +1814,9 @@ msgstr "" msgid "missing hexadecimal number in escape" msgstr "" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/pt_BR.po b/localization/po/pt_BR.po index 54960e9a3..2fd5ae71c 100644 --- a/localization/po/pt_BR.po +++ b/localization/po/pt_BR.po @@ -1819,6 +1819,9 @@ msgstr "precisão inválida: %s" msgid "missing hexadecimal number in escape" msgstr "falta número hexadecimal no escape" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/sv.po b/localization/po/sv.po index e5d45678e..ef6faab97 100644 --- a/localization/po/sv.po +++ b/localization/po/sv.po @@ -1815,6 +1815,9 @@ msgstr "" msgid "missing hexadecimal number in escape" msgstr "saknad hexadecimalt nummer i escapesekvens" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "" diff --git a/localization/po/zh_CN.po b/localization/po/zh_CN.po index fcc1ee176..a1a65519a 100644 --- a/localization/po/zh_CN.po +++ b/localization/po/zh_CN.po @@ -1842,6 +1842,9 @@ msgstr "无效的精度:%s" msgid "missing hexadecimal number in escape" msgstr "在转义中缺少十六进制数字" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "仅支持 f1 至 f%d,不支持 'f%s'" diff --git a/localization/po/zh_TW.po b/localization/po/zh_TW.po index 73138f839..5b91938ea 100644 --- a/localization/po/zh_TW.po +++ b/localization/po/zh_TW.po @@ -1816,6 +1816,9 @@ msgstr "無效的精度:%s" msgid "missing hexadecimal number in escape" msgstr "轉義序列缺少十六進位數字" +msgid "non-zero scale value only valid for base 10" +msgstr "" + #, c-format msgid "only f1 through f%d are supported, not 'f%s'" msgstr "只支援 f1 至 f%d,不包括「f%s」" diff --git a/src/builtins/math.rs b/src/builtins/math.rs index 80163a450..e531b61ef 100644 --- a/src/builtins/math.rs +++ b/src/builtins/math.rs @@ -145,8 +145,7 @@ fn parse_cmd_opts( streams.err.appendln(&wgettext_fmt!( BUILTIN_ERR_COMBO2, cmd, - "non-zero scale value only valid - for base 10" + wgettext!("non-zero scale value only valid for base 10") )); return Err(STATUS_INVALID_ARGS); } diff --git a/tests/checks/math.fish b/tests/checks/math.fish index 54d636bca..9a4d6715f 100644 --- a/tests/checks/math.fish +++ b/tests/checks/math.fish @@ -23,6 +23,8 @@ math --scale=6 '5 / 3 * 0.3' # CHECK: 0.5 math --scale=max '5 / 3' # CHECK: 1.666666666666667 +math --scale=1 --base=16 "2 / 3 - 1" +# CHECKERR: math: invalid option combination, non-zero scale value only valid for base 10 math "7^2" # CHECK: 49 math -1 + 1 @@ -138,7 +140,6 @@ math n + 4 # CHECKERR: 'n + 4' # CHECKERR: ^ - not math 'sin()' # CHECKERR: math: Error: Too few arguments # CHECKERR: 'sin()'