cipp-l10n - do various l10n tasks with CIPP source files
cipp-l10n [COMMAND OPTIONS] [OPTIONS] [INPUTFILE]...
These options control the main operation mode of the program. Currently most of them are valid only in new.spirit mode and it's allowed to combined them. Only --xgettext doesn't require new.spirit mode.
Extract gettext messages from source files. Valid options are -o and -d. More input files may be given at the command line.
Creates CIPP textdomain config file. Valid only with --newspirit.
Update a .po file merging new messages from a .pot file into it. Valid only with --newspirit.
Compile a binary .mo file from a .po file. Valid options are -o. Valid only with --newspirit.
Execute all commands listed above in a row: --genconf --xgettext --updatepo --install. Valid only with --newspirit.
new.spirit mode. It's assumed that the directory passed with -d is a subdirectory of a new.spirit project root folder or the root folder itself.
With --genconf all directories in the new.spirit project are scanned for textdomain definitions and .-po files. A summary of this information is stored in the project's ROOT/prod/l10n/domains.conf file.
In --xgettext all source files are scanned for text messages and the corrsponding .pot files are saved as ROOT/tmp/l10n/DOMAIN.pot.
If the -d directory is a new.spirit project subdirectory, --xgettext will extract messages only from the textdomain this subdirectory belongs to. As well --genconf is disabled automatically (if set), because generating a config file with a subset of the project's domains wouldn't make sende.
In --updatepo mode all po files are merged with the .pot files generated during a prior --xgettext run.
In --msgfmt mode all .po files are compiled to .mo format and installed as ROOT/prod/l10n/LANG/LC_MESSAGES/DOMAIN.mo.
Write output to the specified file. Invalid in --newspirit mode.
Search for CIPP source files in this directory. Only valid with --xgettext or --newspirit.
Print progress information to STDERR.
Print a brief help message.
Show the full manpage.
cipp-xgettext extracts gettext strings from CIPP sources and generates a corresponding .po file for them.
This section shows some typical examples of cipp-l10n usage:
This command extracts all messages from a new.spirit project and generates a .pot file for each textdomain. Additionally the prod/l10n/domains.conf file is created:
% cd some/newspirit/project/root % cipp-l10n -v -n -d . --xgettext --genconf
This command updates all .po files for the textdomain of the custom/ subdirectory in a new.spirit project:
% cd some/newspirit/project/root % cd src/custom % cipp-l10n -v -n -d . --updatepo
This presumes that a domains.conf file exists already, otherwise you would have to do a --geconf run first.
This command runs msgfmt for all textdomains resp .po files in a new.spirit directory and installs the resulting .mo files in the prod/l10n/ directory:
% cd some/newspirit/project/root % cipp-l10n -v -n -d . --install
This executes all tasks: message extraction / .pot file generation, domains.conf generation, .po updating and .mo installation:
% cd some/newspirit/project/root % cipp-l10n -v -n -d . --all
This command is for non new.spirit projects and just extracts messages from CIPP sources and generates a corresponding .pot file:
% cipp-l10n -v -d some/cipp/src --xgettext --output some.pot