Module catkeys
source code
Manage the Haiku catkeys translation format
The Haiku catkeys format is the translation format used for
localisation of the Haiku operating system.
It is a bilingual base class derived format with CatkeysFile and CatkeysUnit providing file and unit level access. The
file format is described here:
http://www.haiku-os.org/blog/pulkomandy/2009-09-24_haiku_locale_kit_translator_handbook
Implementation
The implementation covers the full requirements of a catkeys file.
The files are simple Tab Separated Value (TSV) files that can be read
by Microsoft Excel and other spreadsheet programs. They use the .txt
extension which does make it more difficult to automatically identify
such files.
The dialect of the TSV files is specified by CatkeysDialect.
Encoding
The files are UTF-8 encoded.
Header
CatkeysHeader provides header management
support.
Escaping
catkeys seem to escape things like in C++ (strings are just
extracted from the source code unchanged, it seems.
Functions allow for escaping and unescaping.
|
FIELDNAMES_HEADER = ["version", "language", "mimetype", "check...
Field names for the catkeys header
|
|
FIELDNAMES = ["source", "context", "comment", "target"]
Field names for a catkeys TU
|
|
FIELDNAMES_HEADER_DEFAULTS = {"version": "1", "language": "", ...
Default or minimum header entries for a catkeys file
|
|
_unescape_map = {"\\r": "\r", "\\t": "\t", '\\n': '\n', '\\\\'...
|
|
_escape_map = dict([(value, key) for(key, value) in _unescape_...
|
Imports:
csv,
sys,
data,
base
FIELDNAMES_HEADER
Field names for the catkeys header
- Value:
["version", "language", "mimetype", "checksum"]
|
|
FIELDNAMES_HEADER_DEFAULTS
Default or minimum header entries for a catkeys file
- Value:
{"version": "1", "language": "", "mimetype": "", "checksum": "",}
|
|
_unescape_map
- Value:
{"\\r": "\r", "\\t": "\t", '\\n': '\n', '\\\\': '\\'}
|
|
_escape_map
- Value:
dict([(value, key) for(key, value) in _unescape_map.items()])
|
|