| [ Index ] |
PHP Cross Reference of BackPress |
[Source view] [Print] [Project Stats]
Class for a set of entries for translation and their associated headers
| Version: | $Id: translations.php 1183 2026-03-30 00:28:59Z dd32 $ |
| File Size: | 546 lines (13 kb) |
| Included or required: | 2 times |
| Referenced: | 0 times |
| Includes or requires: | 2 files includes/pomo/entry.php includes/pomo/plural-forms.php |
Translations:: (12 methods):
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()
Gettext_Translations:: (6 methods):
gettext_select_plural_form()
nplurals_and_expression_from_header()
make_plural_form_function()
parenthesize_plural_exression()
make_headers()
set_header()
NOOP_Translations:: (10 methods):
add_entry()
set_header()
set_headers()
get_header()
translate_entry()
translate()
select_plural_form()
get_plural_forms_count()
translate_plural()
merge_with()
Class: Translations - X-Ref
Translations class.| add_entry( $entry ) X-Ref |
| Adds an entry to the PO structure. param: array|Translation_Entry $entry return: bool True on success, false if the entry doesn't have a key. since: 2.8.0 |
| add_entry_or_merge( $entry ) X-Ref |
| Adds or merges an entry to the PO structure. param: array|Translation_Entry $entry return: bool True on success, false if the entry doesn't have a key. since: 2.8.0 |
| set_header( $header, $value ) X-Ref |
| 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 param: string $header header name, without trailing : param: string $value header value, without trailing \n since: 2.8.0 |
| set_headers( $headers ) X-Ref |
| Sets translation headers. param: array $headers Associative array of headers. since: 2.8.0 |
| get_header( $header ) X-Ref |
| Returns a given translation header. param: string $header return: string|false Header if it exists, false otherwise. since: 2.8.0 |
| translate_entry( &$entry ) X-Ref |
| Returns a given translation entry. param: Translation_Entry $entry Translation entry. return: Translation_Entry|false Translation entry if it exists, false otherwise. since: 2.8.0 |
| translate( $singular, $context = null ) X-Ref |
| Translates a singular string. param: string $singular param: string $context return: string since: 2.8.0 |
| select_plural_form( $count ) X-Ref |
| 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 overridden by the subclasses. For example MO/PO can derive the logic from their headers. param: int $count Number of items. return: int Plural form to use. since: 2.8.0 |
| get_plural_forms_count() X-Ref |
| Returns the plural forms count. return: int Plural forms count. since: 2.8.0 |
| translate_plural( $singular, $plural, $count, $context = null ) X-Ref |
| Translates a plural string. param: string $singular param: string $plural param: int $count param: string $context return: string since: 2.8.0 |
| merge_with( &$other ) X-Ref |
| Merges other translations into the current one. param: Translations $other Another Translation object, whose translations will be merged in this one (passed by reference). since: 2.8.0 |
| merge_originals_with( &$other ) X-Ref |
| Merges originals with existing entries. param: Translations $other since: 2.8.0 |
Class: Gettext_Translations - X-Ref
Gettext_Translations class.| gettext_select_plural_form( $count ) X-Ref |
| The gettext implementation of select_plural_form. It lives in this class, because there are more than one descendant, which will use it and they can't share it effectively. param: int $count Plural forms count. return: int Plural form to use. since: 2.8.0 |
| nplurals_and_expression_from_header( $header ) X-Ref |
| Returns the nplurals and plural forms expression from the Plural-Forms header. param: string $header return: array{0: int, 1: string} since: 2.8.0 |
| make_plural_form_function( $nplurals, $expression ) X-Ref |
| Makes a function, which will return the right translation index, according to the plural forms header. param: int $nplurals param: string $expression return: callable since: 2.8.0 |
| parenthesize_plural_exression( $expression ) X-Ref |
| Adds parentheses to the inner parts of ternary operators in plural expressions, because PHP evaluates ternary operators from left to right param: string $expression the expression without parentheses return: string the expression with parentheses added since: 2.8.0 |
| make_headers( $translation ) X-Ref |
| Prepare translation headers. param: string $translation return: array<string, string> Translation headers since: 2.8.0 |
| set_header( $header, $value ) X-Ref |
| Sets translation headers. param: string $header param: string $value since: 2.8.0 |
Class: NOOP_Translations - X-Ref
Provides the same interface as Translations, but doesn't do anything.| add_entry( $entry ) X-Ref |
| List of translation headers. since: 2.8.0 |
| set_header( $header, $value ) X-Ref |
| Sets a translation header. param: string $header param: string $value since: 2.8.0 |
| set_headers( $headers ) X-Ref |
| Sets translation headers. param: array $headers since: 2.8.0 |
| get_header( $header ) X-Ref |
| Returns a translation header. param: string $header return: false since: 2.8.0 |
| translate_entry( &$entry ) X-Ref |
| Returns a given translation entry. param: Translation_Entry $entry return: false since: 2.8.0 |
| translate( $singular, $context = null ) X-Ref |
| Translates a singular string. param: string $singular param: string $context since: 2.8.0 |
| select_plural_form( $count ) X-Ref |
| Returns the plural form to use. param: int $count return: int since: 2.8.0 |
| get_plural_forms_count() X-Ref |
| Returns the plural forms count. return: int since: 2.8.0 |
| translate_plural( $singular, $plural, $count, $context = null ) X-Ref |
| Translates a plural string. param: string $singular param: string $plural param: int $count param: string $context return: string since: 2.8.0 |
| merge_with( &$other ) X-Ref |
| Merges other translations into the current one. param: Translations $other since: 2.8.0 |
| Generated: Mon Apr 20 01:00:13 2026 | Cross-referenced by PHPXref 0.7.1 |