[ Index ]
 

Code source de WordPress 2.1.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wp-includes/ -> gettext.php (sommaire)

(pas de description)

Poids: 364 lignes (11 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

gettext_reader:: (11 méthodes):
  readint()
  readintarray()
  gettext_reader()
  load_tables()
  get_original_string()
  get_translation_string()
  find_string()
  translate()
  get_plural_forms()
  select_string()
  ngettext()


Classe: gettext_reader  - X-Ref

Provides a simple gettext replacement that works independently from
the system's gettext abilities.
It can read MO files and use them for translating strings.
The files are passed to gettext_reader as a Stream (see streams.php)

This version has the ability to cache all strings and translations to
speed up the string lookup.
While the cache is enabled by default, it can be switched off with the
second parameter in the constructor (e.g. whenusing very large MO files
that you don't want to keep in memory)
readint()   X-Ref
Reads a 32bit Integer from the Stream

return: Integer from the Stream

readintarray($count)   X-Ref
Reads an array of Integers from the Stream

param: int count How many elements should be read
return: Array of Integers

gettext_reader($Reader, $enable_cache = true)   X-Ref
Constructor

param: object Reader the StreamReader object
param: boolean enable_cache Enable or disable caching of strings (default on)

load_tables()   X-Ref
Loads the translation tables from the MO file into the cache
If caching is enabled, also loads all strings into a cache
to speed up translation lookups


get_original_string($num)   X-Ref
Returns a string from the "originals" table

param: int num Offset number of original string
return: string Requested string if found, otherwise ''

get_translation_string($num)   X-Ref
Returns a string from the "translations" table

param: int num Offset number of original string
return: string Requested string if found, otherwise ''

find_string($string, $start = -1, $end = -1)   X-Ref
Binary search for string

param: string string
param: int start (internally used in recursive function)
param: int end (internally used in recursive function)
return: int string number (offset in originals table)

translate($string)   X-Ref
Translates a string

param: string string to be translated
return: string translated string (or original, if not found)

get_plural_forms()   X-Ref
Get possible plural forms from MO header

return: string plural form header

select_string($n)   X-Ref
Detects which plural form to take

param: n count
return: int array index of the right plural form

ngettext($single, $plural, $number)   X-Ref
Plural version of gettext

param: string single
param: string plural
param: string number
return: translated plural form



Généré le : Fri Mar 30 19:41:27 2007 par Balluche grâce à PHPXref 0.7