Package translate :: Package storage :: Module cpo :: Class pounit |
[hide private]
[frames] | no frames]

# Class pounit

source code

Instance Methods | [hide private]
__init__(self, source=None, encoding='utf-8', gpo_message=None) Constructs a TranslationUnit containing the given source string. | source code
setmsgid_plural(self, msgid_plural) | source code
string |
getid(self) The unique identifier for this unit according to the convensions in .mo files. | source code
copy(self) | source code
merge(self, otherpo, overwrite=False, comments=True, authoritative=False) Merges the otherpo (with the same msgid) into this one. | source code
isheader(self) Indicates whether this unit is a header. | source code
isblank(self) Used to see if this unit has no source or target string. | source code
hastypecomment(self, typecomment) | source code
settypecomment(self, typecomment, present=True) | source code
hasmarkedcomment(self, commentmarker) | source code
isfuzzy(self) Indicates whether this unit is fuzzy. | source code
markfuzzy(self, present=True) Marks the unit as fuzzy or not. | source code
isobsolete(self) | source code
makeobsolete(self) | source code
resurrect(self) | source code
hasplural(self) Tells whether or not this specific unit has plural strings. | source code
String |
_extract_msgidcomments(self, text=None) Extract KDE style msgid comments from the unit. | source code
setmsgidcomment(self, msgidcomment) | source code
__str__(self) str(x) | source code
getcontext(self) Get the message context. | source code
Inherited from `pocommon.pounit`: `isreview`, `istranslatable`, `istranslated`, `markreviewneeded` Inherited from `base.TranslationUnit`: `__eq__`, `getunits`, `multistring_to_rich`, `unit_iter` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`
Source
getsource(self) | source code
setsource(self, source) Sets the source string to the given value. | source code
Inherited from `base.TranslationUnit`: `getsourcelanguage` Inherited from `base.TranslationUnit` (private): `_get_rich_source`, `_set_rich_source`
Target
gettarget(self) | source code
settarget(self, target) Sets the target string to the given value. | source code
Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
Notes
getnotes(self, origin=None) Returns all notes about this unit. | source code
addnote(self, text, origin=None, position="append") Adds a note (comment). | source code
removenotes(self) Remove all the translator's notes. | source code
Locations
List |
getlocations(self) A list of source code locations. | source code
addlocation(self, location) Add one location to the list of locations. | source code
Inherited from `base.TranslationUnit`: `addlocations`
Errors
Inherited from `pocommon.pounit`: `adderror`, `geterrors`

Class Methods | [hide private]
buildfromunit(cls, unit) Build a native unit from a foreign unit, preserving as much information as possible. | source code
Inherited from `base.TranslationUnit`: `rich_to_multistring`

Class Variables | [hide private]
| msgid_plural = `property(None, setmsgid_plural)`
| msgidcomment = `property(_extract_msgidcomments, setmsgidcomment)`
Inherited from `base.TranslationUnit`: `rich_parsers`
Source
| source = `property(getsource, setsource)`
Target
| target = `property(gettarget, settarget)`

Properties | [hide private]
Inherited from `base.TranslationUnit`: `rid`, `xid` Inherited from `object`: `__class__`
Source
Inherited from `base.TranslationUnit`: `rich_source`
Target
Inherited from `base.TranslationUnit`: `rich_target`

Method Details | [hide private]

### __init__(self, source=None, encoding='utf-8', gpo_message=None) (Constructor) | source code
Constructs a TranslationUnit containing the given source string. Overrides: object.__init__ (inherited documentation)

### setsource(self, source) | source code
Sets the source string to the given value. Overrides: base.TranslationUnit.setsource (inherited documentation)

### settarget(self, target) | source code
Sets the target string to the given value. Overrides: base.TranslationUnit.settarget (inherited documentation)

### getid(self) | source code
The unique identifier for this unit according to the convensions in .mo files. Returns: string an identifier for this unit that is unique in the store Derived classes should override this in a way that guarantees a unique identifier for each unit in the store. Overrides: base.TranslationUnit.getid

### getnotes(self, origin=None) | source code
Returns all notes about this unit. It will probably be freeform text or something reasonable that can be synthesised by the format. It should not include location comments (see getlocations()). Overrides: base.TranslationUnit.getnotes (inherited documentation)

### addnote(self, text, origin=None, position="append") | source code
Adds a note (comment). Parameters: `text` - Usually just a sentence or two. `origin` - Specifies who/where the comment comes from. Origin can be one of the following text strings: 'translator' 'developer', 'programmer', 'source code' (synonyms) Overrides: base.TranslationUnit.addnote (inherited documentation)

### removenotes(self) | source code
Remove all the translator's notes. Overrides: base.TranslationUnit.removenotes (inherited documentation)

### merge(self, otherpo, overwrite=False, comments=True, authoritative=False) | source code
Merges the otherpo (with the same msgid) into this one. Overwrite non-blank self.msgstr only if overwrite is True merge comments only if comments is True Overrides: base.TranslationUnit.merge

### isheader(self) | source code
Indicates whether this unit is a header. Overrides: base.TranslationUnit.isheader (inherited documentation)

### isblank(self) | source code
Used to see if this unit has no source or target string. Overrides: base.TranslationUnit.isblank (inherited documentation)

### isfuzzy(self) | source code
Indicates whether this unit is fuzzy. Overrides: base.TranslationUnit.isfuzzy (inherited documentation)

### markfuzzy(self, present=True) | source code
Marks the unit as fuzzy or not. Overrides: base.TranslationUnit.markfuzzy (inherited documentation)

### hasplural(self) | source code
Tells whether or not this specific unit has plural strings. Overrides: base.TranslationUnit.hasplural (inherited documentation)

### _extract_msgidcomments(self, text=None) | source code
Extract KDE style msgid comments from the unit. Returns: String Returns the extracted msgidcomments found in this unit's msgid.

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

### getlocations(self) | source code
A list of source code locations. Returns: List Overrides: base.TranslationUnit.getlocations (inherited documentation)

### addlocation(self, location) | source code
Add one location to the list of locations. Overrides: base.TranslationUnit.addlocation (inherited documentation)

### getcontext(self) | source code
Get the message context. Overrides: base.TranslationUnit.getcontext (inherited documentation)

### buildfromunit(cls, unit) Class Method | source code
Build a native unit from a foreign unit, preserving as much information as possible. Overrides: base.TranslationUnit.buildfromunit