woltlab-compiler
Version:
A compiler for WoltLab-Package Archives and WoltLab-Package Components
52 lines • 2.22 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const InstructionCompiler_1 = require("./InstructionCompiler");
const LocalizationInstructionCompiler_1 = require("./LocalizationInstructionCompiler");
/**
* Provides the functionality to compile files which provide localizations.
*/
class LocalizationProviderCompiler extends InstructionCompiler_1.InstructionCompiler {
/**
* Initializes a new instance of the `LocalizationProviderCompiler<T>` class.
*
* @param item
* The item to compile.
*/
constructor(item) {
super(item);
}
/**
* @inheritdoc
*/
Serialize() {
let document = super.Serialize();
if (Object.keys(this.Item.GetMessages()).length > 0) {
let childNodes = new LocalizationInstructionCompiler_1.LocalizationInstructionCompiler(this.Item).Serialize().childNodes;
for (let i = 0; i < childNodes.length; i++) {
let node = childNodes.item(i);
document.appendChild(node);
}
}
return document;
}
/**
* @inheritdoc
*/
Compile() {
return __awaiter(this, void 0, void 0, function* () {
let compiler = new LocalizationInstructionCompiler_1.LocalizationInstructionCompiler(this.Item);
compiler.DestinationPath = this.DestinationPath;
yield compiler.Execute();
});
}
}
exports.LocalizationProviderCompiler = LocalizationProviderCompiler;
//# sourceMappingURL=LocalizationProviderCompiler.js.map