classTMXResourceBundle

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

Public Member Functions

 construct ($tmxfile, $language, $cachefile=“)
 
 destruct ()
 
 getResource ()
 

Private Member Functions

 startElementHandler ($parser, $name, $attribs)
 
 endElementHandler ($parser, $name)
 
 segContentHandler ($parser, $data)
 

Private Attributes

 $resource = array()
 
 $current_key = “
 
 $current_data = “
 
 $current_language = “
 
 $segdata = false
 
 $language = “
 
 $cachefile = “
 

Detailed 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).

Constructor & Destructor Documentation

TMXResourceBundle::__construct (   $tmxfile,
  $language,
  $cachefile =  
)

Class constructor.

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

TMXResourceBundle::__destruct ( )

Class destructor; resets $resource array.

Member Function Documentation

TMXResourceBundle::endElementHandler (   $parser,
  $name 
)
private

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

Parameters
$parser(resource) The first parameter, parser, is a reference to the XML parser calling the handler.
$name(string) 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.

TMXResourceBundle::getResource ( )

Returns the resource array containing the translated word/sentences.

Returns
Array.

TMXResourceBundle::segContentHandler (   $parser,
  $data 
)
private

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

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

TMXResourceBundle::startElementHandler (   $parser,
  $name,
  $attribs 
)
private

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

Parameters
$parser(resource) The first parameter, parser, is a reference to the XML parser calling the handler.
$name(string) 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(array) 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.

Member Data Documentation

TMXResourceBundle::$cachefile = “
private

String filename for cache

TMXResourceBundle::$current_data = “
private

String Current data value.

TMXResourceBundle::$current_key = “
private

String Current tu -> tuid value.

TMXResourceBundle::$current_language = “
private

String Current tuv -> xml:lang value.

TMXResourceBundle::$language = “
private

String ISO language identifier (a two- or three-letter code)

TMXResourceBundle::$resource = array()
private

Array used to contain key-translation couples.

TMXResourceBundle::$segdata = false
private

Boolean value true when we are inside a seg element


The documentation for this class was generated from the following file:
  • /home/nick/WWW/_OPENSOURCE/TCExam/shared/code/tce_tmx.php

 

© 2004-2017 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy