Sign in

xgettext(1) on Solnix vs Linux and the BSDs

On Solnix, xgettext is the illumos xgettext at /usr/bin/xgettext, a small C-only tool with short options only. Linux and NetBSD ship GNU xgettext, with long options, -o, -k, -L and many languages; Solnix offers it in pkgs.solnix.gettext.

What Solnix runs

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

Differences

Compared withTopicWhat differs
Linux, NetBSDinput languagesSolnix xgettext extracts strings from ANSI C source only. Linux and NetBSD accept many languages through -L/--language, and guess the language from the file name extension by default.
Source: illumos xgettext(1) DESCRIPTION; Linux xgettext(1) -L; NetBSD xgettext(1) -L
Linux, NetBSD-k keyword option missingSolnix has no -k, so you cannot add keywords or drop the default ones. GNU xgettext -kWORD adds WORD as a keyword, and a bare -k disables the default keywords.
Source: illumos xgettext(1) SYNOPSIS; Linux xgettext(1) -k, --keyword; NetBSD xgettext(1) -k
Linux, NetBSDoutput file selectionSolnix has no -o and no output to standard output. The output is messages.po, renamed by -d, or domain.po for dgettext() calls. GNU -o names the file, and -o - writes to standard output.
Source: illumos xgettext(1) DESCRIPTION, -d; Linux xgettext(1) -o, Output file location; NetBSD xgettext(1) -o
Linux, NetBSD-D input search pathGNU xgettext on Linux and NetBSD has -D/--directory to add an input search directory. Solnix has no such option; its -p sets only the output directory.
Source: Linux xgettext(1) -D, --directory; NetBSD xgettext(1) -D, --directory; illumos xgettext(1) -p
Linux, NetBSD-c and -m/-M argument syntaxSolnix -c takes a separate comment-tag argument, and -m prefix and -M suffix take a required argument. GNU writes -cTAG, and -m[STRING] and -M[STRING] take an optional argument, defaulting to "".
Source: illumos xgettext(1) -c, -m, -M; Linux xgettext(1) -cTAG, -m[STRING]; NetBSD xgettext(1) -c, -m
Linux, NetBSD-n meaning and location defaultSolnix -n adds file and line comments, and none are written by default. In GNU xgettext, -n is --add-location, which is already the default, and --no-location turns it off. The comment formats also differ.
Source: illumos xgettext(1) -n; Linux xgettext(1) -n, --no-location; NetBSD xgettext(1) -n, --no-location
Linux, NetBSD-x with -a onlySolnix -x exclude-file can only be used with -a. The GNU pages place no such restriction on -x, --exclude-file in their text.
Source: illumos xgettext(1) -x; Linux xgettext(1) -x; NetBSD xgettext(1) -x
Linux, NetBSD-s sorting and duplicatesOn Solnix, -s sorts by msgid and removes duplicate msgids; without it, duplicates are written as comment lines. GNU -s is --sort-output and is marked deprecated on Linux. The GNU pages do not describe duplicate removal.
Source: illumos xgettext(1) DESCRIPTION, -s; Linux xgettext(1) -s; NetBSD xgettext(1) -s
Linux, NetBSDexisting output is overwrittenSolnix overwrites an existing .po file unless -j is given. With -j, new messages are appended and results are not guaranteed if the file was hand-edited. The GNU pages do not say what happens to an existing file without -j.
Source: illumos xgettext(1) DESCRIPTION, -j; Linux xgettext(1) -j; NetBSD xgettext(1) -j
Linux, NetBSDoptions missing on SolnixSolnix has none of these GNU options: -f/--files-from, -F, -w/--width, --no-wrap, --force-po, --omit-header and --from-code, which Linux and NetBSD document. Linux also has --package-name.
Source: illumos xgettext(1) SYNOPSIS, OPTIONS; Linux xgettext(1) Input file location, Input file interpretation, Output details, --package-name; NetBSD xgettext(1) Input file location, Input file interpretation, Output details
LinuxLinux-only optionsLinux has options absent from NetBSD and from the Solnix pkgs.solnix.gettext page: --no-check, --no-git, --generated, --reference and --tag. Linux also lists more languages, including Rust, Go and TypeScript.
Source: Linux xgettext(1) --no-check, --no-git, --generated, --reference, --tag, -L; NetBSD xgettext(1) -L; Solnix xgettext(1) from pkgs.solnix.gettext OPTIONS
Linux, NetBSDGNU versionsThe pkgs.solnix.gettext xgettext is GNU xgettext from gettext-tools 0.22.5. The Linux page documents gettext-1.0 and NetBSD gettext-tools 0.16.1, and their option sets differ by release.
Source: Solnix xgettext(1) from pkgs.solnix.gettext; Linux xgettext(1); NetBSD xgettext(1); illumos xgettext(1) SYNOPSIS

Everyday tasks

TaskSolnixLinuxNetBSD
extract translatable strings from source filesxgettext file...xgettext file...xgettext file...
extract all strings, not just gettext callsxgettext -a file...xgettext -a file...xgettext -a file...
add messages to an existing .po filexgettext -j file...xgettext -j file...xgettext -j file...

Standards

Writing portable scripts

  • For portable scripts, use only -a, -j, -d, -p and -x (with -a, as Solnix requires), giving each argument as a separate word. Avoid -n, -s, -m and -M: the illumos and GNU versions give them different meanings or argument syntax.
  • Do not rely on -o, -k, -L or long options; only GNU xgettext has them. The Solnix default writes messages.po in the current directory, or in the -p directory.

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.