@itwin/presentation-frontend
Version:
Frontend of iModel.js Presentation library
32 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FrontendLocalizationHelper = void 0;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
const presentation_common_1 = require("@itwin/presentation-common");
const Presentation_1 = require("./Presentation");
const NAMESPACES = ["Presentation"];
/** @internal */
class FrontendLocalizationHelper extends presentation_common_1.LocalizationHelper {
constructor(lang) {
super({ getLocalizedString: (key) => Presentation_1.Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
this._lang = lang;
}
get locale() {
return this._lang;
}
set locale(locale) {
this._lang = locale;
}
static async registerNamespaces() {
const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_1.Presentation.localization.registerNamespace(namespace));
await Promise.all(localizationPromises);
}
static unregisterNamespaces() {
NAMESPACES.map((namespace) => Presentation_1.Presentation.localization.unregisterNamespace(namespace));
}
}
exports.FrontendLocalizationHelper = FrontendLocalizationHelper;
//# sourceMappingURL=LocalizationHelper.js.map