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 fromFILE-D,--directory=DIRECTORYโ addDIRECTORYto 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โ useNAME.pofor output (instead ofmessages.po)-o,--output=FILEโ write output to specified file-p,--output-dir=DIRโ output files will be placed in directoryDIR
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 forPython,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 fromFILE.poare not extracted-cTAG,--add-comments=TAGโ place comment blocks starting withTAGand 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, ordouble-space)
๐ Language specific options
-a,--extract-allโ extract all strings (only languagesC,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 forWORDas an additional keyword-k,--keywordโ do not to use default keywords (only languagesC,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 numberARGof keywordWORD(only languagesC,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 tagWORD(only languageJavaScript)-T,--trigraphsโ understand ANSI C trigraphs for input (deprecated; only languagesC,C++,ObjectiveC)
โ ๏ธ heads up bestie:-T/--trigraphsis deprecated. it still exists, but likeโฆ it's giving vintage. use with awareness ๐
--its=FILEโ apply ITS rules fromFILE(only XML based languages)--qtโ recognize Qt format strings (only languageC++)--kdeโ recognize KDE 4 format strings (only languageC++)--boostโ recognize Boost format strings (only languageC++)--debugโ more detailed formatstring recognition result
๐จ Output details
--colorโ use colors and other text attributes always ๐--color=WHENโ use colors and other text attributes ifWHEN.WHENmay 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.pofile 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.pofile--properties-outputโ write out a Java.propertiesfile--stringtable-outputโ write out a NeXTstep/GNUstep.stringsfile--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 givenFILEis 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 givenFILE. This has an influence on the'POT-Creation-Date'field in the output.-m[STRING],--msgstr-prefix[=STRING]โ useSTRINGor""as prefix for msgstr values-M[STRING],--msgstr-suffix[=STRING]โ useSTRINGor""as suffix for msgstr values
โ ๏ธ also flagging:-s/--sort-outputis 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 ๐
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
- alpine 3.24: gettext-doc 1.0-r0 ยท GPL-3.0-or-later AND LGPL-2.1-or-later AND MIT
- arch rolling: gettext 1.0-2 ยท GFDL-1.2-only AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.0-only
- nixos 26.05: gettext 1.0
- nixpkgs unstable: gettext 1.0
- ubuntu stonking: gettext 1.0-3 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms