Package translate :: Package storage :: Module qph :: Class QphFile

[hide private]
[frames] | no frames]

# Class QphFile

source code

Class representing a QPH file store.

Nested Classes | [hide private]

| UnitClass The class of units that will be instantiated and used by this class

Instance Methods | [hide private]

initbody(self) Initialises self.body so it never needs to be retrieved from the XML again. | source code

String

getsourcelanguage(self) Get the source language for this .qph file. | source code

String

gettargetlanguage(self) Get the target language for this .qph file. | source code

settargetlanguage(self, targetlanguage) Set the target language for this .qph file to `targetlanguage`. | source code

__str__(self) Converts to a string containing the file's XML. | source code

Inherited from `lisa.LISAfile`: `__init__`, `addheader`, `addsourceunit`, `addunit`, `namespaced`, `parse`

Inherited from `base.TranslationStore`: `__getstate__`, `__setstate__`, `add_unit_to_index`, `detect_encoding`, `findid`, `findunit`, `findunits`, `getids`, `getprojectstyle`, `getunits`, `isempty`, `makeindex`, `remove_unit_from_index`, `require_index`, `save`, `savefile`, `setprojectstyle`, `setsourcelanguage`, `translate`, `unit_iter`

Inherited from `base.TranslationStore` (private): `_assignname`

Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`

Class Methods | [hide private]

Inherited from `base.TranslationStore`: `parsefile`, `parsestring`

Class Variables | [hide private]

| Name = `_("Qt Phrase Book")` The human usable name of this store type
| Mimetypes = `["application/x-qph"]` A list of MIME types associated with this store type
| Extensions = `["qph"]` A list of file extentions associated with this store type
| rootNode = `"QPH"`
| bodyNode = `"QPH"`
| XMLskeleton = `'''<!DOCTYPE Q`...``
| namespace = `''` Parse an instance of this class from the start of the given string.
Inherited from `base.TranslationStore`: `suggestions_in_format` Inherited from `base.TranslationStore` (private): `_binary`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### initbody(self)

source code

Initialises self.body so it never needs to be retrieved from the XML again.

Overrides: lisa.LISAfile.initbody

### getsourcelanguage(self)

source code

Get the source language for this .qph file.

We don't implement setsourcelanguage as users really shouldn't be altering the source language in .qph files, it should be set correctly by the extraction tools.

Returns: String
  ISO code e.g. af, fr, pt_BR
Overrides: base.TranslationStore.getsourcelanguage

### gettargetlanguage(self)

source code

Get the target language for this .qph file.

Returns: String
  ISO code e.g. af, fr, pt_BR
Overrides: base.TranslationStore.gettargetlanguage

### settargetlanguage(self, targetlanguage)

source code

Set the target language for this .qph file to `targetlanguage`.

Parameters:
  - `targetlanguage` (String) - ISO code e.g. af, fr, pt_BR
Overrides: base.TranslationStore.settargetlanguage

### __str__(self)
(Informal representation operator)

source code

Converts to a string containing the file's XML.

We have to override this to ensure mimic the Qt convention:

- no XML decleration
- plain DOCTYPE that lxml seems to ignore

Overrides: object.__str__

Class Variable Details | [hide private]

### XMLskeleton

Value:

      '''<!DOCTYPE QPH>
      <QPH>
      </QPH>
      '''