## Class MessageSource_gettext

Description

MessageSource_gettext class.

Using Gettext MO format as the message source for translation. The gettext classes are based on PEAR's gettext MO and PO classes.

See the MessageSource::factory() method to instantiate this class.

- version: v1.0, last update on Fri Dec 24 16:18:44 EST 2004
- author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /I18N/core/MessageSource_gettext.php (line 42)

    MessageSource
       |
       --MessageSource_gettext

Variable Summary
string $dataExt
string $dataSeparator
string $poExt
Method Summary
MessageSource_gettext __construct (mixed $source)
array catalogues ()
void createMessageTemplate (mixed $catalogue)
boolean delete (string $message, [string $catalogue = 'messages'])
array getCatalogueList (string $catalogue)
array getCatalogues ([mixed $dir = null], [mixed $variant = null])
int getLastModified (string $source)
string getSource (string $variant)
boolean isValidSource (string $filename)
array &loadData (string $filename)
boolean save ([string $catalogue = 'messages'])
boolean update (string $text, string $target, string $comments, [string $catalogue = 'messages'])
Variables
string $dataExt = '.mo' (line 48)

Message data filename extension.

- access: protected

string $dataSeparator = '.' (line 60)

Separator between culture name and source.

- access: protected

string $poExt = '.po' (line 54)

PO data filename extension

- access: protected

#### Inherited Variables

Inherited from MessageSource

> MessageSource::$cache
> MessageSource::$culture
> MessageSource::$messages
> MessageSource::$source
> MessageSource::$untranslated

Methods
Constructor __construct (line 62)
MessageSource_gettext __construct (mixed $source)
catalogues (line 370)

Returns a list of catalogue as key and all it variants as value.

- return: list of catalogues

array catalogues ()
createMessageTemplate (line 424)

- access: protected

void createMessageTemplate (mixed $catalogue)
delete (line 275)

Delete a particular message from the specified catalogue.

- return: true if deleted, false otherwise.

boolean delete (string $message, [string $catalogue = 'messages'])

- string $message: the source message to delete.
- string $catalogue: the catalogue to delete from.

getCatalogueList (line 130)

Get all the variants of a particular catalogue.

- return: list of all variants for this catalogue.
- access: protected

array getCatalogueList (string $catalogue)

- string $catalogue: catalogue name

Redefinition of:

MessageSource::getCatalogueList()
  Get all the variants of a particular catalogue.

getCatalogues (line 381)

Returns a list of catalogue and its culture ID. This takes care of directory structures.

E.g. array('messages','en_AU')

- return: list of catalogues
- access: protected

array getCatalogues ([mixed $dir = null], [mixed $variant = null])
getLastModified (line 117)

Get the last modified unix-time for this particular catalogue+variant.

Just use the file modified time.

- return: last modified in unix-time format.
- access: protected

int getLastModified (string $source)

- string $source: catalogue+variant

Redefinition of:

MessageSource::getLastModified()
  Get the last modified unix-time for this particular catalogue+variant.

getSource (line 106)

Get the MO file for a specific message catalogue and cultural vairant.

- return: full path to the MO file.
- access: protected

string getSource (string $variant)

- string $variant: message catalogue

Redefinition of:

MessageSource::getSource()
  Get the source, this could be a filename or database ID.

isValidSource (line 95)

Determin if the MO file source is valid.

- return: true if valid, false otherwise.
- access: protected

boolean isValidSource (string $filename)

- string $filename: MO file

Redefinition of:

MessageSource::isValidSource()
  Determine if the source is valid.

loadData (line 73)

Load the messages from a MO file.

- return: of messages.
- access: protected

array &loadData (string $filename)

- string $filename: MO file.

Redefinition of:

MessageSource::loadData()
  Load the message for a particular catalogue+variant.

save (line 215)

Save the list of untranslated blocks to the translation source.

If the translation was not found, you should add those strings to the translation source via the append() method.

- return: true if saved successfuly, false otherwise.

boolean save ([string $catalogue = 'messages'])

- string $catalogue: the catalogue to add to

update (line 323)

Update the translation.

- return: true if translation was updated, false otherwise.

boolean update (string $text, string $target, string $comments, [string $catalogue = 'messages'])

- string $text: the source string.
- string $target: the new translation string.
- string $comments: comments
- string $catalogue: the catalogue of the translation.

#### Inherited Methods

Inherited From MessageSource

> MessageSource::append()
> MessageSource::factory()
> MessageSource::getCache()
> MessageSource::getCatalogueList()
> MessageSource::getCulture()
> MessageSource::getLastModified()
> MessageSource::getSource()
> MessageSource::isValidSource()
> MessageSource::load()
> MessageSource::loadData()
> MessageSource::read()
> MessageSource::setCache()
> MessageSource::setCulture()

Documentation generated on Mon, 01 May 2006 23:02:38 -0400 by phpDocumentor 1.3.0RC4