UNPKG

dotcms

Version:

This library allows you to interact with DotCMS API's easily from the browser, nodejs and React Native. [Full Documentation](https://dotcms.github.io/core-web/dotcms/)

33 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DotApiLanguage = void 0; const tslib_1 = require("tslib"); /** * Get DotCMS {@link https://dotcms.com/docs/latest/adding-and-editing-languages | Language code} * */ class DotApiLanguage { constructor(appConfig) { this.dotAppConfig = appConfig; } getId(langCode) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const languages = yield this.getLanguages(); const language = languages.find((lang) => lang.languageCode === langCode); return language ? `${language.id}` : null; }); } getLanguages() { return tslib_1.__awaiter(this, void 0, void 0, function* () { if (this._languagesConf) { return this._languagesConf; } this._languagesConf = yield this.dotAppConfig .get() .then((data) => data.languages); return this._languagesConf; }); } } exports.DotApiLanguage = DotApiLanguage; //# sourceMappingURL=DotApiLanguage.js.map