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

# Module properties

source code

classes that hold units of .properties files (propunit) or entire files (propfile) these files are used in translating Mozilla and other software

The following .properties file description and example give some good references to the .properties specification.

Properties file may also hold Java MessageFormat messages. No special handling is provided in this storage class for MessageFormat, but this may be implemented in future.

# Implementation

A simple summary of what is permissible follows.

Comments:

     # a comment
     ! a comment

Name and Value pairs:

     # Note that the b and c are escaped for epydoc rendering
     a = a string
     d.e.f = another string
     b = a string with escape sequences \t \n \r \\ \" \' \ (space) \u0123
     c = a string with a continuation line \
         continuation line

Classes | [hide private]
| propunit an element of a properties file i.e.
| propfile this class represents a .properties file, made up of propunits

Functions | [hide private]
Tuple (Delimeter char, Offset Integer) |
find_delimeter(line) Find the type and position of the delimeter in a property line. | source code
Boolean |
is_line_continuation(line) Determine whether `line` has a line continuation marker. | source code
str |
key_strip(key) Cleanup whitespace found around a key | source code

Variables | [hide private]
| eol = ``'``\n``'``
| default_encoding = ``{``'``java``'``:` `'``latin1``'``,` `'``mozilla``'``:` `'``utf-8``'``}``

Imports: base, quote, data, re

Function Details | [hide private]

### find_delimeter(line) | source code
Find the type and position of the delimeter in a property line. Property files can be delimeted by "=", ":" or whitespace (space for now). We find the position of each delimeter, then find the one that appears first. Parameters: `line` (str) - A properties line Returns: Tuple (Delimeter char, Offset Integer) Delimeter character and offset within `line`

### is_line_continuation(line) | source code
Determine whether `line` has a line continuation marker. .properties files can be terminated with a backslash (\) indicating that the 'value' continues on the next line. Continuation is only valid if there are an odd number of backslashses (an even number would result in a set of N/2 slashes not an escape) Parameters: `line` (str) - A properties line Returns: Boolean Does `line` end with a line continuation

### key_strip(key) | source code
Cleanup whitespace found around a key Parameters: `key` (str) - A properties key Returns: str Key without any uneeded whitespace