Sign in

gettext(1) on Solnix vs Linux and the BSDs

On Solnix, gettext is the illumos gettext at /usr/bin/gettext, which reads catalogs from /usr/lib/locale and takes -d (or --domain), -e, -n and -s. It has no -c (message context), -E, -h or -V, which GNU gettext on Linux documents.

What Solnix runs

A default Solnix system runs the illumos gettext at /usr/bin/gettext. No other illumos variants are shipped. GNU gettext-runtime 0.22.5 gettext(1) is available from pkgs.solnix.gettext; it is not on PATH by default.

Differences

Compared withTopicWhat differs
Linuxsame program as the alternativeThe gettext in pkgs.solnix.gettext is GNU gettext-runtime, the same program as Linux gettext. The page texts match: same options and same synopsis. The Solnix package is 0.22.5 and the Linux page is 1.0. The illumos gettext on PATH is a different program.
Source: Solnix gettext(1) from pkgs.solnix.gettext (GNU gettext-runtime 0.22.5); Linux gettext(1) (GNU gettext-runtime 1.0)
Linux-c message contextGNU gettext on Linux has -c/--context CONTEXT to look up a message by context. The illumos page documents no -c.
Source: illumos gettext(1) SYNOPSIS, OPTIONS; Linux gettext(1) -c, --context
Linux-E, -h, -VThe illumos page documents none of -E (ignored), -h/--help or -V/--version; its only long option is --domain. GNU gettext on Linux documents all three, plus --context.
Source: illumos gettext(1) SYNOPSIS, OPTIONS; Linux gettext(1) -E, -h, -V
NetBSD-d textdomainThe illumos gettext takes -d textdomain or --domain=textdomain. NetBSD gettext has neither; the domain comes only from the textdomain operand or TEXTDOMAIN.
Source: illumos gettext(1) OPTIONS (-d, --domain); NetBSD gettext(1) SYNOPSIS, DESCRIPTION
Linux, NetBSDdefault catalog directoryThe illumos gettext looks in /usr/lib/locale/lang/LC_MESSAGES, and NetBSD defaults to /usr/share/locale. The Linux page names a Nix store share/locale path as its standard search directory.
Source: illumos gettext(1) DESCRIPTION, TEXTDOMAINDIR; NetBSD gettext(1) DESCRIPTION; Linux gettext(1) DESCRIPTION
Linux, NetBSDTEXTDOMAINDIR scopeOn illumos, TEXTDOMAINDIR replaces the path up to the locale name, so a catalog is found under $TEXTDOMAINDIR/lang/LC_MESSAGES. The NetBSD and Linux pages say only that it overrides or names another location for the catalogs.
Source: illumos gettext(1) DESCRIPTION; NetBSD gettext(1) ENVIRONMENT; Linux gettext(1) DESCRIPTION
NetBSDlocale variablesThe illumos page lists LANG and LC_MESSAGES (LC_MESSAGES overrides LANG) as selecting the locale. The NetBSD page lists only TEXTDOMAIN and TEXTDOMAINDIR and says the locale is determined 'by the environment'.
Source: illumos gettext(1) ENVIRONMENT VARIABLES; NetBSD gettext(1) ENVIRONMENT, DESCRIPTION
Linux, NetBSDescape handling and -eThe illumos gettext interprets C escape sequences such as \t and \n in msgid by default; with -s it expands none unless -e is given. NetBSD -e interprets backslash escapes before translation, and GNU -e enables some escape sequences.
Source: illumos gettext(1) DESCRIPTION, -e, -s; NetBSD gettext(1) -e; Linux gettext(1) -e
Linuxtextdomain operand vs -dThe illumos page says the textdomain operand overrides -d. The Linux page does not say which wins when both are given.
Source: illumos gettext(1) OPERANDS (textdomain); Linux gettext(1) -d
Linux, NetBSDexit statusNetBSD documents exit 0 on success and >0 on error. The illumos page has no EXIT STATUS section, and neither does the Linux page, so the manuals do not say.
Source: NetBSD gettext(1) EXIT STATUS; illumos gettext(1) (no EXIT STATUS section); Linux gettext(1) (no exit status text)

Everyday tasks

TaskSolnixLinuxNetBSD
translate a message from a text domaingettext textdomain msgidgettext textdomain msgidgettext textdomain msgid
translate a message, naming the domain with an optiongettext -d textdomain msgidgettext -d textdomain msgid—
translate several messages, echo-stylegettext -s msgid...gettext -s msgid...gettext -s msgid ...

Standards

Writing portable scripts

  • Pass the domain as the textdomain operand ('gettext domain msgid') and set TEXTDOMAINDIR. Every page documents the operand; -d is missing on NetBSD.
  • Do not use -e or -n in portable scripts: they behave differently with and without -s across the illumos, GNU and NetBSD pages.

Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.