Package translate :: Package storage :: Module pypo

[hide private]
[frames] | no frames]

# Module pypo

source code

classes that hold units of .po files (pounit) or entire files (pofile) gettext-style .po (or .pot) files are used in translations for KDE et al (see kbabel)

Classes | [hide private]

| pounit Base class for translation units.
| pofile this represents a .po file containing various units

Functions | [hide private]

escapeforpo(line) Escapes a line for po format. | source code

unescapehandler(escape) | source code

wrapline(line) Wrap text for po files. | source code

quoteforpo(text) quotes the given text for a PO file, returning quoted and escaped lines | source code

extractpoline(line) Remove quote and unescape line from po file. | source code

unquotefrompo(postr) | source code

encodingToUse(encoding) Tests whether the given encoding is known in the python runtime, or returns utf-8. | source code

extractstr(string) | source code

Variables | [hide private]

| lsep = ``'``\n#:` `'`` Seperator for #: entries
| po_unescape_map = ``{``'``\\"``'``:` `'``"``'``,` `'``\\\\``'``:` `'``\\``'``,` `'``\\n``'``:` `'``\n``'``,` `'``\\r``...``
| po_escape_map = ``{``'``\t``'``:` `'``\\t``'``,` `'``\n``'``:` `'``\\n``'``,` `'``\r``'``:` `'``\\r``'``,` `'``"``'``:` `'``...``
| key = ``'``\\\\``'``
| value = ``'``\\``'``

Function Details | [hide private]

### escapeforpo(line)

source code

Escapes a line for po format. assumes no occurs in the line.

Parameters:
  - `line` - unescaped text

### extractpoline(line)

source code

Remove quote and unescape line from po file.

Parameters:
  - `line` - a quoted line from a po file (msgid or msgstr)

### encodingToUse(encoding)

source code

Tests whether the given encoding is known in the python runtime, or returns utf-8. This function is used to ensure that a valid encoding is always used.

Variables Details | [hide private]

### po_unescape_map

Value:

      {'\\"': '"', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}

### po_escape_map

Value:

      {'\t': '\\t', '\n': '\\n', '\r': '\\r', '"': '\\"', '\\': '\\\\'}