[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/pomo/ -> translations.php (summary)

Class for a set of entries for translation and their associated headers

Version: $Id: translations.php 718 2012-10-31 00:32:02Z nbachiyski $
File Size: 275 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

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

add_entry($entry)   X-Ref
Add entry to the PO structure

param: object &$entry
return: bool true on success, false if the entry doesn't have a key

add_entry_or_merge($entry)   X-Ref
No description

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

set_headers($headers)   X-Ref
No description

get_header($header)   X-Ref
No description

translate_entry(&$entry)   X-Ref
No description

translate($singular, $context=null)   X-Ref
No description

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

param: integer $count number of items

get_plural_forms_count()   X-Ref
No description

translate_plural($singular, $plural, $count, $context = null)   X-Ref
No description

merge_with(&$other)   X-Ref
Merge $other in the current object.

param: Object &$other Another Translation object, whose translations will be merged in this one
return: void

merge_originals_with(&$other)   X-Ref
No description

Class: Gettext_Translations  - X-Ref

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 descendand, which will use it and
they can't share it effectively.


nplurals_and_expression_from_header($header)   X-Ref
No description

make_plural_form_function($nplurals, $expression)   X-Ref
Makes a function, which will return the right translation index, according to the
plural forms header


parenthesize_plural_exression($expression)   X-Ref
Adds parantheses to the inner parts of ternary operators in
plural expressions, because PHP evaluates ternary oerators from left to right

param: string $expression the expression without parentheses
return: string the expression with parentheses added

make_headers($translation)   X-Ref
No description

set_header($header, $value)   X-Ref
No description

Class: NOOP_Translations  - X-Ref

Provides the same interface as Translations, but doesn't do anything

add_entry($entry)   X-Ref
No description

set_header($header, $value)   X-Ref
No description

set_headers($headers)   X-Ref
No description

get_header($header)   X-Ref
No description

translate_entry(&$entry)   X-Ref
No description

translate($singular, $context=null)   X-Ref
No description

select_plural_form($count)   X-Ref
No description

get_plural_forms_count()   X-Ref
No description

translate_plural($singular, $plural, $count, $context = null)   X-Ref
No description

merge_with(&$other)   X-Ref
No description



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu