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.
The manual pages
- Solnix: gettext(1) from
pkgs.solnix.illumos-world-man; the default on Solnix · illumos.org - Solnix: gettext(1) from
pkgs.solnix.gettext; add the package to get it - Linux: gettext(1) gettext-1.0
- NetBSD: gettext(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
gettext
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 with | Topic | What differs |
|---|---|---|
| Linux | same program as the alternative | The 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 context | GNU 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, -V | The 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 textdomain | The 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, NetBSD | default catalog directory | The 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, NetBSD | TEXTDOMAINDIR scope | On 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 |
| NetBSD | locale variables | The 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, NetBSD | escape handling and -e | The 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 |
| Linux | textdomain operand vs -d | The 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, NetBSD | exit status | NetBSD 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
| Task | Solnix | Linux | NetBSD |
|---|---|---|---|
| translate a message from a text domain | gettext textdomain msgid | gettext textdomain msgid | gettext textdomain msgid |
| translate a message, naming the domain with an option | gettext -d textdomain msgid | gettext -d textdomain msgid | — |
| translate several messages, echo-style | gettext -s msgid... | gettext -s msgid... | gettext -s msgid ... |
Standards
- POSIX: gettext is a POSIX.1-2024 utility.
Writing portable scripts
- Pass the domain as the textdomain operand ('gettext domain msgid') and set TEXTDOMAINDIR. Every page documents the operand;
-dis missing on NetBSD. - Do not use
-eor-nin portable scripts: they behave differently with and without-sacross 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.