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
- 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.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.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.
|
|
PologyError
Base exception class for errors in Pology.
|
|
TextTrans
Class for intermediate handling of translated user-visible text.
|
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)
|
|
_(_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
|
Get data directory of Pology installation.
- Returns: string
- absolute directory path
|
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
|
Get Pology version string.
- Returns: string
- version string
|
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)
|