UNPKG

@itwin/geo-tools-react

Version:
45 lines 1.92 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { BentleyError, BentleyStatus } from "@itwin/core-bentley"; import { IModelApp } from "@itwin/core-frontend"; /** * Entry point for static initialization required by various components used in the package. * @public */ export class GeoTools { /** * Called by IModelApp to initialize GeoTools * @param i18n - The internationalization service created by the IModelApp. */ static async initialize(i18n) { GeoTools._i18n = i18n !== null && i18n !== void 0 ? i18n : IModelApp.localization; return GeoTools._i18n.registerNamespace(GeoTools.i18nNamespace); } /** Unregisters the GeoTools internationalization service namespace */ static terminate() { if (GeoTools._i18n) GeoTools._i18n.unregisterNamespace(GeoTools.i18nNamespace); GeoTools._i18n = undefined; } /** The internationalization service created by the IModelApp. */ static get i18n() { if (!GeoTools._i18n) throw new BentleyError(BentleyStatus.ERROR, "GeoTools not initialized"); return GeoTools._i18n; } /** The internationalization service namespace. */ static get i18nNamespace() { return "GeoTools"; } static get packageName() { return "geo-tools-react"; } /** Calls i18n.translateWithNamespace with the "GeoTools" namespace. Do NOT include the namespace in the key. */ static translate(key, options) { return GeoTools.i18n.getLocalizedString(`${GeoTools.i18nNamespace}:${key}`, options); } } //# sourceMappingURL=GeoTools.js.map