Convert translatable items in Markdown text to the PO format. Insert translated text into Markdown templates.
md2po [options] <md-src> <po>
po2md [options] -i <po> -t <md-src> -o <md-dest>
Where:
<md-src> |
is a Markdown file or a directory of Markdown files, source language |
<md-dest> |
is a Markdown file or a directory of Markdown files, translated to the target language |
<po> |
is a PO file or directory of PO files |
Options (md2po):
show program’s version number and exit
show this help message and exit
output a manpage based on the help
show progress as: dots, none, bar, names, verbose
show errorlevel as: none, message, exception, traceback
read from INPUT in Markdown format
exclude names matching EXCLUDE from input paths
write to OUTPUT in po, pot formats
skip conversion if the output file has newer timestamp
output PO Templates (.pot) rather than PO files (.po)
what to do with duplicate strings (identical source text): merge, msgctxt (default: ‘msgctxt’)
how to split po/pot files (single, toplevel or onefile) (default: ‘single’; if set to ‘onefile’, a single po/pot file will be written. ‘toplevel’ not used.)
Options (po2md):
show program’s version number and exit
show this help message and exit
output a manpage based on the help
show progress as: dots, none, bar, names, verbose
show errorlevel as: none, message, exception, traceback
read from INPUT in po, pot formats
exclude names matching EXCLUDE from input paths
write to OUTPUT in Markdown format
read from TEMPLATE in Markdown format
skip conversion if the output file has newer timestamp
reflow (word wrap) the output to the given maximum line length. set to 0 to disable
only convert files where the translation completion is above PERCENT
use translations marked fuzzy
don’t use translations marked fuzzy (default)
md2po -P source-md-dir pot
This will find all Markdown files (.md, .markdown, .txt, .text) in source-md-dir, convert them to POT files (that is, extract all translatable content) and place them in pot.
See the pot2po command for more information about how to create PO files from the POT files, and to update existing PO files when the POT files have changed.
Suppose you have created PO files for translation to Xhosa and placed them in the directory xh. You can then generate the translated version of the Markdown documents like so:
po2md -i xh -t source-md-dir -o xh-md-dir
All the PO translations in xh will be converted to Markdown using Markdown files in source-md-dir as templates and outputting new translated Markdown files in xh-md-dir.
Should you prefer a single PO/POT file for your collection of Markdown files, this is how to do it:
md2po -P --multifile=onefile source-md-dir file.pot
And similarly, to generate multiple translated output files from a single PO file, invoke po2md like so:
po2md -i xh.po -t source-md-dir -o xh-md-dir
In this example, xh.po is the translation file for Xhosa, source-md-dir is the directory where the Markdown files in the source language can be found, and xh-md-dir is the directory where the translated Markdown files will end up.
The Markdown format description gives more details on the format of the localisable Markdown content and the capabilities of this converter.