## Class TMXResourceBundle

Description

This PHP Class reads resource text data directly from a TMX (XML) file.

First, the XMLTMXResourceBundle class instantiates itself with two parameters: a TMX file name and a target language name. Then, using an XML parser, it reads all of a translation unit's properties for the key information and specified language data and populates the resource array with them (key -> value).

- copyright: Copyright (c) 2004-2006 - Tecnick.com S.r.l (www.tecnick.com) - Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
- version: 1.1.004
- author: Nicola Asuni [www.tecnick.com]
- license: LGPL
- abstract: TMX-PHP Bridge Class
- link: http://tmxphpbridge.sourceforge.net
- name: TMXResourceBundle

Located in /shared/code/tce_tmx.php (line 42)

Variable Summary
string $cachefile
string $current_data
string $current_key
string $current_language
string $language
array $resource
boolean $segdata
Method Summary
TMXResourceBundle __construct (string $tmxfile, string $language, [string $cachefile = ""])
void __destruct ()
void endElementHandler (resource $parser, string $name)
Array. getResource ()
void segContentHandler (resource $parser, string $data)
void startElementHandler (resource $parser, string $name, array $attribs)
Variables
string $cachefile = "" (line 84)

- var: filename for cache
- access: private

string $current_data = "" (line 60)

- var: Current data value.
- access: private

string $current_key = "" (line 54)

- var: Current tu -> tuid value.
- access: private

string $current_language = "" (line 66)

- var: Current tuv -> xml:lang value.
- access: private

string $language = "" (line 78)

- var: ISO language identifier (a two- or three-letter code)
- access: private

array $resource = array() (line 48)

- var: Array used to contain key-translation couples.
- access: private

boolean $segdata = false (line 72)

- var: Is TRUE when we are inside a seg element
- access: private

Methods
Constructor __construct (line 92)

Class constructor.

- access: public

TMXResourceBundle __construct (string $tmxfile, string $language, [string $cachefile = ""])

- string $tmxfile: TMX (XML) file name
- string $language: ISO language identifier (a two- or three-letter code)
- string $cachefile: set filename for cache (leave blank to exclude cache)

Destructor __destruct (line 141)

Class destructor; resets $resource array.

- access: public

void __destruct ()
endElementHandler (line 186)

Sets the end element handler function for the XML parser parser.end_element_handler.

- access: private

void endElementHandler (resource $parser, string $name)

- resource $parser: The first parameter, parser, is a reference to the XML parser calling the handler.
- string $name: The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.

getResource (line 236)

Returns the resource array containing the translated word/sentences.

- access: public

Array. getResource ()
segContentHandler (line 222)

Sets the character data handler function for the XML parser parser.handler.

- access: private

void segContentHandler (resource $parser, string $data)

- resource $parser: The first parameter, parser, is a reference to the XML parser calling the handler.
- string $data: The second parameter, data, contains the character data as a string.

startElementHandler (line 152)

Sets the start element handler function for the XML parser parser.start_element_handler.

- access: private

void startElementHandler (resource $parser, string $name, array $attribs)

- resource $parser: The first parameter, parser, is a reference to the XML parser calling the handler.
- string $name: The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
- array $attribs: The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.

Documentation generated on Fri, 24 Nov 2006 21:16:35 +0100 by phpDocumentor 1.3.0RC3