## Class TGettext

Description

File_Gettext

GNU gettext file reader and writer.

#################################################################

- All protected members of this class are public in its childs. #
- ################################################################

- access: public
- version: $Revision: 1.4 $
- author: Michael Wallner <mike@php.net>

Located in /I18N/core/Gettext/TGettext.php (line 59)

Direct descendents

Class | Description
--- | ---
TGettext_MO | File_Gettext_MO
TGettext_PO | File_Gettext_PO

Variable Summary
string $file
array $meta
array $strings
Method Summary
object Returns factory (string $format, [string $file = ''])
bool fromArray (array $array)
array meta2array (string $meta)
mixed poFile2moFile (string $pofile, string $mofile)
string prepare (string $string, [bool $reverse = false])
array toArray ()
object File_Gettext_MO toMO ()
object File_Gettext_PO toPO ()
Variables
string $file = '' (line 88)

file path

- access: protected

array $meta = array() (line 80)

meta

associative array containing meta information like project name or content type

- access: protected

array $strings = array() (line 69)

strings

associative array with all [msgid => msgstr] entries

- access: protected

Methods
factory (line 100)

Factory

- return: File_Gettext_PO or File_Gettext_MO on success or PEAR_Error on failure.
- access: public
- static:

object Returns factory (string $format, [string $file = ''])

- string $format: MO or PO
- string $file: path to GNU gettext file

fromArray (line 244)

fromArray

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 <mike@iworks.at>',
               'PO-Revision-Date'  => date('Y-m-d H:iO'),
               'Language-Team'     => 'German <mail@example.com>',
           ),
           'strings' => array(
               'All rights reserved'   => 'Alle Rechte vorbehalten',
               'Welcome'               => 'Willkommen',
               // ...
                  )
       )

- access: protected
- see: TGettext::toArray()

bool fromArray (array $array)

- array $array

meta2array (line 178)

meta2array

- access: public
- static:

array meta2array (string $meta)

- string $meta

poFile2moFile (line 125)

poFile2moFile

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.

- return: Returns true on success or PEAR_Error on failure.
- access: public
- static:

mixed poFile2moFile (string $pofile, string $mofile)

- string $pofile: path to GNU PO file
- string $mofile: path to GNU MO file

prepare (line 156)

prepare

- access: protected
- static:

string prepare (string $string, [bool $reverse = false])

- string $string
- bool $reverse

toArray (line 214)

toArray

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 <mike@iworks.at>',
               'PO-Revision-Date'  => '2004-07-21 17:03+0200',
               'Language-Team'     => 'German <mail@example.com>',
           ),
           'strings' => array(
               'All rights reserved'   => 'Alle Rechte vorbehalten',
               'Welcome'               => 'Willkommen',
               // ...
                  )
       )

- access: protected
- see: TGettext::fromArray()

array toArray ()
toMO (line 265)

toMO

- access: protected

object File_Gettext_MO toMO ()
toPO (line 279)

toPO

- access: protected

object File_Gettext_PO toPO ()

Documentation generated on Sun, 04 Jun 2006 18:59:24 -0400 by phpDocumentor 1.3.0RC4