Definition at line 4 of file Xml.php.
◆ getDescription()
static Gettext\Languages\Exporter\Xml::getDescription |
( |
| ) |
|
|
static |
- See also
- Exporter::getDescription
Definition at line 50 of file Xml.php.
52 return 'Build an XML file - schema available at http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd';
◆ toStringDo()
static Gettext\Languages\Exporter\Xml::toStringDo |
( |
|
$languages | ) |
|
|
staticprotected |
- See also
- Exporter::toStringDo
Definition at line 9 of file Xml.php.
References $xml.
11 $xml = new \DOMDocument(
'1.0',
'UTF-8');
12 $xml->loadXML(
'<languages 13 xmlns="https://github.com/mlocati/cldr-to-gettext-plural-rules" 14 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 15 xsi:schemaLocation="https://github.com/mlocati/cldr-to-gettext-plural-rules http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd" 17 $xLanguages =
$xml->firstChild;
18 foreach ($languages as $language) {
19 $xLanguage =
$xml->createElement(
'language');
20 $xLanguage->setAttribute(
'id', $language->id);
21 $xLanguage->setAttribute(
'name', $language->name);
22 if (isset($language->supersededBy)) {
23 $xLanguage->setAttribute(
'supersededBy', $language->supersededBy);
25 if (isset($language->script)) {
26 $xLanguage->setAttribute(
'script', $language->script);
28 if (isset($language->territory)) {
29 $xLanguage->setAttribute(
'territory', $language->territory);
31 if (isset($language->baseLanguage)) {
32 $xLanguage->setAttribute(
'baseLanguage', $language->baseLanguage);
34 $xLanguage->setAttribute(
'formula', $language->formula);
35 foreach ($language->categories as $category) {
36 $xCategory =
$xml->createElement(
'category');
37 $xCategory->setAttribute(
'id', $category->id);
38 $xCategory->setAttribute(
'examples', $category->examples);
39 $xLanguage->appendChild($xCategory);
41 $xLanguages->appendChild($xLanguage);
43 $xml->formatOutput =
true;
45 return $xml->saveXML();
The documentation for this class was generated from the following file:
- libs/composer/vendor/gettext/languages/src/Exporter/Xml.php