Translation support

mdview can extract a translation template from the current document, and display a translation of the document using the GNU gettext library.

Run mdview --help for usage options. To enable translations start the document with:

%%textdomain domain

Document contents can be extracted with option --po and saved to a gettext translation template file. The translation unit is a whole paragraph — joined consecutive lines — which can be a very long unit (gettext msgid).

No Translation

A line starting with tab or 4 spaces is NOT translated.

Text inside a GFM code block is not translated unless the code block specifies a ‘gettext’ syntax tag.

  • Unlike for other types of code blocks, when ‘gettext’ is specified, contents will be translated:
  • mdview --po will not output this line unless it's wrapped between "```gettext" and "```".

    If you have a line which should not be translated put it between %%nopot tags (nopot yes and nopot no):

    %%nopot yes

    Let these English lines stay English only.

    Nothing inside these tags will go into the translation template.

    %%nopot no

    More info

    See the gettext tests files in the examples/ directory.