pology.uiref

Package pology :: Module uiref |

# Module uiref

Resolve UI references in translation by following through original texts.

If PO files which are delivered are not the same PO files which are actually being translated, but there is processing step involved to get former from the latter, there is a possibility to automatically resolve references to user interface strings mentioned through messages (typical e.g. of documentation POs). Compared to hard-coding it, this enables referenced UI text to always be in sync with actual UI, without necessity for manual tracking of changes in the UI.

See `doc/user/lingo.docbook#sec-lguirefs` for details.

Author: Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>

License: GPLv3

Functions
`(msgstr, msg, cat) -> msgstr` |
resolve_ui(headrefs=`[``'``~%``'``]`, tagrefs=`[``]`, uipathseps=`[``]`, uicpaths=None, uicpathenv=None, xmlescape=False, pfhook=None, mkeyw=None, invmkeyw=False, quiet=False) Resolve general UI references in translations [hook factory]. |
`(msgstr, msg, cat) -> spans` |
check_ui(headrefs=`[``'``~%``'``]`, tagrefs=`[``]`, uipathseps=`[``]`, uicpaths=None, uicpathenv=None, xmlescape=False, mkeyw=None, invmkeyw=False) Check general UI references in translations [hook factory]. |
`(msgstr, msg, cat) -> msgstr` |
resolve_ui_docbook4(headrefs=`[``'``~%``'``]`, uicpaths=None, uicpathenv=None, pfhook=None, mkeyw=None, quiet=False) Resolve UI references in Docbook 4.x translations [hook factory]. |
`(msgstr, msg, cat) -> spans` |
check_ui_docbook4(headrefs=`[``'``~%``'``]`, uicpaths=None, uicpathenv=None, mkeyw=None) Check UI references in Docbook 4.x translations [hook factory]. |
`(msgstr, msg, cat) -> msgstr` |
resolve_ui_kde4(headrefs=`[``'``~%``'``]`, uipathseps=None, uicpaths=None, uicpathenv=None, pfhook=None, mkeyw=None, quiet=False) Resolve UI references in KDE4 UI translations [hook factory]. |
`(msgstr, msg, cat) -> spans` |
check_ui_kde4(headrefs=`[``'``~%``'``]`, uipathseps=None, uicpaths=None, uicpathenv=None, mkeyw=None) Check UI references in KDE4 UI translations [hook factory]. |

Variables
| default_headrefs = ``[``'``~%``'``]`` Default heads for explicit UI references.
| __package__ = ``'``pology``'``

Function Details

### resolve_ui(headrefs=`[``'``~%``'``]`, tagrefs=`[``]`, uipathseps=`[``]`, uicpaths=None, uicpathenv=None, xmlescape=False, pfhook=None, mkeyw=None, invmkeyw=False, quiet=False) |
Resolve general UI references in translations [hook factory]. If UI catalogs are collected through the environment variable, a warning is issued if the given variable has not been set. Resolved UI text can be postprocessed by an F1A hook (`(text)->text`). It can be given either as the hook function itself, or as a language request string. If one or several markup keywords are given as `mkeyw` parameter, UI reference resolution is skipped for catalogs which do not report one of the given keywords by their markup() method. This match may be inverted by `invmkeyw` parameter, i.e. to skip resolution for catalogs reporting one of given keywords. The list of UI path separators given by the `uipathseps` parameter is ordered by priority, such that the first one found in the composite reference text is used to split it into componental UI references. Parameters: `headrefs` (list of strings) - heads for explicit UI references `tagrefs` (list of strings) - XML-like tags which define implicit UI references `uipathseps` (list of strings) - separators in composited UI references `uicpaths` (list of strings) - paths to UI catalogs in the project (both files and directories can be given) `uicpathenv` (string) - environment variable defining directories where UI catalogs may be found (colon-separated directory paths) `xmlescape` (bool) - whether to normalize UI text for XML `pfhook` (function or string) - F1A hook to postprocess resolved UI text `mkeyw` (string or list of strings) - markup keywords for taking catalogs into account `invmkeyw` (bool) - whether to invert the meaning of `mkeyw` parameter `quiet` (bool) - whether to output warnings of failed resolutions Returns: `(msgstr, msg, cat) -> msgstr` type F3C hook

### check_ui(headrefs=`[``'``~%``'``]`, tagrefs=`[``]`, uipathseps=`[``]`, uicpaths=None, uicpathenv=None, xmlescape=False, mkeyw=None, invmkeyw=False) |
Check general UI references in translations [hook factory]. See resolve_ui for description of parameters. Returns: `(msgstr, msg, cat) -> spans` type V3C hook

### resolve_ui_docbook4(headrefs=`[``'``~%``'``]`, uicpaths=None, uicpathenv=None, pfhook=None, mkeyw=None, quiet=False) |
Resolve UI references in Docbook 4.x translations [hook factory]. A convenience hook which fixes some of the parameters to resolve_ui to match implicit UI references and formatting needs for Docbook POs. Returns: `(msgstr, msg, cat) -> msgstr` type F3C hook

### check_ui_docbook4(headrefs=`[``'``~%``'``]`, uicpaths=None, uicpathenv=None, mkeyw=None) |
Check UI references in Docbook 4.x translations [hook factory]. A convenience resolver which fixes some of the parameters to check_ui to match implicit UI references and formatting needs for Docbook POs. Returns: `(msgstr, msg, cat) -> spans` type V3C hook

### resolve_ui_kde4(headrefs=`[``'``~%``'``]`, uipathseps=None, uicpaths=None, uicpathenv=None, pfhook=None, mkeyw=None, quiet=False) |
Resolve UI references in KDE4 UI translations [hook factory]. A convenience resolver which fixes some of the parameters to resolve_ui to match implicit UI references and formatting needs for KDE4 UI POs. If `uipathseps` is `None`, separators known to KUIT `<interface>` tag will be used automatically. Returns: `(msgstr, msg, cat) -> msgstr` type F3C hook

### check_ui_kde4(headrefs=`[``'``~%``'``]`, uipathseps=None, uicpaths=None, uicpathenv=None, mkeyw=None) |
Check UI references in KDE4 UI translations [hook factory]. A convenience resolver which fixes some of the parameters to check_ui to match implicit UI references and formatting needs for KDE4 UI POs. If `uipathseps` is `None`, separators known to KUIT `<interface>` tag will be used automatically. Returns: `(msgstr, msg, cat) -> spans` type V3C hook