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;
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();
52 return 'Build an XML file - schema available at http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd';
Base class for all the exporters.
static toStringDo($languages)