PHP Class Prado\I18N\core\Gettext\TGettext

GNU gettext file reader and writer. ################################################################# # All protected members of this class are public in its childs. # #################################################################
Author: Michael Wallner ([email protected])
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Protected Properties

Свойство Type Description
$file string file path
$meta array associative array containing meta information like project name or content type
$strings array associative array with all [msgid => msgstr] entries

Méthodes publiques

Méthode Description
factory ( string $format, string $file = '' ) : object Factory
fromArray ( array $array ) : boolean fromArray
meta2array ( string $meta ) : array meta2array
poFile2moFile ( string $pofile, string $mofile ) : mixed poFile2moFile
prepare ( string $string, boolean $reverse = false ) : string prepare
toArray ( ) : array toArray
toMO ( ) : object toMO
toPO ( ) : object toPO

Method Details

factory() static public méthode

Factory
static public factory ( string $format, string $file = '' ) : object
$format string MO or PO
$file string path to GNU gettext file
Résultat object Returns File_Gettext_PO or File_Gettext_MO on success or PEAR_Error on failure.

fromArray() public méthode

Assigns meta info and strings from an array of a structure like that: array( 'meta' => array( 'Content-Type' => 'text/plain; charset=iso-8859-1', 'Last-Translator' => 'Michael Wallner ', 'PO-Revision-Date' => date('Y-m-d H:iO'), 'Language-Team' => 'German ', ), 'strings' => array( 'All rights reserved' => 'Alle Rechte vorbehalten', 'Welcome' => 'Willkommen', ... ) )
See also: toArray()
public fromArray ( array $array ) : boolean
$array array
Résultat boolean

meta2array() static public méthode

meta2array
static public meta2array ( string $meta ) : array
$meta string
Résultat array

poFile2moFile() static public méthode

That's a simple fake of the 'msgfmt' console command. It reads the contents of a GNU PO file and saves them to a GNU MO file.
static public poFile2moFile ( string $pofile, string $mofile ) : mixed
$pofile string path to GNU PO file
$mofile string path to GNU MO file
Résultat mixed Returns true on success or PEAR_Error on failure.

prepare() static public méthode

prepare
static public prepare ( string $string, boolean $reverse = false ) : string
$string string
$reverse boolean
Résultat string

toArray() public méthode

Returns meta info and strings as an array of a structure like that: array( 'meta' => array( 'Content-Type' => 'text/plain; charset=iso-8859-1', 'Last-Translator' => 'Michael Wallner ', 'PO-Revision-Date' => '2004-07-21 17:03+0200', 'Language-Team' => 'German ', ), 'strings' => array( 'All rights reserved' => 'Alle Rechte vorbehalten', 'Welcome' => 'Willkommen', ... ) )
See also: fromArray()
public toArray ( ) : array
Résultat array

toMO() public méthode

toMO
public toMO ( ) : object
Résultat object File_Gettext_MO

toPO() public méthode

toPO
public toPO ( ) : object
Résultat object File_Gettext_PO

Property Details

$file protected_oe property

file path
protected string $file
Résultat string

$meta protected_oe property

associative array containing meta information like project name or content type
protected array $meta
Résultat array

$strings protected_oe property

associative array with all [msgid => msgstr] entries
protected array $strings
Résultat array