Package translate :: Package storage :: Module oo |
[hide private]
[frames] | no frames]

# Module oo

source code

Classes that hold units of .oo files (oounit) or entire files (oofile).

These are specific .oo files for localisation exported by OpenOffice.org - SDF format (previously knows as GSI files). For an overview of the format, see http://l10n.openoffice.org/L10N_Framework/Intermediate_file_format.html

The behaviour in terms of escaping is explained in detail in the programming comments.

Classes | [hide private]
| unormalizechar
| ooline this represents one line, one translation in an .oo file
| oounit this represents a number of translations of a resource
| oofile this represents an entire .oo file
| oomultifile this takes a huge GSI file and represents it as multiple smaller files...

Functions | [hide private]
normalizefilename(filename) converts any non-alphanumeric (standard roman) characters to _ | source code
str |
makekey(ookey, long_keys) converts an oo key tuple into a unique identifier | source code
escape_text(text) Escapes SDF text to be suitable for unit consumption. | source code
unescape_text(text) Unescapes SDF text to be suitable for unit consumption. | source code
escape_help_text(text) Escapes the help text as it would be in an SDF file. | source code
unescape_help_text(text) Unescapes normal text to be suitable for writing to the SDF file. | source code
encode_if_needed_utf8(text) Encode a Unicode string the the specified encoding | source code

Variables | [hide private]
| normalfilenamechars = ``'``/#.0123456789abcdefghijklmnopqrstuvwxyz``...``
| normalizetable = ``'``___________________________________#________``...``
| unormalizetable = `{}`
| helptagre = `re.compile(r'</`??``[`a`-`z_-`]``+?``(?:``|` `+``[`a`-`z`]``+?`=".`*?`"`)` `*`/`?``...``
| i = ``'``\xff``'``

Imports: os, re, quote, wStringIO, warnings

Function Details | [hide private]

### makekey(ookey, long_keys) | source code
converts an oo key tuple into a unique identifier Parameters: `ookey` (tuple) - an oo key `long_keys` (Boolean) - Use long keys Returns: str unique ascii identifier

### escape_help_text(text) | source code
Escapes the help text as it would be in an SDF file. <, >, " are only escaped in <[[:lower:]]> tags. Some HTML tags make it in in lowercase so those are dealt with. Some OpenOffice.org help tags are not escaped.

Variables Details | [hide private]

  ### normalfilenamechars Value:
      '/#.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

  ### normalizetable Value:
      '___________________________________#__________./0123456789_______ABCD
      EFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz________________
      ______________________________________________________________________
      _______________________________________________'

  ### helptagre Value:
      re.compile(r'</??[a-z_-]+?(?:| +[a-z]+?=".*?") */??>')