The WebAbility® Network Developers - Documentation
WebAbility Site
\core\WALanguageCompiler Reference

I. Structure:

- namespace:

It is a static class
- Does not have superclass
- Does not have subclasses

II. Description:

This is a static class that contains a method to compile a PHP array from the XML parser, to compile language objects.
Language objects are XML files with the folowing simple structure:

<?xml version="1.0" encoding="UTF-8" ?>
<language id="daysofweek" lang="es">

<entry id="sunday"><![CDATA[Domingo]]></entry>
<entry id="monday"><![CDATA[Lunes]]></entry>
<entry id="tuesday"><![CDATA[Martes]]></entry>
<entry id="wednesday"><![CDATA[Miércoles]]></entry>
<entry id="thursday"><![CDATA[Jueves]]></entry>
<entry id="friday"><![CDATA[Viernes]]></entry>
<entry id="saturday"><![CDATA[Sábado]]></entry>


The language tag have 2 attributes:
- the id of the translation table, it should be the same as the filename containing the XML file.
- the language of this table

Each language entry have an id to refer the translation, and the value itself of the field entry.

The compile function returns an array ready to use.
The array have the following structure:

'sunday' => 'Domingo',
'monday' => 'Lunes',
'tuesday' => 'Martes',
'wednesday' => 'Miércoles',
'thursday' => 'Jueves',
'friday' => 'Viernes',
'saturday' => 'Sábado'

III. Reference:

3.1. Contructor:


3.2. Constants:


3.3. Attributes:

public static $id
Contains the id of the last compiled language

public static $lang
Contains the language of the last compiled language

3.4. Methods:

public array static compile($xml)
This method compiles an XML translation file into a ready-to-use array of values.
  • $xml: XML string to parse with the propper syntax.

public string static create($id, $language, $data)
This method creates back the XML string based on the unique ID $id, the ISO language $language and the data array $data.
  • $id: string, the unique ID of the language table.
  • $language: string, the ISO 2 letters language.
  • $data: array of string => string, the entries of the language table.