LinuxCommandLibrary

ngettext

handles plural forms in translations

TLDR

Translate with plural form

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

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.

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community