System.I18N.core
[ class tree: System.I18N.core ] [ index: System.I18N.core ] [ all elements ]

Class: MessageSource_XLIFF

Source Location: /I18N/core/MessageSource_XLIFF.php

Class Overview

MessageSource
   |
   --MessageSource_XLIFF

MessageSource_XLIFF class.

Class Details

[line 40]
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>


[ Top ]

Variables

Methods


Inherited Variables

Inherited Methods

Class: MessageSource

MessageSource::append()
Add a untranslated message to the source. Need to call save() to save the messages to source.
MessageSource::factory()
Factory method to instantiate a new MessageSource depending on the
MessageSource::getCache()
Get the cache handler for this source.
MessageSource::getCatalogueList()
Get all the variants of a particular catalogue.
MessageSource::getCulture()
Get the culture identifier for the source.
MessageSource::getLastModified()
Get the last modified unix-time for this particular catalogue+variant.
MessageSource::getSource()
Get the source, this could be a filename or database ID.
MessageSource::isValidSource()
Determine if the source is valid.
MessageSource::load()
Load a particular message catalogue. Use read() to to get the array of messages. The catalogue loading sequence is as follows
MessageSource::loadData()
Load the message for a particular catalogue+variant.
MessageSource::read()
Get the array of messages.
MessageSource::setCache()
Set the cache handler for caching the messages.
MessageSource::setCulture()
Set the culture for this message source.

Class Variables

$dataExt =  '.xml'

[line 46]

Message data filename extension.



access:  protected

Type:   string


[ Top ]

$dataSeparator =  '.'

[line 52]

Separator between culture name and source.



access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 59]

MessageSource_XLIFF __construct( string $source)

Constructor.



see:  MessageSource::factory();


Parameters:

string   $source   the directory where the messages are stored.

[ Top ]

method catalogues [line 186]

array catalogues( )

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


[ Top ]

method delete [line 412]

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

Delete a particular message from the specified catalogue.



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


Parameters:

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

[ Top ]

method getCatalogueList [line 131]

array getCatalogueList( string $catalogue)

Get all the variants of a particular catalogue.



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


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

Parameters:

string   $catalogue   catalogue name

[ Top ]

method getCatalogues [line 197]

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

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


[ Top ]

method getLastModified [line 97]

int getLastModified( string $source)

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


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

Parameters:

string   $source   catalogue+variant

[ Top ]

method getSource [line 111]

string getSource( string $variant)

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



return:  full path to the XLIFF file.
access:  protected


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

Parameters:

string   $variant   message catalogue

[ Top ]

method isValidSource [line 121]

boolean isValidSource( string $source)

Determin if the XLIFF file source is valid.



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


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

Parameters:

string   $source   XLIFF file

[ Top ]

method loadData [line 69]

array &loadData( string $filename)

Load the messages from a XLIFF file.



return:  of messages.
access:  protected


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

Parameters:

string   $filename   XLIFF file.

[ Top ]

method save [line 266]

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

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


Parameters:

string   $catalogue   the catalogue to add to

[ Top ]

method update [line 328]

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

Update the translation.



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


Parameters:

string   $text   the source string.
string   $target   the new translation string.
string   $comments   comments
string   $catalogue   the catalogue to save to.

[ Top ]


© 2004-2005 PRADO Software Group. All Rights Reserved.