@itwin/geo-tools-react
Version:
React Geospatial Tools
49 lines • 2.09 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeoTools = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
const core_frontend_1 = require("@itwin/core-frontend");
/**
* Entry point for static initialization required by various components used in the package.
* @public
*/
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 : core_frontend_1.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 core_bentley_1.BentleyError(core_bentley_1.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);
}
}
exports.GeoTools = GeoTools;
//# sourceMappingURL=GeoTools.js.map