Gettext_Translations class.
| package |
pomo |
| inherited_from |
\Gettext_Translations |
Methods
Adds an entry to the PO structure.
add_entry(array|\Translation_Entry $entry) : boolean
Inherited
Parameters
$entry
array\Translation_Entry
Returns
booleanTrue on success, false if the entry doesn't have a key.
Adds or merges an entry to the PO structure.
add_entry_or_merge(array|\Translation_Entry $entry) : boolean
Inherited
Parameters
$entry
array\Translation_Entry
Returns
booleanTrue on success, false if the entry doesn't have a key.
export()
export() : string | false
export_original()
export_original(\Translation_Entry $entry) : string
Parameters
$entry
\Translation_Entry
Returns
string
export_to_file()
export_to_file(string $filename) : boolean
Parameters
$filename
string
Returns
boolean
export_to_file_handle()
export_to_file_handle(resource $fh) : true
Parameters
$fh
resource
Returns
true
export_translations()
export_translations(\Translation_Entry $entry) : string
Parameters
$entry
\Translation_Entry
Returns
string
get_byteorder()
get_byteorder(integer $magic) : string | false
Parameters
$magic
integer
Returns
stringfalse
Returns the loaded MO file.
get_filename() : string
Returns
stringThe loaded MO file.
The gettext implementation of select_plural_form.
gettext_select_plural_form(integer $count) : integer
Inherited
It lives in this class, because there are more than one descendant, which will use it and
they can't share it effectively.
Parameters
$count
integerPlural forms count.
Returns
integerPlural form to use.
Fills up with the entries from MO file $filename
import_from_file(string $filename) : boolean
Parameters
$filename
stringMO file to load
Returns
booleanTrue if the import from file was successful, otherwise false.
import_from_reader()
import_from_reader(\POMO_FileReader $reader) : boolean
Parameters
$reader
\POMO_FileReader
Returns
booleanTrue if the import was successful, otherwise false.
is_entry_good_for_export()
is_entry_good_for_export(\Translation_Entry $entry) : boolean
Parameters
$entry
\Translation_Entry
Returns
boolean
Build a Translation_Entry from original string and translation strings,
found in a MO file
make_entry(string $original, string $translation) : \Translation_Entry
Static
Parameters
$original
stringoriginal string to translate from MO file. Might contain
0x04 as context separator or 0x00 as singular/plural separator
$translation
stringtranslation string from MO file. Might contain
0x00 as a plural translations separator
Returns
\Translation_EntryEntry instance.
Merges originals with existing entries.
merge_originals_with(\Translations $other)
Inherited
Parameters
$other
\Translations
Merges other translations into the current one.
merge_with(\Translations $other)
Inherited
Parameters
$other
\TranslationsAnother Translation object, whose translations will be merged in this one (passed by reference).
Returns the nplurals and plural forms expression from the Plural-Forms header.
nplurals_and_expression_from_header(string $header) : \array{0:
Inherited
Parameters
$header
string
Returns
\array{0:int, 1: string}
Adds parentheses to the inner parts of ternary operators in
plural expressions, because PHP evaluates ternary operators from left to right
parenthesize_plural_exression(string $expression) : string
Inherited
| since |
2.8.0 |
| deprecated |
6.5.0 Use the Plural_Forms class instead. |
| see |
|
Parameters
$expression
stringthe expression without parentheses
Returns
stringthe expression with parentheses added
Translates a singular string.
translate(string $singular, string $context = null) : string
Inherited
Parameters
$singular
string
$context
string
Returns
string
Returns a given translation entry.
translate_entry(\Translation_Entry $entry) : \Translation_Entry | false
Inherited
Parameters
$entry
\Translation_EntryTranslation entry.
Returns
\Translation_EntryfalseTranslation entry if it exists, false otherwise.
Translates a plural string.
translate_plural(string $singular, string $plural, integer $count, string $context = null) : string
Inherited
Parameters
$singular
string
$plural
string
$count
integer
$context
string
Returns
string
Properties
Callback to retrieve the plural form.
$_gettext_select_plural_form : callable
Number of plural forms.
$_nplurals : integer
| inherited_from |
\Gettext_Translations::_nplurals |
Number of plural forms.
$_nplurals : integer
List of translation entries.
$entries : array<mixed,\Translation_Entry>
Loaded MO file.
$filename : string