XGETTEXT(1)
π xgettext.pl β bestie, it's the man page π
okay so this is xgettext.pl, and it lives in the User Contributed Perl Documentation section of your man pages. we're gonna go through the whole thing together, no skips, no skimming, we eat every option. π
β¨ NAME β¨
xgettext.pl β extract translatable strings from source. that's it, that's the whole job, and it does it beautifully. π
πΈ VERSION πΈ
version 1.00 β¨
π¦ SYNOPSIS π¦
xgettext.pl [OPTION] [INPUTFILE]...
that's the vibe. options, then files. periodt. π
π DESCRIPTION π
so this program extracts translatable strings from the input files you give it. and if you give it none? it just reads from STDIN instead. no big deal, it's flexible like that. π
also bestie, if you wanna know which input file formats are even supported, go read Locale::Maketext::Extract β that's where the list lives. π«Ά
β¨ OPTIONS β¨
heads up before we dive in: mandatory arguments to long options are mandatory for short options too. and same energy for optional arguments β optional stays optional on both. iykyk. π
ποΈ Input file location
INPUTFILE...β the files you want messages extracted from. if you don't name any,STDINgets the job. π-f,--files-from=FILEβ get your list of input files fromFILEinstead of typing them all out like a peasant. π-D,--directory=DIRECTORYβ addDIRECTORYto the list of places it searches for input files. π
π Input file format
-u,--use-gettext-styleβ tells it that your source code uses the Gettext style (like%1) in its localization calls instead of the Maketext style (like"[_1]"). pick your fighter, bestie. π
π Output file location
-d,--default-domain=NAMEβ useNAME.poas the output file instead of"messages.po". cute name, cute file. π-o,--output=FILEβ the PO file name to be written or incrementally updated. and if you pass"-"? it writes toSTDOUTinstead. iconic behavior honestly. π-p,--output-dir=DIRβ output files get placed in directoryDIR. put them away, put them away. π§Ί
π Output details
-g,--gnu-gettextβ enables GNU gettext interoperability by printing#, perl-maketext-formatbefore each entry that has"%"variables. look at it being a good neighbor. π€-W,--wrapβ when wrap is enabled, entries with multiple file locations list each location on its own separate line. default behavior is to cram them all onto a single line. other comments are not affected by this, fyi. π
π Plugins
okay so by default, all builtin parser plugins are enabled for all file types, and warnings are turned off. comfy.
but the second you specify any plugin on the command line, warnings flip to on by default β and you can turn them back off with "-now". the way it just switches up on you π
-P|--plugin pluginnameβ use the specified plugin for the default file types that plugin recognises.-P|--plugin 'pluginname=*'β use the specified plugin for all file types.-P|--plugin pluginname=ext,ext2β use the specified plugin for any files ending inC<.ext>orC<.ext2>-P|--plugin My::Module::Name='*'β use your custom plugin module for all file types. main character energy, we love a custom module. π
multiple plugins can be specified on the command line, so stack them, bestie. π₯
π« Available plugins:
"perl":Locale::Maketext::Extract::Plugin::Perl
for a slightly more accurate but much slower Perl parser, you can use the PPI plugin. it does not have a short name, so you have to specify it in full, eg:
xgettext.pl -P Locale::Maketext::Extract::Plugin::PPI
"tt2":Locale::Maketext::Extract::Plugin::TT2"yaml":Locale::Maketext::Extract::Plugin::YAML"formfu":Locale::Maketext::Extract::Plugin::FormFu"mason":Locale::Maketext::Extract::Plugin::Mason"text":Locale::Maketext::Extract::Plugin::TextTemplate"generic":Locale::Maketext::Extract::Plugin::Generic
β οΈ Warnings
if a parser plugin hits a syntax error while parsing, it will abort parsing and hand over to the next parser plugin. and if warnings are turned on, that error gets echoed to STDERR. π
off by default β unless any plugin has been specified on the command line. sneaky but fair.
-w|--warnings-now|--nowarnings
π£οΈ Verbose
if you'd like to see which files have been processed, which plugins were used, and which strings were extracted, then enable "verbose". and note: if no acceptable plugin was found, or no strings were extracted, then that file is not listed. rude but honest. π
-v|--verboseβ lists processed files.-v -v|--verbose --verbose :β lists processed files and which plugins managed to extract strings.-v -v|--verbose --verbose :β lists processed files, which plugins managed to extract strings, and the extracted strings, the line where they were found, and any variables. maximum tea, we're getting everything ββ¨
π SEE ALSO π
Locale::Maketext::ExtractLocale::Maketext::Lexicon::GettextLocale::MaketextLocale::Maketext::Extract::Plugin::PerlLocale::Maketext::Extract::Plugin::PPILocale::Maketext::Extract::Plugin::TT2Locale::Maketext::Extract::Plugin::YAMLLocale::Maketext::Extract::Plugin::FormFuLocale::Maketext::Extract::Plugin::MasonLocale::Maketext::Extract::Plugin::TextTemplateLocale::Maketext::Extract::Plugin::Generic
go read them, bestie, they're all in the family π«Ά
π AUTHORS π
Audrey Tang <cpan@audreyt.org> π
π COPYRIGHT π
Copyright 2002-2008 by Audrey Tang <cpan@audreyt.org>.
This software is released under the MIT license cited below.
π§Ύ The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
π AUTHORS π
- Clinton Gormley
<drtech@cpan.org> - Audrey Tang
<cpan@audreyt.org>
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2014 by Audrey Tang.
This is free software, licensed under:
The MIT (X11) License
and that's the whole page, bestie!! π written for perl v5.42.0 and dated 2025-07-25 β yeah, that's the version and the date, and this page is literally called XGETTEXT(1), we've been through all of it together. slay. π
β¨π¦
π¦ where this page comes from
- fedora 43: perl-Locale-Maketext-Lexicon 1.00-36.fc43 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms