XGETTEXT-PERL(1)
π NAME π
okay so bestie, <rainbow>xgettext-perl</rainbow> is the little icon that extracts translatable strings β¨ like it goes through your code and pulls out every string that needs translating, no cap π
πΈ SYNOPSIS πΈ
xgettext-perl [GENERIC OPTIONS][SCRIPT OPTIONS] directories
xgettext-perl [GENERIC OPTIONS][TEMPLATE OPTIONS] directories
GENERIC OPTIONS
--config -c %config domain configuration
--files-from -f $filename source of filenames to be processed
--from-code $charset used by input files (auto-detects)
--no-cleanup keep unprocessed files in po table
--output-dir -p $directory location of lexicons (required)
--to-code $charset charset of po files (default utf-8)
--version -V show version of this script
--verbose=3 -v -vv -vvv debug mode
TEMPLATE OPTIONS
--domain -d $domain domain to be used
--template -t $notation how to recognize the strings to be taken
--files-match -m $regex filter filenames, default .tt and .tt2
SCRIPT OPTIONS
--language -L $proglang programming language syntax (now only perl)
--files-match -m $regex filter filenames, default .pm and .pl
so like, run it one of two ways depending on what you're chewing through π¦ β either <pink>SCRIPT OPTIONS</pink> for actual program code, or <purple>TEMPLATE OPTIONS</purple> for templates.
π the generic options, decoded π
--config,-c %configβ domain configuration π--files-from,-f $filenameβ source of filenames to be processed π--from-code,$charsetβ used by input files (auto-detects) π--no-cleanupβ keep unprocessed files in po table π§Ί--output-dir,-p $directoryβ location of lexicons (required, fr fr, don't skip this one) π--to-code,$charsetβ charset of po files (defaultutf-8) π--version,-Vβ show version of this script β--verbose=3,-v,-vv,-vvvβ debug mode π
π§ template options π§
--domain,-d $domainβ domain to be used πΈ--template,-t $notationβ how to recognize the strings to be taken π--files-match,-m $regexβ filter filenames, default.ttand.tt2π
π script options π
--language,-L $proglangβ programming language syntax (now onlyperl) π--files-match,-m $regexβ filter filenames, default.pmand.plβ¨
π DESCRIPTION π
This script will maintain PO-files: translation files π On the moment, the number of syntaxes is quite limited (see below) π There is no restrain on syntaxes which can be supported: there just was no practical use to implement it yet. like, the door is open, nobody's walked through it yet, it's giving potential π¦
π§ Complex options π§
β¨ --config %config β¨
Log::Report translations supports complex additional features, like context sensitive translations, which require a configuration file π See Log::Report::Context π
Say, your scripts and templates use textdomain name-spaces <pink>domain1</pink> and <purple>domain2</purple> (please use better names π bestie those are placeholder names), then you can pass their respective configuration files as:
--config domain1=filename domain2=filename # or
--config domain1=filename --config domain2=filename
two ways, same energy, pick your fighter π
π₯ --cleanup --no-cleanup π₯
You should scan all script or template files in one go, because PO records from files which are not mentioned will get removed π¨ That's the clean-up. However, when you need more scans for a full update, you need to use this option. This also implies possible polution of your translation tables π¬
so basically: --no-cleanup is the "I'm not done yet, don't throw my stuff away" button, but it comes with polution of your translation tables, which is lowkey the tradeoff, and that's on periodt π
π Extracting from Perl with Log::Report syntax π
When no --template notation is given, the provided file-names are expected to contain program text π Only Perl5 programs using the Log::Report msgid notation (with leading __ to mean gettext) π
π¦ Extracting from Template::Toolkit π¦
See Log::Report::Template::Extract πΈ (go read that one, it's got the tea for templates)
and that's the whole vibe, bestie π stay iconic, ship your translations, and remember: this page came from User Contributed Perl Documentation, perl v5.42.0, dated 2026-01-17 π mwah π
β¨
π¦ where this page comes from
- fedora 44: perl-Log-Report-Lexicon 1.15-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms