UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

54 lines 1.3 kB
/** * Represents a localization. */ export class Localization { /** * Initializes a new instance of the {@link Localization `Localization`} class. */ constructor() { /** * The translations of this localization mapped to their corresponding locale. */ this.data = new Map(); } /** * Gets the translations of this localization mapped to their corresponding locale. */ get Data() { return this.data; } /** * Loads localizations from the {@link values `values`}. * * @param values * The values to load. */ Load(values) { for (let key of Object.keys(values)) { this.Data.set(key, values[key]); } } /** * Gets the locales of the translations. * * @returns * The locales of the localization. */ GetLocales() { return Array.from(this.Data.keys()); } /** * Creates an object which represents this localization. * * @returns * An object which represents this localization. */ ToJSON() { let result = {}; for (let key of this.Data.keys()) { result[key] = this.Data.get(key); } return result; } } //# sourceMappingURL=Localization.js.map