mdpo.md2po2md.markdown_to_pofile_to_markdown(langs, input_paths_glob, output_paths_schema, extensions=['collapse_whitespace', 'tables', 'strikethrough', 'tasklists', 'latex_math_spans', 'wikilinks'], command_aliases={}, location=True, debug=False, po_encoding=None, md_encoding=None, md2po_kwargs={}, po2md_kwargs={}, _check_saved_files_changed=False)

Translate a set of Markdown files using PO files.

  • langs (list) – List of languages used to build the output directories.

  • input_paths_glob (str) – Glob covering Markdown files to translate.

  • output_paths_schema (str) –

    Path schema for outputs, built using placeholders. There is a mandatory placeholder for languages: {lang}; and one optional for output basename: {basename}. For example, for the schema locale/{lang}, the languages ['es', 'fr'] and a README.md as input, the next files will be written:

    • locale/es/README.po

    • locale/es/README.md

    • locale/fr/README.po

    • locale/fr/README.md

    Note that you can omit {basename}, specifying a directory for each language with locale/{lang} for this example. Unexistent directories and files will be created, so you don’t have to prepare the output directories before the execution.

  • extensions (list) – md4c extensions used to parse markdown content, formatted as a list of ‘pymd4c’ keyword arguments. You can see all available at pymd4c repository.

  • 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.

  • location (bool) – Store references of top-level blocks in which are found the messages in PO file #: reference comments.

  • debug (bool) – Add events displaying all parsed elements in the extraction process.

  • po_encoding (str) – PO files encoding.

  • md_encoding (str) – Markdown files encoding.

  • md2po_kwargs (dict) – Additional optional arguments passed to markdown_to_pofile function.

  • po2md_kwargs (dict) – Additional optional arguments passed to pofile_to_markdown function.