DOKK / manpages / debian 11 / gettext / xgettext.1.en
XGETTEXT(1) User Commands XGETTEXT(1)

xgettext - extract gettext strings from source

xgettext [OPTION] [INPUTFILE]...

Extract translatable strings from given input files.

Mandatory arguments to long options are mandatory for short options too. Similarly for optional arguments.

input files
get list of input files from FILE
add DIRECTORY to list for input files search

If input file is -, standard input is read.

use NAME.po for output (instead of messages.po)
write output to specified file
output files will be placed in directory DIR

If output file is -, output is written to standard output.

recognise the specified language (C, C++, ObjectiveC, PO, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Smalltalk, Java, JavaProperties, C#, awk, YCP, Tcl, Perl, PHP, Ruby, GCC-source, NXStringTable, RST, RSJ, Glade, Lua, JavaScript, Vala, Desktop)
shorthand for --language=C++

By default the language is guessed depending on the input file name extension.

encoding of input files (except for Python, Tcl, Glade)

By default the input files are assumed to be in ASCII.

join messages with existing file
entries from FILE.po are not extracted
place comment blocks starting with TAG and preceding keyword lines in output file
place all comment blocks preceding keyword lines in output file
perform syntax check on messages (ellipsis-unicode, space-ellipsis,
quote-unicode, bullet-unicode)
type describing the end of sentence (single-space, which is the default,
or double-space)

extract all strings (only languages C, C++, ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Java, C#, awk, Tcl, Perl, PHP, GCC-source, Glade, Lua, JavaScript, Vala)
look for WORD as an additional keyword
do not to use default keywords (only languages C, C++, ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Java, C#, awk, Tcl, Perl, PHP, GCC-source, Glade, Lua, JavaScript, Vala, Desktop)
additional flag for strings inside the argument number ARG of keyword WORD
(only languages C, C++, ObjectiveC, Shell,
Python, Lisp, EmacsLisp, librep, Scheme, Java, C#, awk, YCP, Tcl, Perl, PHP, GCC-source, Lua, JavaScript, Vala)
understand ANSI C trigraphs for input (only languages C, C++, ObjectiveC)
apply ITS rules from FILE (only XML based languages)
recognize Qt format strings (only language C++)
recognize KDE 4 format strings (only language C++)
recognize Boost format strings (only language C++)
more detailed formatstring recognition result

use colors and other text attributes always
use colors and other text attributes if WHEN. WHEN may be 'always', 'never', 'auto', or 'html'.
specify CSS style rule file for --color
do not use C escapes in output (default)
use C escapes in output, no extended chars
write PO file even if empty
write the .po file using indented style
do not write '#: filename:line' lines
generate '#: filename:line' lines (default)
write out strict Uniforum conforming .po file
write out a Java .properties file
write out a NeXTstep/GNUstep .strings file
write out itstool comments
set output page width
do not break long message lines, longer than the output page width, into several lines
generate sorted output
sort output by file location
don't write header with 'msgid ""' entry
set copyright holder in output
omit FSF copyright in output for foreign user
set package name in output
set package version in output
set report address for msgid bugs
use STRING or "" as prefix for msgstr values
use STRING or "" as suffix for msgstr values

display this help and exit
output version information and exit
increase verbosity level

Written by Ulrich Drepper.

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

Copyright © 1995-2020 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.

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.

February 2021 GNU gettext-tools 0.21