ngettext

handles plural forms in translations

TLDR

Translate with plural form
$ ngettext "[singular]" "[plural]" [count]
Translate with domain
$ ngettext -d [domain] "[singular]" "[plural]" [count]
Use specific locale
$ LANG=[de_DE] ngettext "[1 file]" "[%d files]" [5]
Specify directory
$ ngettext -d [domain] -e "[singular]" "[plural]" [count]

SYNOPSIS

ngettext [options] singular plural count

DESCRIPTION

ngettext handles plural forms in translations. It's part of GNU gettext.The tool selects correct plural form based on count. Language-specific plural rules.

PARAMETERS

SINGULAR

Singular form message.
PLURAL
Plural form message.
COUNT
Number for plural selection.
-d DOMAIN
Message domain.
-e
Enable escape sequences.
--help
Display help information.

INSTALL

sudo apt install gettext-base
sudo dnf install gettext
sudo pacman -S gettext
sudo apk add gettext
brew install gettext
nix profile install nixpkgs#gettext

CAVEATS

Part of gettext. Shell utility. Locale-dependent output.

HISTORY

ngettext is part of GNU gettext, providing plural form support for internationalized programs.

SEE ALSO

gettext(1), envsubst(1), msgfmt(1)