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.
The manual pages
- Solnix: xgettext(1) from
pkgs.solnix.illumos-world-man; the default on Solnix · illumos.org - Solnix: xgettext(1) from
pkgs.solnix.gettext; add the package to get it - Linux: xgettext(1) gettext-1.0
- NetBSD: xgettext(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
xgettext
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 with | Topic | What differs |
|---|---|---|
| Linux, NetBSD | input languages | Solnix 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 missing | Solnix 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, NetBSD | output file selection | Solnix 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 path | GNU 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 syntax | Solnix -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 default | Solnix -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 only | Solnix -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 duplicates | On 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, NetBSD | existing output is overwritten | Solnix 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, NetBSD | options missing on Solnix | Solnix 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 |
| Linux | Linux-only options | Linux 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, NetBSD | GNU versions | The 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
| Task | Solnix | Linux | NetBSD |
|---|---|---|---|
| extract translatable strings from source files | xgettext file... | xgettext file... | xgettext file... |
| extract all strings, not just gettext calls | xgettext -a file... | xgettext -a file... | xgettext -a file... |
| add messages to an existing .po file | xgettext -j file... | xgettext -j file... | xgettext -j file... |
Standards
- POSIX: xgettext is a POSIX.1-2024 utility.
Writing portable scripts
- For portable scripts, use only
-a,-j,-d,-pand-x(with-a, as Solnix requires), giving each argument as a separate word. Avoid-n,-s,-mand-M: the illumos and GNU versions give them different meanings or argument syntax. - Do not rely on
-o,-k,-Lor long options; only GNU xgettext has them. The Solnix default writes messages.po in the current directory, or in the-pdirectory.
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.