The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

xgettext-perl - extract translatable strings

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 (default utf-8)
--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 .pm and .pl

SCRIPT OPTIONS
--language    -L $proglang  programming language syntax (now only perl)
--files-match -m $regex     filter filenames, default .tt and .tt2

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.

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 domain1 and domain2 (plase use better names), then you can pass their respective configuration files as:

--config domain1=filename domain2=filename    # or
--config domain1=filename --config domain2=filename
--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.

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::Extract::Template