\Translations

Summary

Methods
Properties
Constants
add_entry()
add_entry_or_merge()
set_header()
set_headers()
get_header()
translate_entry()
translate()
select_plural_form()
get_plural_forms_count()
translate_plural()
merge_with()
merge_originals_with()
$entries
$headers
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$entries

$entries

$headers

$headers

Methods

add_entry()

add_entry( $entry) : bool

Add entry to the PO structure

Parameters

$entry

Returns

bool —

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

add_entry_or_merge()

add_entry_or_merge( $entry)

Parameters

$entry

set_header()

set_header(string $header, string $value)

Sets $header PO header to $value

If the header already exists, it will be overwritten

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

Parameters

string $header

header name, without trailing :

string $value

header value, without trailing \n

set_headers()

set_headers( $headers)

Parameters

$headers

get_header()

get_header( $header)

Parameters

$header

translate_entry()

translate_entry( $entry)

Parameters

$entry

translate()

translate( $singular,  $context)

Parameters

$singular
$context

select_plural_form()

select_plural_form(integer $count)

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

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 overrided by the sub-classes. For example MO/PO can derive the logic from their headers.

Parameters

integer $count

number of items

get_plural_forms_count()

get_plural_forms_count()

translate_plural()

translate_plural( $singular,  $plural,  $count,  $context)

Parameters

$singular
$plural
$count
$context

merge_with()

merge_with( $other) : void

Merge $other in the current object.

Parameters

$other

merge_originals_with()

merge_originals_with( $other)

Parameters

$other