A command line program to do i18n and l10n for individual Markdown files.
CommonMark compliant. All core Markdown elements are supported, as well as YAML front matter, table, and definition list.
pip install markdown-gettext
You can use either md-gettext
or markdown-gettext
command
md-gettext extract [-p PACKAGE] [-r REPORT_ADDR] [-t TEAM_ADDR] md pot
positional arguments:
md path of the Markdown file to extract messages from
pot path of the POT file to create
optional arguments:
-p PACKAGE, --package PACKAGE
the package name in POT metadata
-r REPORT_ADDR, --report-addr REPORT_ADDR
the report address in POT metadata
-t TEAM_ADDR, --team-addr TEAM_ADDR
the team address in POT metadata
md-gettext generate [-l LANG] in-md po out-md
positional arguments:
in-md path of the source Markdown file
po path of the PO file containing translations
out-md path of the Markdown file to create
optional arguments:
-l LANG, --lang LANG language of translations
Some notes about how different elements are handled:
- Inlines: hard line breaks are replaced with
<br />
, newlines and consecutive spaces are not kept; - Content of each HTML block isn't parsed into finer tokens but processed as a whole;
- With Conda
conda env create -f environment.yml
conda activate mg
poetry install