pacman-key: Use ngettext for plurals

There are two strings that may be singular or plural in pacman-key.
Use ngettext to handle these strings correctly, and provide a fallback
function if it is not available.

Fixes FS#70556.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2022-12-23 16:41:17 +10:00
parent 6344aab3bd
commit 3f8029af92

View file

@ -378,7 +378,7 @@ populate_keyring() {
key_count=$((key_count+1))
done
if (( key_count )); then
msg2 "$(gettext "Disabled %s keys.")" "${key_count}"
msg2 "$(ngettext "Disabled %s key." "Disabled %s keys." "${key_count}")" "${key_count}"
fi
fi
}
@ -506,7 +506,7 @@ lsign_keys() {
exit 1
fi
if (( key_count )); then
msg2 "$(gettext "Locally signed %s keys.")" "${key_count}"
msg2 "$(ngettext "Locally signed %s key." "Locally signed %s keys." "${key_count}")" "${key_count}"
fi
}
@ -612,6 +612,16 @@ if ! type gettext &>/dev/null; then
}
fi
if ! type ngettext &>/dev/null; then
ngettext() {
if (( $3 == 1 )); then
echo "$1"
else
echo "$2"
done
}
fi
OPT_SHORT="adefhlruvV"
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'