## Class MessageSource_XLIFF

Description

MessageSource_XLIFF class.

Using XML XLIFF format as the message source for translation. Details and example of XLIFF can be found in the following URLs.

- http://www.opentag.com/xliff.htm
- http://www-106.ibm.com/developerworks/xml/library/x-localis2/

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_XLIFF.php (line 40)

    MessageSource
       |
       --MessageSource_XLIFF

Variable Summary
string $dataExt
string $dataSeparator
Method Summary
MessageSource_XLIFF __construct (string $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)
void getTemplate (mixed $catalogue)
boolean isValidSource (string $source)
array &loadData (string $filename)
boolean save ([string $catalogue = 'messages'])
boolean update (string $text, string $target, string $comments, [string $catalogue = 'messages'])
Variables
string $dataExt = '.xml' (line 46)

Message data filename extension.

- access: protected

string $dataSeparator = '.' (line 52)

Separator between culture name and source.

- access: protected

#### Inherited Variables

Inherited from MessageSource

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

Methods
Constructor __construct (line 59)

Constructor.

- see: MessageSource::factory();

MessageSource_XLIFF __construct (string $source)

- string $source: the directory where the messages are stored.

catalogues (line 187)

Returns a list of catalogue and its culture ID.

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

- return: list of catalogues
- access: public
- see: MessageSource_XLIFF::getCatalogues()

array catalogues ()
createMessageTemplate (line 468)

- access: protected

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

Delete a particular message from the specified catalogue.

- return: true if deleted, false otherwise.
- access: public

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

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

getCatalogueList (line 132)

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 198)

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 98)

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 112)

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

- return: full path to the XLIFF 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.

getTemplate (line 483)

- access: protected

void getTemplate (mixed $catalogue)
isValidSource (line 122)

Determin if the XLIFF file source is valid.

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

boolean isValidSource (string $source)

- string $source: XLIFF file

Redefinition of:

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

loadData (line 69)

Load the messages from a XLIFF file.

- return: of messages.
- access: protected

array &loadData (string $filename)

- string $filename: XLIFF file.

Redefinition of:

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

save (line 267)

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.
- access: public

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

- string $catalogue: the catalogue to add to

update (line 331)

Update the translation.

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

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 to save to.

#### 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 Sun, 04 Jun 2006 18:58:30 -0400 by phpDocumentor 1.3.0RC4