Package translate :: Package storage :: Module php :: Class phpunit

[hide private]
[frames] | no frames]

# Class phpunit

source code

a unit of a PHP file i.e. a name and value, and any comments associated

Instance Methods | [hide private]

__init__(self, source=`'````'`) construct a blank phpunit | source code

__str__(self) convert to a string. | source code

getoutput(self) convert the unit back into formatted lines for a php file | source code

isblank(self) Returns whether this is a blank element, containing only comments. | source code

string

getid(self) A unique identifier for this unit. | source code

Inherited from `base.TranslationUnit`: `__eq__`, `getcontext`, `getunits`, `hasplural`, `isfuzzy`, `isheader`, `isobsolete`, `isreview`, `istranslatable`, `istranslated`, `makeobsolete`, `markfuzzy`, `markreviewneeded`, `merge`, `multistring_to_rich`, `setcontext`, `setid`, `unit_iter`

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

Source

setsource(self, source) Sets the source AND the target to be equal | source code

getsource(self) | source code

Inherited from `base.TranslationUnit`: `getsourcelanguage` Inherited from `base.TranslationUnit` (private): `_get_rich_source`, `_set_rich_source`
Target

settarget(self, target) Sets the target string to the given value. | source code

gettarget(self) | source code

Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
Notes

addnote(self, text, origin=None, position=`'``append``'`) Adds a note (comment). | source code

getnotes(self, origin=None) Returns all notes about this unit. | source code

removenotes(self) Remove all the translator's notes. | source code

Locations

addlocation(self, location) Add one location to the list of locations. | source code

List

getlocations(self) A list of source code locations. | source code

Inherited from `base.TranslationUnit`: `addlocations`
Errors
Inherited from `base.TranslationUnit`: `adderror`, `geterrors`

Class Methods | [hide private]

Inherited from `base.TranslationUnit`: `buildfromunit`, `rich_to_multistring`

Class Variables | [hide private]

Inherited from `base.TranslationUnit`: `rich_parsers`

Properties | [hide private]

Inherited from `base.TranslationUnit`: `rid`, `xid` Inherited from `object`: `__class__`
Source
| source
Inherited from `base.TranslationUnit`: `rich_source`
Target
| target
Inherited from `base.TranslationUnit`: `rich_target`

Method Details | [hide private]

### __init__(self, source=`'````'`)
(Constructor)

source code

construct a blank phpunit

Overrides: object.__init__

### setsource(self, source)

source code

Sets the source AND the target to be equal

Overrides: base.TranslationUnit.setsource

### settarget(self, target)

source code

Sets the target string to the given value.

Overrides: base.TranslationUnit.settarget
  (inherited documentation)

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

source code

convert to a string. double check that unicode is handled somehow here

Overrides: object.__str__

### addlocation(self, location)

source code

Add one location to the list of locations.

Overrides: base.TranslationUnit.addlocation
  (inherited documentation)

### getlocations(self)

source code

A list of source code locations.

Returns: List
Overrides: base.TranslationUnit.getlocations
  (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)

### 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)

### removenotes(self)

source code

Remove all the translator's notes.

Overrides: base.TranslationUnit.removenotes
  (inherited documentation)

### isblank(self)

source code

Returns whether this is a blank element, containing only comments.

Overrides: base.TranslationUnit.isblank

### getid(self)

source code

A unique identifier for this unit.

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
  (inherited documentation)

Property Details | [hide private]

### source

Get Method:
  getsource(self)
Set Method:
  setsource(self, source) - Sets the source AND the target to be equal

### target

Get Method:
  gettarget(self)
Set Method:
  settarget(self, target) - Sets the target string to the given value.