po - GNU PO file manager
po [ --debug|--nodebug, --verbose|--noverbose, -v, --help, --man] Options Basic options: --add Add an msgsid/msgstr entry in the po file --as-po Write the file as a po file --as-json Write the po file as json on the STDOUT --compile Create a machine object file (.mo) --domain The po file domain --dump Dump the PO file in a format suitable for a .po file --init Create an initial po file such as .pot --sync Synchronise a GNU PO file with another one --bugs-to Sets the value for the meta field C<Report-Msgid-Bugs-To> --charset Sets the character encoding value in C<Content-Type> --created-on Sets the value for the meta field C<POT-Creation-Date> --domain The domain, such as C<com.example.api> --encoding Sets the value for the meta field C<Content-Transfer-Encoding> --header The string to be used as the header for the C<.po> file only. --lang The locale to use, such as en_US --msgid The C<msgid> to add --msgstr The localised text to add for the given C<msgid> --output The output file --output-dir Output directory --overwrite Boolean. If true, this will allow overwriting existing file --po-debug Integer representing the debug value to be passed to L<Text::PO> --pot The C<.pot> file to be used as a template in conjonction with --init --project Sets the value for the meta field C<Project-Id-Version> --revised-on Sets the value for the meta field C<PO-Revision-Date> --settings The settings json file containing default values --team Sets the value for the meta field C<Language-Team> --translator Sets the value for the meta field C<Last-Translator> --tz, --time-zone, --timezone Sets the time zone to use for the date in C<PO-Revision-Date> and C<POT-Creation-Date> --version Sets the version to be used in the meta field C<Project-Id-Version> Standard options: -h, --help display this help and exit -v display version information and exit --debug Enable debug mode --nodebug Disable debug mode --help, -? Show this help --man Show this help as a man page --verbose Enable verbose mode --noverbose Disable verbose mode
v0.2.0
Adds an msgid and msgstr pair to the po file
msgid
msgstr
po --add --msgid "Hello!" --msgstr "Salut !" --output fr_FR/LC_MESSAGES/com.example.api.po
Takes a po file and transcode it as a json po file
po --as-json --output fr_FR/LC_MESSAGES/com.example.api.json fr_FR.po
Takes a .mo or .json file and transcode it to a po file
.mo
.json
po --as-po --output fr_FR.po ./fr_FR/com.example.api.json
The string to be used for the PO file header field Bugs-To
Bugs-To
The PO file character set. This should be utf-8
utf-8
Takes a po file and compiles it into a binary file wth extension mo
mo
po --compile ./fr_FR/com.example.api.json # Will create ./fr_FR/com.example.api.mo
The PO file creation date. This can be an ISO 8601 date, or a unix timestamp, or even a relative date such as +1D. See "_set_get_datetime" in Module::Generic for more information
+1D
The PO file domain
po --init --domain com.example.api ./fr_FR/com.example.api.po
Dump the data contained as a GNU PO file to the STDOUT
po --dump /some/file.po >new_file.po # Maybe? diff /some/file.po new_file.po
The PO file encoding. This defaults to 8bit. There is no reason to change this.
8bit
The PO file meta information header
Init a new PO file
po --init --domain com.example.api --lang fr_FR ./fr_FR/com.example.api.po # then you can convert it as a json file po --as-json --output ./fr_FR/com.example.api.json ./fr_FR/com.example.api.po
The PO file locale language
po --init --domain com.example.api --lang fr_FR ./fr_FR/com.example.api.po
The localised string original text.
The localised string
The output directory. For example to read multiple po file and create their related mo files under a given directory:
po --compile --output-dir ./en_GB/LC_MESSAGES en_GB.*.po
This will read all the po files for language en_GB as selected in write their related mo files under ./en_GB/LC_MESSAGES. This directory will be created if it does not exist. The domain will be derived from the po file.
./en_GB/LC_MESSAGES
Boolean. If true, this will allow overwriting existing PO file. Default is false
An integer value to set the level of debugging. Default is o (no debugging enabled)
The PO template file to use
The PO file project name
The PO file revision date. This can be an ISO 8601 date, or a unix timestamp, or even a relative date such as +1D. See "_set_get_datetime" in Module::Generic for more information
The file path to the settings.json json file containing all the default values
settings.json
This is convenient to set various default values rather than specifying each of of them as option
po --init --settings /some/where/settings.json --domain com.example.api --lang fr_FR ./fr_FR/com.example.api.po
Synchronise a PO file based on another (the source), adding any missing msgid and msgstr resources it finds in the source file.
For example, to synchronise a Japanese PO file based on its English equivalent:
po --sync --output ./locale/ja_JP/LC_MESSAGES/com.example.api.json ./locale/en_GB/LC_MESSAGES/com.example.api.json
The team in charge of this PO file maintenance
The PO file Translator field containing the name of the person or group in charge of the translation for this file.
Translator
The time zone to use in the PO file meta information header
Displays this utility version number and quits.
Print a short help message.
Enable debug mode with considerable verbosity
Disable debug mode.
Enable verbose mode.
Disable verbose mode.
Print this help as man page.
This program takes optional parameters and process GNU PO files.
GNU PO files are localisation or l10n files. They can be used as binary after been compiled, or they can be converted to json using this utility which then can read the json data instead of parsing the po files, making it faster to load.
po [--dump, --debug|--nodebug, --verbose|--noverbose, -v, --help, --man] /some/file.po
Jacques Deguest <jack@deguest.jp>
Copyright (c) 2020-2021 DEGUEST Pte. Ltd.
To install Text::PO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::PO
CPAN shell
perl -MCPAN -e shell install Text::PO
For more information on module installation, please visit the detailed CPAN module installation guide.