Class TMXResourceBundle
Package: com\tecnick\tmxphpbridge
Author: Nicola Asuni [www.tecnick.com]
Version: 1.1.005
Brief: TMX-PHP Bridge Class
Class:
TMXResourceBundle 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).
Located at shared/code/tce_tmx.php
Methods summary
public |
# __construct(
$tmxfile,
$language, $cachefile =
'' )
Class constructor.
Parameters
- $tmxfile
- TMX (XML) file name
- $language
- ISO language identifier (a two- or three-letter code)
- $cachefile
- set filename for cache (leave blank to exclude cache)
|
public |
# __destruct( )
Class destructor; resets $resource array.
Class destructor; resets $resource array.
|
private |
#
startElementHandler(
$parser, $name,
$attribs )
Sets the start element handler function for the XML parser
parser.start_element_handler.
Sets the start element handler function for the XML parser
parser.start_element_handler.
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser
calling the handler.
- $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.
- $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.
Private
|
private |
#
endElementHandler(
$parser, $name
)
Sets the end element handler function for the XML parser
parser.end_element_handler.
Sets the end element handler function for the XML parser
parser.end_element_handler.
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser
calling the handler.
- $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.
Private
|
private |
#
segContentHandler(
$parser, $data
)
Sets the character data handler function for the XML parser
parser.handler.
Sets the character data handler function for the XML parser
parser.handler.
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser
calling the handler.
- $data
- The second parameter, data, contains the character data as a
string.
Private
|
public Array. |
# getResource( )
Returns the resource array containing the translated
word/sentences.
Returns the resource array containing the translated
word/sentences.
Returns
Array.
|
Properties summary
private array |
$resource
Array used to contain key-translation couples.
Array used to contain key-translation couples.
Private
|
|
private string |
$current_key
String Current tu -> tuid value.
String Current tu -> tuid value.
Private
|
|
private string |
$current_data
String Current data value.
String Current data value.
Private
|
|
private string |
$current_language
String Current tuv -> xml:lang value.
String Current tuv -> xml:lang value.
Private
|
|
private boolean |
$segdata
Boolean value true when we are inside a seg element
Boolean value true when we are inside a seg element
Private
|
|
private string |
$language
String ISO language identifier (a two- or three-letter code)
String ISO language identifier (a two- or three-letter code)
Private
|
|
private string |
$cachefile
String filename for cache
String filename for cache
Private
|
|