gettext(1) on Solnix vs Linux and the BSDs

A default Solnix system runs the illumos gettext at /usr/bin/gettext, which supports only -d/--domain, -e, -n and -s. The published pkgs.solnix.gettext page documents GNU gettext-runtime 0.22.5, which adds -c, -E, -h and -V. Scripts written for GNU gettext can fail on the default command.

What Solnix runs

The published page (package pkgs.solnix.gettext) is GNU gettext-runtime 0.22.5, but the command on PATH is the illumos /usr/bin/gettext. No other illumos variants are shipped. The two differ in options, catalog location and escape handling, so check which gettext your PATH finds. The bundle does not say where the GNU binary is installed. The GNU page's standard search directory is a /nix/store/.../share/locale path.

Differences

Compared withTopicWhat differs
Linuxsame program as published pageThe published Solnix page is GNU gettext-runtime 0.22.5 and the Linux page is GNU gettext-runtime 1.0. Their option lists are identical. The only text difference in the bundle is the version and the compiled-in search directory. The default Solnix command is not this program.
Source: Solnix gettext(1) (GNU gettext-runtime 0.22.5) vs Linux gettext(1) (GNU gettext-runtime 1.0), DESCRIPTION
Linux-c, -E, -h, -V and --context missing on default commandThe illumos /usr/bin/gettext documents only -d/--domain, -e, -n and -s. It has no -c/--context, -E, -h/--help or -V/--version. A Linux script that passes a context with -c, or calls gettext --version, may fail on the default Solnix command.
Source: illumos gettext(1) SYNOPSIS and OPTIONS; Linux gettext(1) -c, -E, -h, -V
Linux-e and -n only with -sillumos says -e and -n apply only 'if used with the -s option'. The GNU page lists both without that condition.
Source: illumos gettext(1) OPTIONS -e, -n; Linux gettext(1) -e, -n
Linuxescape sequence handlingillumos gettext interprets C escapes such as \t in msgid by default, and with -s does no expansion unless -e is given. The GNU page says only that -e enables expansion of some escape sequences.
Source: illumos gettext(1) DESCRIPTION, OPTIONS -s and -e; Linux gettext(1) -e
Linux, NetBSDtextdomain operand vs -dOn illumos, a textdomain operand overrides -d/--domain if both are given. The Linux and NetBSD pages do not state a precedence. NetBSD has no -d option at all.
Source: illumos gettext(1) OPERANDS textdomain; Linux gettext(1) -d; NetBSD gettext(1) SYNOPSIS and flags
Linux, NetBSDcatalog locationillumos looks in /usr/lib/locale/lang/LC_MESSAGES, and TEXTDOMAINDIR replaces the path up to lang. NetBSD looks in /usr/share/locale, which TEXTDOMAINDIR overrides. The GNU page gives a /nix/store/.../share/locale directory.
Source: illumos gettext(1) DESCRIPTION and TEXTDOMAINDIR; NetBSD gettext(1) DESCRIPTION; Linux gettext(1) 'Standard search directory'
NetBSDlong options and -cNetBSD gettext takes only -e, -h, -n and -s. It has no --domain, --context, --help, --version, -d, -c, -E or -V. Scripts using the long forms fail there.
Source: NetBSD gettext(1) SYNOPSIS and flags
NetBSD-e semanticsNetBSD -e interprets backslash escapes before translation, and its page does not say escapes are expanded otherwise. illumos interprets C escapes by default without -s and uses -e only with -s.
Source: NetBSD gettext(1) -e; illumos gettext(1) DESCRIPTION and -e
NetBSD-s and -n usageNetBSD synopsis allows -s with no msgid, and -n does nothing without -s. illumos documents -s with msgid... and applies -n only with -s. All three pages say -s acts like echo(1) with translation.
Source: NetBSD gettext(1) SYNOPSIS and -n; illumos gettext(1) SYNOPSIS and -n
Linux, NetBSDmissing translation and exit statusillumos and NetBSD print msgid unchanged when no catalog or string is found. NetBSD documents exit 0 on success and >0 on error. The illumos and GNU pages have no exit status section.
Source: illumos gettext(1) DESCRIPTION; NetBSD gettext(1) DESCRIPTION, EXIT STATUS; Linux gettext(1)
Linux, NetBSDenvironment variablesillumos documents LANG, LC_MESSAGES, TEXTDOMAIN and TEXTDOMAINDIR. NetBSD documents only TEXTDOMAIN and TEXTDOMAINDIR. The GNU page mentions TEXTDOMAIN and TEXTDOMAINDIR in its text.
Source: illumos gettext(1) ENVIRONMENT VARIABLES; NetBSD gettext(1) ENVIRONMENT; Linux gettext(1) DESCRIPTION

Standards

  • POSIX: gettext is a POSIX.1-2024 utility.
  • Solnix: The illumos page's SEE ALSO references attributes(7), but the bundle shows no interface stability table. No standards section appears in the Linux, NetBSD or GNU pages in the bundle.

Writing portable scripts

  • Stick to the common subset: gettext -s [-n] [-e] and the TEXTDOMAIN and TEXTDOMAINDIR environment variables. Avoid -c, -E, -V and the long options, and do not use -d on NetBSD.
  • Do not rely on -e or backslash escapes in msgid. Escape handling differs between illumos, GNU and NetBSD. Put newlines in with printf(1) instead.

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.