classes-TMXResourceBundle

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

brief

TMX-PHP Bridge Class

author

Nicola Asuni [www.tecnick.com]

version
1.1.005

Table of Contents

Properties

$parser  : mixed
$cachefile  : mixed
String filename for cache
$current_data  : string
String Current data value.
$current_key  : mixed
String Current tu -> tuid value.
$current_language  : string
String Current tuv -> xml:lang value.
$language  : string
String ISO language identifier (a two- or three-letter code)
$resource  : array<string|int, mixed>
Array used to contain key-translation couples.
$segdata  : bool
Boolean value true when we are inside a seg element

Methods

__construct()  : mixed
Class constructor.
__destruct()  : mixed
Class destructor; resets $resource array.
getResource()  : array<string|int, mixed>
Returns the resource array containing the translated word/sentences.
endElementHandler()  : mixed
Sets the end element handler function for the XML parser parser.end_element_handler.
segContentHandler()  : mixed
Sets the character data handler function for the XML parser parser.handler.
startElementHandler()  : mixed
Sets the start element handler function for the XML parser parser.start_element_handler.

Properties

$cachefile

String filename for cache

private mixed $cachefile = ''
Tags
private

$current_data

String Current data value.

private string $current_data = ''
Tags
private

$current_key

String Current tu -> tuid value.

private mixed $current_key = ''
Tags
private

$current_language

String Current tuv -> xml:lang value.

private string $current_language = ''
Tags
private

$language

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

private string $language = ''
Tags
private

$resource

Array used to contain key-translation couples.

private array<string|int, mixed> $resource = []
Tags
private

$segdata

Boolean value true when we are inside a seg element

private bool $segdata = \false
Tags
private

Methods

__construct()

Class constructor.

public __construct( $tmxfile,  $language[,  $cachefile = '' ]) : mixed
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)

__destruct()

Class destructor; resets $resource array.

public __destruct() : mixed

getResource()

Returns the resource array containing the translated word/sentences.

public getResource() : array<string|int, mixed>
Return values
array<string|int, mixed>

endElementHandler()

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

private endElementHandler( $parser,  $name) : mixed
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.

Tags
private

segContentHandler()

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

private segContentHandler( $parser,  $data) : mixed
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.

Tags
private

startElementHandler()

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

private startElementHandler( $parser,  $name,  $attribs) : mixed
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.

Tags
private
On this page
 

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