pology

Package pology |

# Package pology

The Pology Python library is a package for custom processing of PO files in field environments. It provides the foundation for Pology end-user tools.

Core Pology objects -- abstractions of PO catalog and its entries -- are designed to allow quick writing of robust scripts. By default, the correctness of processed objects is strictly enforced, but such that the user may easily switch it off for better performance. Modifications to PO files on disk are always explicit, and Pology tries to change as few lines as possible to be friendly to version control systems.

Pology provides utility various modules for typical processing needs of different kinds of data in PO files. These include word-splitting, markup handling, wrapping, comment parsing, summary reporting, validation, etc.

Pology also contains language-specific and project-specific modules, for functionality that is tightly linked to particular languages and translation projects.

Authors:
  Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>, Sébastien Renard <sebastien.renard@digitalfox.org>, Nicolas Ternisien <nicolas.ternisien@gmail.com>, Goran Rakic (Горан Ракић) <grakic@devbase.net>, Nick Shaforostoff (Николай Шафоростов) <shaforostoff@kde.ru>

License: GPLv3

Submodules
pology.ascript: Process ascription configurations, catalogs, and histories. pology.bpatterns: Detect unwanted patterns in translation. pology.catalog: Collection of PO entries. pology.colors: Standard codes for terminal colors. pology.comments: Parsing and composing message comments. pology.config: Access the user configuration of Pology. pology.diff: Produce special diffs between strings and other interesting objects. pology.entities: Handle entity definitions. pology.escape: Escaping texts in various contexts. pology.fsops: Operations with environment, file system and external commands. pology.getfunc: Fetch Pology modules, functions, data, etc. pology.gtxtools: Wrappers for commands from Gettext tools. pology.header: Header entry in PO catalogs. pology.lang: Language-specific tools, arranged in submodules by language code. pology.lang.es: Hooks specific for Spanish. pology.lang.es.compare_with_original: Make some comparations between the translation and the original text. pology.lang.es.remove_subs: Remove special substrings from parts of the message. pology.lang.fr: Language-specific tools for French language. pology.lang.fr.patternAccents: Accent equivalence in regular expression patterns. pology.lang.fr.patternEntities: Convert special entities in rule patterns. pology.lang.ja: Language-specific tools for Japanese language. pology.lang.ja.katakana: Retain only Katakana words in the text, separated by spaces. pology.lang.nb: Language-specific tools for Norwegian Bokmål. pology.lang.nb.exclusion: Catch inofficial ortography forms in Norwegian Bokmål translation. pology.lang.nn: Language-specific tools for Norwegian Nynorsk. pology.lang.nn.exclusion: Catch inofficial ortography forms in Norwegian Nynorsk translation. pology.lang.sr: Language-specific tools for Serbian language. pology.lang.sr.accents: Process letter accents in Serbian Cyrillic text. pology.lang.sr.charsets: Conversions between character sets in Serbian texts. pology.lang.sr.checks: Various checks for translations into Serbian. pology.lang.sr.nobr: Equip text with no-break characters where possibly helpful. pology.lang.sr.reduce: Reductions of Serbian text convenient in various special uses. pology.lang.sr.trapnakron: Constructors of syntagma derivators for trapnakron. pology.lang.sr.trapres: Resolve trapnakron references in translations. pology.lang.sr.uiref: Additions to resolving UI references. pology.lang.sr.wconv: Conversions between scripts and dialects in Serbian. pology.markup: Convert and validate markup in text. pology.match: Matchers and matcher helpers for various objects. pology.merge: Merge PO files. pology.message: Message entries in PO catalogs. pology.monitored: Framework for monitored classes. pology.msgreport: Report info, warning and error messages. pology.multi: Collections of multiple sequences. pology.noop: Hooks which do nothing. pology.normalize: Various normalizations for strings and PO elements. pology.proj: Translation project specific tools, arranged in submodules by project key. pology.proj.kde: Tools specific for KDE Translation Project. pology.proj.kde.cattype: Catalog clasification. pology.proj.kde.header: Additional header operations for KDE Translation Project. pology.remove: Remove special substrings from text. pology.report: Report info, warning and error messages. pology.resolve: Replace value-defining segments in text with their values. pology.rules: Match messages by rules of arbitrary specificity. pology.sieve: Helpers for catalog sieves. pology.spell: Check spelling in text using different spell checkers. pology.split: Splitting message fields into syntactical elements. pology.stdcmdopt: Standard command line options. pology.subcmd: Handle subcommands and their parameters. pology.synder: Derive forms and properties of syntagmas by macro expansion. pology.tabulate: Pretty-printing of tabular data. pology.timeout: A timeout decorator. pology.uiref: Resolve UI references in translation by following through original texts. pology.vcs: Version control operations. pology.wrap: Text wrapping, with special handling for typical texts in PO files.

Classes
| PologyError Base exception class for errors in Pology.
| TextTrans Class for intermediate handling of translated user-visible text.

Functions
ColorString |
_(_ctxt_, _text_, **kwargs) Get translation of the text into user's language. |
string |
datadir() Get data directory of Pology installation. |
string |
localedir() Get locale directory of Pology installation. |
ColorString |
n_(_ctxt_, _stext_, _ptext_, **kwargs) Get translation of the singular/plural text into user's language. |
TextTrans |
t_(_ctxt_, _text_, **kwargs) Get deferred translation of the text into user's language. |
TextTrans |
tn_(_ctxt_, _stext_, _ptext_, **kwargs) Get deferred translation of the singular/plural text into user's language. |
string |
version() Get Pology version string. |
(int, int, int, string) |
version_info() Get Pology version information. |

Variables
| __package__ = ``'``pology``'``

Function Details

### _(_ctxt_, _text_, **kwargs) |
Get translation of the text into user's language. If there are any formatting directives in the text, they should be named; the arguments which substitute them are given as keyword values following the text. Parameters: `_ctxt_` (string) - the context in which the text is used `_text_` (string) - the text to translate Returns: ColorString translated text if available, otherwise original

### datadir() |
Get data directory of Pology installation. Returns: string absolute directory path

### localedir() |
Get locale directory of Pology installation. Returns: string absolute directory path

### n_(_ctxt_, _stext_, _ptext_, **kwargs) |
Get translation of the singular/plural text into user's language. If there are any formatting directives in the text, they should be named; the arguments which substitute them are given as keyword values following the text. The plural deciding number is given by the `num` keyword argument. If no such key exists, or its value is not an integer, an error is raised. Parameters: `_ctxt_` (string) - the context in which the text is used `_stext_` (string) - the text to translate for the singular case `_ptext_` (string) - the text to translate for the plural case Returns: ColorString translated text if available, otherwise original

### t_(_ctxt_, _text_, **kwargs) |
Get deferred translation of the text into user's language. Like _(), but returns deferred translation object instead of translated text as string. In this way some or all arguments for named formatting directives can be supplied at a later point, using with_args method, and then the translated string obtained by to_string method. Returns: TextTrans deferred translation

### tn_(_ctxt_, _stext_, _ptext_, **kwargs) |
Get deferred translation of the singular/plural text into user's language. Like n_(), but returns deferred translation object instead of translated text as string. In this way some or all arguments for named formatting directives can be supplied at a later point, using with_args method, and then the translated string obtained by to_string method. Returns: TextTrans deferred translation

### version() |
Get Pology version string. Returns: string version string

### version_info() |
Get Pology version information. Pology version information consists of three version numbers (major, minor, bugfix) and an arbitrary suffix (may be empty). Returns: (int, int, int, string) version tuple (major, minor, bugfix, suffix)