UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

49 lines 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const XMLEditor_1 = require("../../Serialization/XMLEditor"); const WoltLabXMLCompiler_1 = require("../WoltLabXMLCompiler"); /** * Provides the functionality to compile localization-files. */ class LocalizationFileCompiler extends WoltLabXMLCompiler_1.WoltLabXMLCompiler { /** * Initializes a new instance of the `LocalizationFileCompiler` class. * * @param item * The item to compile. */ constructor(item) { super(item); } /** * @inheritdoc */ get TagName() { return "language"; } /** * @inheritdoc */ get SchemaLocation() { return "http://www.woltlab.com/XSD/tornado/language.xsd"; } /** * @inheritdoc */ CreateDocument() { let document = super.CreateDocument(); let editor = new XMLEditor_1.XMLEditor(document.documentElement); editor.SetAttribute("languagecode", this.Item[0]); for (let categoryName of Object.keys(this.Item[1])) { editor.AddElement("category", (category) => { category.SetAttribute("name", categoryName); for (let messageName of Object.keys(this.Item[1][categoryName])) { category.AddCDATAElement("item", this.Item[1][categoryName][messageName], (item) => item.SetAttribute("name", messageName)); } }); } return document; } } exports.LocalizationFileCompiler = LocalizationFileCompiler; //# sourceMappingURL=LocalizationFileCompiler.js.map