XGETTEXT(1)

๐Ÿ‘‘ XGETTEXT(1) โ€” the Unix manual page bestie, rewritten ๐Ÿ’…

okay so. this is the manual page for xgettext, a User Command from the GNU gettext-tools fam. sit down, grab a boba, we're extracting translatable strings and we're gonna slay while doing it ๐Ÿงšโœจ


โœจ NAME โœจ

xgettext โ€” extract gettext strings from source ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

xgettext [OPTION] [INPUTFILE]...

๐Ÿ’– DESCRIPTION ๐Ÿ’–

Extract translatable strings from given input files. that's the whole vibe. it goes in, it finds the strings that need translating, it comes out. iconic behavior fr fr ๐Ÿ’…

Mandatory arguments to long options are mandatory for short options too. Similarly for optional arguments. (yes bestie, the rules apply both ways, no cap.)

๐Ÿ“ Input file location

  • INPUTFILE ... โ€” input files ๐Ÿ“
  • -f, --files-from=FILE โ€” get list of input files from FILE
  • -D, --directory=DIRECTORY โ€” add DIRECTORY to list for input files search

If input file is -, standard input is read. (yes, the little dash means "read from stdin", it's giving classic Unix ๐Ÿ’€)

๐Ÿ“ Output file location

  • -d, --default-domain=NAME โ€” use NAME.po for output (instead of messages.po)
  • -o, --output=FILE โ€” write output to specified file
  • -p, --output-dir=DIR โ€” output files will be placed in directory DIR

If output file is -, output is written to standard output. ๐ŸŒˆ

๐Ÿ—ฃ๏ธ Choice of input file language

  • -L, --language=NAME โ€” recognise the specified language: C, C++, ObjectiveC, PO, Python, Java, JavaProperties, C#, JavaScript, TypeScript, TSX, Scheme, Guile, Lisp, EmacsLisp, librep, Rust, Go, Ruby, Shell, awk, Lua, Modula-2, D, OCaml, Smalltalk, Vala, Tcl, Perl, PHP, GCC-source, YCP, NXStringTable, RST, RSJ, Glade, GSettings, Desktop ๐Ÿ‘‘
  • -C, --c++ โ€” shorthand for --language=C++

By default the language is guessed depending on the input file name extension. she's a detective, she figures it out herself ๐Ÿ”

๐Ÿ” Input file interpretation

  • --from-code=NAME โ€” encoding of input files (except for Python, Tcl, Glade)

By default the input files are assumed to be in ASCII. so if you're out here with fancy unicode, speak up and set the encoding bestie ๐Ÿ˜ญ

๐ŸŽ€ Operation mode

  • -j, --join-existing โ€” join messages with existing file
  • -x, --exclude-file=FILE.po โ€” entries from FILE.po are not extracted
  • -cTAG, --add-comments=TAG โ€” place comment blocks starting with TAG and preceding keyword lines in output file
  • -c, --add-comments โ€” place all comment blocks preceding keyword lines in output file
  • --check=NAME โ€” perform syntax check on messages (ellipsis-unicode, space-ellipsis, quote-unicode, bullet-unicode)
  • --no-check=NAME โ€” don't perform syntax check on messages (url, email)
  • --sentence-end=TYPE โ€” type describing the end of sentence (single-space, which is the default, or double-space)

๐ŸŒ Language specific options

  • -a, --extract-all โ€” extract all strings (only languages C, C++, ObjectiveC, Python, Java, C#, JavaScript, TypeScript, TSX, Scheme, Guile, Lisp, EmacsLisp, librep, Rust, Go, Shell, awk, Lua, Modula-2, D, OCaml, Vala, Tcl, Perl, PHP, GCC-source, Glade, GSettings)
  • -kWORD, --keyword=WORD โ€” look for WORD as an additional keyword
  • -k, --keyword โ€” do not to use default keywords (only languages C, C++, ObjectiveC, Python, Java, C#, JavaScript, TypeScript, TSX, Scheme, Guile, Lisp, EmacsLisp, librep, Rust, Go, Shell, awk, Lua, Modula-2, D, OCaml, Vala, Tcl, Perl, PHP, GCC-source, Glade, GSettings, Desktop)
  • --flag=WORD:ARG:FLAG โ€” additional flag for strings inside the argument number ARG of keyword WORD (only languages C, C++, ObjectiveC, Python, Java, C#, JavaScript, TypeScript, TSX, Scheme, Guile, Lisp, EmacsLisp, librep, Rust, Go, Shell, awk, Lua, Modula-2, D, OCaml, Vala, Tcl, Perl, PHP, GCC-source, YCP)
  • --tag=WORD:FORMAT โ€” defines the behaviour of tagged template literals with tag WORD (only language JavaScript)
  • -T, --trigraphs โ€” understand ANSI C trigraphs for input (deprecated; only languages C, C++, ObjectiveC)
โš ๏ธ heads up bestie: -T / --trigraphs is deprecated. it still exists, but likeโ€ฆ it's giving vintage. use with awareness ๐Ÿ’€
  • --its=FILE โ€” apply ITS rules from FILE (only XML based languages)
  • --qt โ€” recognize Qt format strings (only language C++)
  • --kde โ€” recognize KDE 4 format strings (only language C++)
  • --boost โ€” recognize Boost format strings (only language C++)
  • --debug โ€” more detailed formatstring recognition result

๐ŸŽจ Output details

  • --color โ€” use colors and other text attributes always ๐ŸŒˆ
  • --color=WHEN โ€” use colors and other text attributes if WHEN. WHEN may be 'always', 'never', 'auto', or 'html'.
  • --style=STYLEFILE โ€” specify CSS style rule file for --color
  • -e, --no-escape โ€” do not use C escapes in output (default)
  • -E, --escape โ€” use C escapes in output, no extended chars
  • --force-po โ€” write PO file even if empty
  • -i, --indent โ€” write the .po file using indented style
  • --no-location โ€” do not write '#: filename:line' lines
  • -n, --add-location โ€” generate '#: filename:line' lines (default)
  • --strict โ€” write out strict Uniforum conforming .po file
  • --properties-output โ€” write out a Java .properties file
  • --stringtable-output โ€” write out a NeXTstep/GNUstep .strings file
  • --itstool โ€” write out itstool comments
  • -w, --width=NUMBER โ€” set output page width
  • --no-wrap โ€” do not break long message lines, longer than the output page width, into several lines
  • -s, --sort-output โ€” generate sorted output (deprecated)
  • -F, --sort-by-file โ€” sort output by file location
  • --omit-header โ€” don't write header with 'msgid ""' entry
  • --no-git โ€” don't use the git program to produce a reproducible 'POT-Creation-Date' field in the output.
  • --copyright-holder=STRING โ€” set copyright holder in output
  • --foreign-user โ€” omit FSF copyright in output for foreign user
  • --package-name=PACKAGE โ€” set package name in output
  • --package-version=VERSION โ€” set package version in output
  • --msgid-bugs-address=EMAIL@ADDRESS โ€” set report address for msgid bugs
  • --generated=FILE โ€” Declares that the given FILE is generated and therefore should not have an influence on the 'POT-Creation-Date' field in the output.
  • --reference=FILE โ€” Declares that the output depends on the contents of the given FILE. This has an influence on the 'POT-Creation-Date' field in the output.
  • -m[STRING], --msgstr-prefix[=STRING] โ€” use STRING or "" as prefix for msgstr values
  • -M[STRING], --msgstr-suffix[=STRING] โ€” use STRING or "" as suffix for msgstr values
โš ๏ธ also flagging: -s / --sort-output is deprecated. it's giving "we don't do that anymore but the option is still here for the old heads".

๐Ÿ’ฌ Informative output

  • -h, --help โ€” display this help and exit
  • -V, --version โ€” output version information and exit
  • -v, --verbose โ€” increase verbosity level

๐Ÿซถ AUTHOR ๐Ÿซถ

Written by Ulrich Drepper and Bruno Haible. absolute legends, we love them, no cap ๐Ÿ’œ


๐Ÿ› REPORTING BUGS ๐Ÿ›

Report bugs in the bug tracker at <https://savannah.gnu.org/projects/gettext> or by email to <bug-gettext@gnu.org>.

(found a bug? don't suffer in silence bestie, tell them, they want to know ๐Ÿ˜ญ)


Copyright ยฉ 1995-2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

๐Ÿšจ real talk: there is NO WARRANTY, to the extent permitted by law. that part is not a vibe, it's the actual legal situation. periodt.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

The full documentation for xgettext is maintained as a Texinfo manual. If the info and xgettext programs are properly installed at your site, the command

info xgettext

should give you access to the complete manual. go read it, it's giving โœจ encyclopedic โœจ


and that's the whole page bestie!! this was GNU gettext-tools 1.0, from January 2026, and yeah โ€” that's the XGETTEXT(1) manual page, User Commands section, fully delivered with love ๐ŸŽ€๐Ÿ’– slay, go extract some strings ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from