package pomo

 Methods

Add entry to the PO structure

add_entry(array|\Translation_Entry $entry) : boolean

Parameters

$entry

array\Translation_Entry

Returns

booleantrue on success, false if the entry doesn't have a key

add_entry_or_merge()

add_entry_or_merge(array|\Translation_Entry $entry) : boolean

Parameters

$entry

array\Translation_Entry

Returns

boolean

get_header()

get_header(string $header) 

Parameters

$header

string

get_plural_forms_count()

get_plural_forms_count() : integer

Returns

integer

merge_originals_with()

merge_originals_with(object $other) 

Parameters

$other

object

Merge $other in the current object.

merge_with(Object $other) : void

Parameters

$other

Object

Another Translation object, whose translations will be merged in this one (passed by reference).

Given the number of items, returns the 0-based index of the plural form to use

select_plural_form(integer $count) 

Here, in the base Translations class, the common logic for English is implemented: 0 if there is one element, 1 otherwise

This function should be overridden by the subclasses. For example MO/PO can derive the logic from their headers.

Parameters

$count

integer

number of items

Sets $header PO header to $value

set_header(string $header, string $value) 

If the header already exists, it will be overwritten

TODO: this should be out of this class, it is gettext specific

Parameters

$header

string

header name, without trailing :

$value

string

header value, without trailing \n

set_headers()

set_headers(array $headers) 

Parameters

$headers

array

translate()

translate(string $singular, string $context = null) : string

Parameters

$singular

string

$context

string

Returns

string

translate_entry()

translate_entry(\Translation_Entry $entry) 

Parameters

$entry

\Translation_Entry

translate_plural()

translate_plural(string $singular, string $plural, integer $count, string $context = null

Parameters

$singular

string

$plural

string

$count

integer

$context

string

 Properties

 

$entries

$entries 

Default

array()
 

$headers

$headers 

Default

array()