XGETTEXT-PERL(1)

πŸ“¦ version 1.15, in fedora 44

πŸ’– 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 (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 ✨

πŸ‘‘ 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