__init__.py

mdpo.mdpo2html.markdown_pofile_to_html(filepath_or_content, pofiles, ignore=[], save=None, po_encoding=None, html_encoding='utf-8', command_aliases={}, **kwargs)

Produces a translated HTML file given a previous HTML file (created by a Markdown-to-HTML processor) and a set of pofiles as reference for msgstrs.

Parameters
  • filepath_or_content (str) – HTML whose content wants to be translated.

  • pofiles (str) – Glob for set of pofiles used as reference translating the strings to another language.

  • ignore (list) – List of paths to pofiles to ignore, useful if the glob patterns in pofiles parameter does not fit your requirements.

  • save (str) – If you pass this parameter as a path to one HTML file, even if does not exists, will be saved in the path the output of the function.

  • html_encoding (str) – HTML content encoding.

  • po_encoding (str) – PO files encoding. If you need different encodings for each file, you must define it in the “Content-Type” field of each PO file metadata, in the form "Content-Type: text/plain; charset=<ENCODING>\n".

  • command_aliases (dict) – Mapping of aliases to use custom mdpo command names in comments. The mdpo- prefix in command names resolution is optional. For example, if you want to use <!-- mdpo-on --> instead of <!-- mdpo-enable -->, you can pass the dictionaries {"mdpo-on": "mdpo-enable"} or {"mdpo-on": "enable"} to this parameter.

Known limitations:

Returns

HTML output translated version of the given file.

Return type

str