@itwin/core-i18n 3.5.0-dev.41 → 3.5.0-dev.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log - @itwin/core-i18n
2
2
 
3
- This log was last generated on Fri, 28 Oct 2022 13:34:58 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 10 Nov 2022 19:32:17 GMT and should not be manually modified.
4
+
5
+ ## 3.4.4
6
+ Thu, 10 Nov 2022 19:32:17 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 3.4.3
6
11
  Fri, 28 Oct 2022 13:34:58 GMT
@@ -17,13 +17,13 @@
17
17
  /** @packageDocumentation
18
18
  * @module Localization
19
19
  */
20
- function cov_29ajiy3676() {
21
- var path = "D:\\vsts_a\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js";
22
- var hash = "be2d8a08e869fabc8666746e21ee168c9193d978";
20
+ function cov_yuojz2wow() {
21
+ var path = "D:\\vsts_b\\926\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js";
22
+ var hash = "868be1042b84e02845fb04fc9018d5c17291305c";
23
23
  var global = new Function("return this")();
24
24
  var gcv = "__coverage__";
25
25
  var coverageData = {
26
- path: "D:\\vsts_a\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js",
26
+ path: "D:\\vsts_b\\926\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js",
27
27
  statementMap: {
28
28
  "0": {
29
29
  start: {
@@ -3075,13 +3075,13 @@ function cov_29ajiy3676() {
3075
3075
  inputSourceMap: {
3076
3076
  version: 3,
3077
3077
  file: "ITwinLocalization.js",
3078
- sources: ["D:\\vsts_a\\1\\s\\core\\i18n\\src\\ITwinLocalization.ts"],
3078
+ sources: ["D:\\vsts_b\\926\\s\\core\\i18n\\src\\ITwinLocalization.ts"],
3079
3079
  names: [],
3080
3080
  mappings: ";AAAA;;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O,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;gBAC7B,OAAO,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/B;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;;AAXsB,sBAAI,GAAG,QAAQ,CAAC",
3081
3081
  sourcesContent: ["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Localization\r\n */\r\n\r\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\r\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\r\nimport Backend, { BackendOptions } from \"i18next-http-backend\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport type { Localization } from \"@itwin/core-common\";\r\n\r\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\r\n\r\n/** Options for ITwinLocalization\r\n * @public\r\n */\r\nexport interface LocalizationOptions {\r\n urlTemplate?: string;\r\n backendPlugin?: Module;\r\n detectorPlugin?: Module;\r\n initOptions?: InitOptions;\r\n backendHttpOptions?: BackendOptions;\r\n detectorOptions?: DetectorOptions;\r\n}\r\n\r\n/** Supplies localizations for iTwin.js\r\n * @note this class uses the [i18next](https://www.i18next.com/) package.\r\n * @public\r\n */\r\nexport class ITwinLocalization implements Localization {\r\n public i18next: i18n;\r\n private readonly _initOptions: InitOptions;\r\n private readonly _backendOptions: BackendOptions;\r\n private readonly _detectionOptions: DetectorOptions;\r\n private readonly _namespaces = new Map<string, Promise<void>>();\r\n\r\n public constructor(options?: LocalizationOptions) {\r\n this.i18next = i18next.createInstance();\r\n\r\n this._backendOptions = {\r\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\r\n crossDomain: true,\r\n ...options?.backendHttpOptions,\r\n };\r\n\r\n this._detectionOptions = {\r\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\r\n lookupQuerystring: \"lng\",\r\n caches: [],\r\n ...options?.detectorOptions,\r\n };\r\n\r\n this._initOptions = {\r\n interpolation: { escapeValue: true },\r\n fallbackLng: \"en\",\r\n maxRetries: DEFAULT_MAX_RETRIES,\r\n backend: this._backendOptions,\r\n detection: this._detectionOptions,\r\n ...options?.initOptions,\r\n };\r\n\r\n this.i18next\r\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\r\n .use(options?.backendPlugin ?? Backend)\r\n .use(TranslationLogger);\r\n }\r\n\r\n public async initialize(namespaces: string[]): Promise<void> {\r\n\r\n // Also consider namespaces passed into constructor\r\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\r\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\r\n\r\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\r\n if (defaultNamespace)\r\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\r\n\r\n const initOptions: InitOptions = {\r\n ...this._initOptions,\r\n defaultNS: defaultNamespace,\r\n ns: [...combinedNamespaces],\r\n };\r\n\r\n // if in a development environment, set debugging\r\n if (process.env.NODE_ENV === \"development\")\r\n initOptions.debug = true;\r\n\r\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\r\n\r\n for (const ns of namespaces)\r\n this._namespaces.set(ns, initPromise);\r\n\r\n return initPromise;\r\n }\r\n\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n * @param line The input line, potentially containing %{keys}.\r\n * @returns The line with all %{keys} translated\r\n * @public\r\n */\r\n public getLocalizedKeys(line: string): string {\r\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\r\n }\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @public\r\n */\r\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const value = this.i18next.t(key, options);\r\n\r\n if (typeof value !== \"string\") {\r\n throw new Error(\"Translation key(s) string not found\");\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n let fullKey: string | string[] = \"\";\r\n\r\n if (typeof key === \"string\") {\r\n fullKey = `${namespace}:${key}`;\r\n } else {\r\n fullKey = key.map((subKey: string) => {\r\n return `${namespace}:${subKey}`;\r\n });\r\n }\r\n\r\n return this.getLocalizedString(fullKey, options);\r\n }\r\n\r\n /** Gets the English translation.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const en = this.i18next.getFixedT(\"en\", namespace);\r\n const str = en(key, options);\r\n if (typeof str !== \"string\")\r\n throw new Error(\"Translation key(s) not found\");\r\n\r\n return str;\r\n }\r\n\r\n /** Get the promise for an already registered Namespace.\r\n * @param name - the name of the namespace\r\n * @public\r\n */\r\n public getNamespacePromise(name: string): Promise<void> | undefined {\r\n return this._namespaces.get(name);\r\n }\r\n\r\n /** @internal */\r\n public getLanguageList(): readonly string[] {\r\n return this.i18next.languages;\r\n }\r\n\r\n /** override the language detected in the browser */\r\n public async changeLanguage(language: string) {\r\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\r\n }\r\n\r\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\r\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n * @public\r\n */\r\n public async registerNamespace(name: string): Promise<void> {\r\n const existing = this._namespaces.get(name);\r\n if (existing !== undefined)\r\n return existing;\r\n\r\n const theReadPromise = new Promise<void>((resolve) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.i18next.loadNamespaces(name, (err) => {\r\n if (!err)\r\n return resolve();\r\n\r\n // Here we got a non-null err object.\r\n // This method is called when the system has attempted to load the resources for the namespaces for each possible locale.\r\n // For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.\r\n // Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.\r\n // There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.\r\n let locales = this.getLanguageList().map((thisLocale: any) => `/${thisLocale}/`);\r\n\r\n try {\r\n for (const thisError of err) {\r\n if (typeof thisError === \"string\")\r\n locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));\r\n }\r\n } catch (e) {\r\n locales = [];\r\n }\r\n // if we removed every locale from the array, it wasn't loaded.\r\n if (locales.length === 0)\r\n Logger.logError(\"i18n\", `No resources for namespace ${name} could be loaded`);\r\n\r\n resolve();\r\n });\r\n });\r\n this._namespaces.set(name, theReadPromise);\r\n return theReadPromise;\r\n }\r\n\r\n /** @internal */\r\n public unregisterNamespace(name: string): void {\r\n this._namespaces.delete(name);\r\n }\r\n}\r\n\r\nclass TranslationLogger {\r\n public static readonly type = \"logger\";\r\n public log(args: string[]) { Logger.logInfo(\"i18n\", this.createLogMessage(args)); }\r\n public warn(args: string[]) { Logger.logWarning(\"i18n\", this.createLogMessage(args)); }\r\n public error(args: string[]) { Logger.logError(\"i18n\", this.createLogMessage(args)); }\r\n private createLogMessage(args: string[]) {\r\n let message = args[0];\r\n for (let i = 1; i < args.length; ++i) {\r\n if (typeof args[i] === \"string\")\r\n message += `\\n ${args[i]}`;\r\n }\r\n return message;\r\n }\r\n}\r\n"]
3082
3082
  },
3083
3083
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
3084
- hash: "be2d8a08e869fabc8666746e21ee168c9193d978"
3084
+ hash: "868be1042b84e02845fb04fc9018d5c17291305c"
3085
3085
  };
3086
3086
  var coverage = global[gcv] || (global[gcv] = {});
3087
3087
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -3090,57 +3090,57 @@ function cov_29ajiy3676() {
3090
3090
  var actualCoverage = coverage[path];
3091
3091
  {
3092
3092
  // @ts-ignore
3093
- cov_29ajiy3676 = function () {
3093
+ cov_yuojz2wow = function () {
3094
3094
  return actualCoverage;
3095
3095
  };
3096
3096
  }
3097
3097
  return actualCoverage;
3098
3098
  }
3099
- cov_29ajiy3676();
3100
- var __importDefault = (cov_29ajiy3676().s[0]++, (cov_29ajiy3676().b[0][0]++, this) && (cov_29ajiy3676().b[0][1]++, this.__importDefault) || (cov_29ajiy3676().b[0][2]++, function (mod) {
3101
- cov_29ajiy3676().f[0]++;
3102
- cov_29ajiy3676().s[1]++;
3103
- return (cov_29ajiy3676().b[2][0]++, mod) && (cov_29ajiy3676().b[2][1]++, mod.__esModule) ? (cov_29ajiy3676().b[1][0]++, mod) : (cov_29ajiy3676().b[1][1]++, {
3099
+ cov_yuojz2wow();
3100
+ var __importDefault = (cov_yuojz2wow().s[0]++, (cov_yuojz2wow().b[0][0]++, this) && (cov_yuojz2wow().b[0][1]++, this.__importDefault) || (cov_yuojz2wow().b[0][2]++, function (mod) {
3101
+ cov_yuojz2wow().f[0]++;
3102
+ cov_yuojz2wow().s[1]++;
3103
+ return (cov_yuojz2wow().b[2][0]++, mod) && (cov_yuojz2wow().b[2][1]++, mod.__esModule) ? (cov_yuojz2wow().b[1][0]++, mod) : (cov_yuojz2wow().b[1][1]++, {
3104
3104
  "default": mod
3105
3105
  });
3106
3106
  }));
3107
- cov_29ajiy3676().s[2]++;
3107
+ cov_yuojz2wow().s[2]++;
3108
3108
  Object.defineProperty(exports, "__esModule", ({
3109
3109
  value: true
3110
3110
  }));
3111
- cov_29ajiy3676().s[3]++;
3111
+ cov_yuojz2wow().s[3]++;
3112
3112
  exports.ITwinLocalization = void 0;
3113
- const i18next_1 = (cov_29ajiy3676().s[4]++, __importDefault(__webpack_require__(/*! i18next */ "../../common/temp/node_modules/.pnpm/i18next@21.10.0/node_modules/i18next/dist/cjs/i18next.js")));
3114
- const i18next_browser_languagedetector_1 = (cov_29ajiy3676().s[5]++, __importDefault(__webpack_require__(/*! i18next-browser-languagedetector */ "../../common/temp/node_modules/.pnpm/i18next-browser-languagedetector@6.1.8/node_modules/i18next-browser-languagedetector/dist/cjs/i18nextBrowserLanguageDetector.js")));
3115
- const i18next_http_backend_1 = (cov_29ajiy3676().s[6]++, __importDefault(__webpack_require__(/*! i18next-http-backend */ "../../common/temp/node_modules/.pnpm/i18next-http-backend@1.4.5/node_modules/i18next-http-backend/cjs/index.js")));
3116
- const core_bentley_1 = (cov_29ajiy3676().s[7]++, __webpack_require__(/*! @itwin/core-bentley */ "../bentley/lib/esm/core-bentley.js"));
3117
- const DEFAULT_MAX_RETRIES = (cov_29ajiy3676().s[8]++, 1); // a low number prevents wasted time and potential timeouts when requesting localization files throws an error
3113
+ const i18next_1 = (cov_yuojz2wow().s[4]++, __importDefault(__webpack_require__(/*! i18next */ "../../common/temp/node_modules/.pnpm/i18next@21.10.0/node_modules/i18next/dist/cjs/i18next.js")));
3114
+ const i18next_browser_languagedetector_1 = (cov_yuojz2wow().s[5]++, __importDefault(__webpack_require__(/*! i18next-browser-languagedetector */ "../../common/temp/node_modules/.pnpm/i18next-browser-languagedetector@6.1.8/node_modules/i18next-browser-languagedetector/dist/cjs/i18nextBrowserLanguageDetector.js")));
3115
+ const i18next_http_backend_1 = (cov_yuojz2wow().s[6]++, __importDefault(__webpack_require__(/*! i18next-http-backend */ "../../common/temp/node_modules/.pnpm/i18next-http-backend@1.4.5/node_modules/i18next-http-backend/cjs/index.js")));
3116
+ const core_bentley_1 = (cov_yuojz2wow().s[7]++, __webpack_require__(/*! @itwin/core-bentley */ "../bentley/lib/esm/core-bentley.js"));
3117
+ const DEFAULT_MAX_RETRIES = (cov_yuojz2wow().s[8]++, 1); // a low number prevents wasted time and potential timeouts when requesting localization files throws an error
3118
3118
  /** Supplies localizations for iTwin.js
3119
3119
  * @note this class uses the [i18next](https://www.i18next.com/) package.
3120
3120
  * @public
3121
3121
  */
3122
3122
  class ITwinLocalization {
3123
3123
  constructor(options) {
3124
- cov_29ajiy3676().f[1]++;
3124
+ cov_yuojz2wow().f[1]++;
3125
3125
  var _a, _b, _c;
3126
- cov_29ajiy3676().s[9]++;
3126
+ cov_yuojz2wow().s[9]++;
3127
3127
  this._namespaces = new Map();
3128
- cov_29ajiy3676().s[10]++;
3128
+ cov_yuojz2wow().s[10]++;
3129
3129
  this.i18next = i18next_1.default.createInstance();
3130
- cov_29ajiy3676().s[11]++;
3130
+ cov_yuojz2wow().s[11]++;
3131
3131
  this._backendOptions = {
3132
- loadPath: (cov_29ajiy3676().b[4][0]++, (_a = (cov_29ajiy3676().b[6][0]++, options === null) || (cov_29ajiy3676().b[6][1]++, options === void 0) ? (cov_29ajiy3676().b[5][0]++, void 0) : (cov_29ajiy3676().b[5][1]++, options.urlTemplate)) !== null) && (cov_29ajiy3676().b[4][1]++, _a !== void 0) ? (cov_29ajiy3676().b[3][0]++, _a) : (cov_29ajiy3676().b[3][1]++, "locales/{{lng}}/{{ns}}.json"),
3132
+ loadPath: (cov_yuojz2wow().b[4][0]++, (_a = (cov_yuojz2wow().b[6][0]++, options === null) || (cov_yuojz2wow().b[6][1]++, options === void 0) ? (cov_yuojz2wow().b[5][0]++, void 0) : (cov_yuojz2wow().b[5][1]++, options.urlTemplate)) !== null) && (cov_yuojz2wow().b[4][1]++, _a !== void 0) ? (cov_yuojz2wow().b[3][0]++, _a) : (cov_yuojz2wow().b[3][1]++, "locales/{{lng}}/{{ns}}.json"),
3133
3133
  crossDomain: true,
3134
- ...((cov_29ajiy3676().b[8][0]++, options === null) || (cov_29ajiy3676().b[8][1]++, options === void 0) ? (cov_29ajiy3676().b[7][0]++, void 0) : (cov_29ajiy3676().b[7][1]++, options.backendHttpOptions))
3134
+ ...((cov_yuojz2wow().b[8][0]++, options === null) || (cov_yuojz2wow().b[8][1]++, options === void 0) ? (cov_yuojz2wow().b[7][0]++, void 0) : (cov_yuojz2wow().b[7][1]++, options.backendHttpOptions))
3135
3135
  };
3136
- cov_29ajiy3676().s[12]++;
3136
+ cov_yuojz2wow().s[12]++;
3137
3137
  this._detectionOptions = {
3138
3138
  order: ["querystring", "navigator", "htmlTag"],
3139
3139
  lookupQuerystring: "lng",
3140
3140
  caches: [],
3141
- ...((cov_29ajiy3676().b[10][0]++, options === null) || (cov_29ajiy3676().b[10][1]++, options === void 0) ? (cov_29ajiy3676().b[9][0]++, void 0) : (cov_29ajiy3676().b[9][1]++, options.detectorOptions))
3141
+ ...((cov_yuojz2wow().b[10][0]++, options === null) || (cov_yuojz2wow().b[10][1]++, options === void 0) ? (cov_yuojz2wow().b[9][0]++, void 0) : (cov_yuojz2wow().b[9][1]++, options.detectorOptions))
3142
3142
  };
3143
- cov_29ajiy3676().s[13]++;
3143
+ cov_yuojz2wow().s[13]++;
3144
3144
  this._initOptions = {
3145
3145
  interpolation: {
3146
3146
  escapeValue: true
@@ -3149,43 +3149,43 @@ class ITwinLocalization {
3149
3149
  maxRetries: DEFAULT_MAX_RETRIES,
3150
3150
  backend: this._backendOptions,
3151
3151
  detection: this._detectionOptions,
3152
- ...((cov_29ajiy3676().b[12][0]++, options === null) || (cov_29ajiy3676().b[12][1]++, options === void 0) ? (cov_29ajiy3676().b[11][0]++, void 0) : (cov_29ajiy3676().b[11][1]++, options.initOptions))
3152
+ ...((cov_yuojz2wow().b[12][0]++, options === null) || (cov_yuojz2wow().b[12][1]++, options === void 0) ? (cov_yuojz2wow().b[11][0]++, void 0) : (cov_yuojz2wow().b[11][1]++, options.initOptions))
3153
3153
  };
3154
- cov_29ajiy3676().s[14]++;
3155
- this.i18next.use((cov_29ajiy3676().b[14][0]++, (_b = (cov_29ajiy3676().b[16][0]++, options === null) || (cov_29ajiy3676().b[16][1]++, options === void 0) ? (cov_29ajiy3676().b[15][0]++, void 0) : (cov_29ajiy3676().b[15][1]++, options.detectorPlugin)) !== null) && (cov_29ajiy3676().b[14][1]++, _b !== void 0) ? (cov_29ajiy3676().b[13][0]++, _b) : (cov_29ajiy3676().b[13][1]++, i18next_browser_languagedetector_1.default)).use((cov_29ajiy3676().b[18][0]++, (_c = (cov_29ajiy3676().b[20][0]++, options === null) || (cov_29ajiy3676().b[20][1]++, options === void 0) ? (cov_29ajiy3676().b[19][0]++, void 0) : (cov_29ajiy3676().b[19][1]++, options.backendPlugin)) !== null) && (cov_29ajiy3676().b[18][1]++, _c !== void 0) ? (cov_29ajiy3676().b[17][0]++, _c) : (cov_29ajiy3676().b[17][1]++, i18next_http_backend_1.default)).use(TranslationLogger);
3154
+ cov_yuojz2wow().s[14]++;
3155
+ this.i18next.use((cov_yuojz2wow().b[14][0]++, (_b = (cov_yuojz2wow().b[16][0]++, options === null) || (cov_yuojz2wow().b[16][1]++, options === void 0) ? (cov_yuojz2wow().b[15][0]++, void 0) : (cov_yuojz2wow().b[15][1]++, options.detectorPlugin)) !== null) && (cov_yuojz2wow().b[14][1]++, _b !== void 0) ? (cov_yuojz2wow().b[13][0]++, _b) : (cov_yuojz2wow().b[13][1]++, i18next_browser_languagedetector_1.default)).use((cov_yuojz2wow().b[18][0]++, (_c = (cov_yuojz2wow().b[20][0]++, options === null) || (cov_yuojz2wow().b[20][1]++, options === void 0) ? (cov_yuojz2wow().b[19][0]++, void 0) : (cov_yuojz2wow().b[19][1]++, options.backendPlugin)) !== null) && (cov_yuojz2wow().b[18][1]++, _c !== void 0) ? (cov_yuojz2wow().b[17][0]++, _c) : (cov_yuojz2wow().b[17][1]++, i18next_http_backend_1.default)).use(TranslationLogger);
3156
3156
  }
3157
3157
  async initialize(namespaces) {
3158
- cov_29ajiy3676().f[2]++;
3158
+ cov_yuojz2wow().f[2]++;
3159
3159
  var _a;
3160
3160
  // Also consider namespaces passed into constructor
3161
- const initNamespaces = (cov_29ajiy3676().s[15]++, [(cov_29ajiy3676().b[21][0]++, this._initOptions.ns) || (cov_29ajiy3676().b[21][1]++, [])].flat());
3162
- const combinedNamespaces = (cov_29ajiy3676().s[16]++, new Set([...namespaces, ...initNamespaces])); // without duplicates
3163
- const defaultNamespace = (cov_29ajiy3676().s[17]++, (cov_29ajiy3676().b[23][0]++, (_a = this._initOptions.defaultNS) !== null) && (cov_29ajiy3676().b[23][1]++, _a !== void 0) ? (cov_29ajiy3676().b[22][0]++, _a) : (cov_29ajiy3676().b[22][1]++, namespaces[0]));
3164
- cov_29ajiy3676().s[18]++;
3161
+ const initNamespaces = (cov_yuojz2wow().s[15]++, [(cov_yuojz2wow().b[21][0]++, this._initOptions.ns) || (cov_yuojz2wow().b[21][1]++, [])].flat());
3162
+ const combinedNamespaces = (cov_yuojz2wow().s[16]++, new Set([...namespaces, ...initNamespaces])); // without duplicates
3163
+ const defaultNamespace = (cov_yuojz2wow().s[17]++, (cov_yuojz2wow().b[23][0]++, (_a = this._initOptions.defaultNS) !== null) && (cov_yuojz2wow().b[23][1]++, _a !== void 0) ? (cov_yuojz2wow().b[22][0]++, _a) : (cov_yuojz2wow().b[22][1]++, namespaces[0]));
3164
+ cov_yuojz2wow().s[18]++;
3165
3165
  if (defaultNamespace) {
3166
- cov_29ajiy3676().b[24][0]++;
3167
- cov_29ajiy3676().s[19]++;
3166
+ cov_yuojz2wow().b[24][0]++;
3167
+ cov_yuojz2wow().s[19]++;
3168
3168
  combinedNamespaces.add(defaultNamespace);
3169
3169
  } else {
3170
- cov_29ajiy3676().b[24][1]++;
3170
+ cov_yuojz2wow().b[24][1]++;
3171
3171
  } // Make sure default namespace is in namespaces list
3172
- const initOptions = (cov_29ajiy3676().s[20]++, {
3172
+ const initOptions = (cov_yuojz2wow().s[20]++, {
3173
3173
  ...this._initOptions,
3174
3174
  defaultNS: defaultNamespace,
3175
3175
  ns: [...combinedNamespaces]
3176
3176
  });
3177
3177
  // if in a development environment, set debugging
3178
- cov_29ajiy3676().s[21]++;
3178
+ cov_yuojz2wow().s[21]++;
3179
3179
  if (false) {} else {
3180
- cov_29ajiy3676().b[25][1]++;
3180
+ cov_yuojz2wow().b[25][1]++;
3181
3181
  }
3182
- const initPromise = (cov_29ajiy3676().s[23]++, this.i18next.init(initOptions));
3183
- cov_29ajiy3676().s[24]++;
3182
+ const initPromise = (cov_yuojz2wow().s[23]++, this.i18next.init(initOptions));
3183
+ cov_yuojz2wow().s[24]++;
3184
3184
  for (const ns of namespaces) {
3185
- cov_29ajiy3676().s[25]++;
3185
+ cov_yuojz2wow().s[25]++;
3186
3186
  this._namespaces.set(ns, initPromise);
3187
3187
  }
3188
- cov_29ajiy3676().s[26]++;
3188
+ cov_yuojz2wow().s[26]++;
3189
3189
  return initPromise;
3190
3190
  }
3191
3191
  /** Replace all instances of `%{key}` within a string with the translations of those keys.
@@ -3205,11 +3205,11 @@ class ITwinLocalization {
3205
3205
  * @public
3206
3206
  */
3207
3207
  getLocalizedKeys(line) {
3208
- cov_29ajiy3676().f[3]++;
3209
- cov_29ajiy3676().s[27]++;
3208
+ cov_yuojz2wow().f[3]++;
3209
+ cov_yuojz2wow().s[27]++;
3210
3210
  return line.replace(/\%\{(.+?)\}/g, (_match, tag) => {
3211
- cov_29ajiy3676().f[4]++;
3212
- cov_29ajiy3676().s[28]++;
3211
+ cov_yuojz2wow().f[4]++;
3212
+ cov_yuojz2wow().s[28]++;
3213
3213
  return this.getLocalizedString(tag);
3214
3214
  });
3215
3215
  }
@@ -3227,25 +3227,25 @@ class ITwinLocalization {
3227
3227
  * @public
3228
3228
  */
3229
3229
  getLocalizedString(key, options) {
3230
- cov_29ajiy3676().f[5]++;
3231
- cov_29ajiy3676().s[29]++;
3232
- if ((cov_29ajiy3676().b[27][0]++, (cov_29ajiy3676().b[29][0]++, options === null) || (cov_29ajiy3676().b[29][1]++, options === void 0) ? (cov_29ajiy3676().b[28][0]++, void 0) : (cov_29ajiy3676().b[28][1]++, options.returnDetails)) || (cov_29ajiy3676().b[27][1]++, (cov_29ajiy3676().b[31][0]++, options === null) || (cov_29ajiy3676().b[31][1]++, options === void 0) ? (cov_29ajiy3676().b[30][0]++, void 0) : (cov_29ajiy3676().b[30][1]++, options.returnObjects))) {
3233
- cov_29ajiy3676().b[26][0]++;
3234
- cov_29ajiy3676().s[30]++;
3230
+ cov_yuojz2wow().f[5]++;
3231
+ cov_yuojz2wow().s[29]++;
3232
+ if ((cov_yuojz2wow().b[27][0]++, (cov_yuojz2wow().b[29][0]++, options === null) || (cov_yuojz2wow().b[29][1]++, options === void 0) ? (cov_yuojz2wow().b[28][0]++, void 0) : (cov_yuojz2wow().b[28][1]++, options.returnDetails)) || (cov_yuojz2wow().b[27][1]++, (cov_yuojz2wow().b[31][0]++, options === null) || (cov_yuojz2wow().b[31][1]++, options === void 0) ? (cov_yuojz2wow().b[30][0]++, void 0) : (cov_yuojz2wow().b[30][1]++, options.returnObjects))) {
3233
+ cov_yuojz2wow().b[26][0]++;
3234
+ cov_yuojz2wow().s[30]++;
3235
3235
  throw new Error("Translation key must map to a string, but the given options will result in an object");
3236
3236
  } else {
3237
- cov_29ajiy3676().b[26][1]++;
3237
+ cov_yuojz2wow().b[26][1]++;
3238
3238
  }
3239
- const value = (cov_29ajiy3676().s[31]++, this.i18next.t(key, options));
3240
- cov_29ajiy3676().s[32]++;
3239
+ const value = (cov_yuojz2wow().s[31]++, this.i18next.t(key, options));
3240
+ cov_yuojz2wow().s[32]++;
3241
3241
  if (typeof value !== "string") {
3242
- cov_29ajiy3676().b[32][0]++;
3243
- cov_29ajiy3676().s[33]++;
3242
+ cov_yuojz2wow().b[32][0]++;
3243
+ cov_yuojz2wow().s[33]++;
3244
3244
  throw new Error("Translation key(s) string not found");
3245
3245
  } else {
3246
- cov_29ajiy3676().b[32][1]++;
3246
+ cov_yuojz2wow().b[32][1]++;
3247
3247
  }
3248
- cov_29ajiy3676().s[34]++;
3248
+ cov_yuojz2wow().s[34]++;
3249
3249
  return value;
3250
3250
  }
3251
3251
  /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.
@@ -3256,23 +3256,23 @@ class ITwinLocalization {
3256
3256
  * @internal
3257
3257
  */
3258
3258
  getLocalizedStringWithNamespace(namespace, key, options) {
3259
- cov_29ajiy3676().f[6]++;
3260
- let fullKey = (cov_29ajiy3676().s[35]++, "");
3261
- cov_29ajiy3676().s[36]++;
3259
+ cov_yuojz2wow().f[6]++;
3260
+ let fullKey = (cov_yuojz2wow().s[35]++, "");
3261
+ cov_yuojz2wow().s[36]++;
3262
3262
  if (typeof key === "string") {
3263
- cov_29ajiy3676().b[33][0]++;
3264
- cov_29ajiy3676().s[37]++;
3263
+ cov_yuojz2wow().b[33][0]++;
3264
+ cov_yuojz2wow().s[37]++;
3265
3265
  fullKey = `${namespace}:${key}`;
3266
3266
  } else {
3267
- cov_29ajiy3676().b[33][1]++;
3268
- cov_29ajiy3676().s[38]++;
3267
+ cov_yuojz2wow().b[33][1]++;
3268
+ cov_yuojz2wow().s[38]++;
3269
3269
  fullKey = key.map(subKey => {
3270
- cov_29ajiy3676().f[7]++;
3271
- cov_29ajiy3676().s[39]++;
3270
+ cov_yuojz2wow().f[7]++;
3271
+ cov_yuojz2wow().s[39]++;
3272
3272
  return `${namespace}:${subKey}`;
3273
3273
  });
3274
3274
  }
3275
- cov_29ajiy3676().s[40]++;
3275
+ cov_yuojz2wow().s[40]++;
3276
3276
  return this.getLocalizedString(fullKey, options);
3277
3277
  }
3278
3278
  /** Gets the English translation.
@@ -3283,26 +3283,26 @@ class ITwinLocalization {
3283
3283
  * @internal
3284
3284
  */
3285
3285
  getEnglishString(namespace, key, options) {
3286
- cov_29ajiy3676().f[8]++;
3287
- cov_29ajiy3676().s[41]++;
3288
- if ((cov_29ajiy3676().b[35][0]++, (cov_29ajiy3676().b[37][0]++, options === null) || (cov_29ajiy3676().b[37][1]++, options === void 0) ? (cov_29ajiy3676().b[36][0]++, void 0) : (cov_29ajiy3676().b[36][1]++, options.returnDetails)) || (cov_29ajiy3676().b[35][1]++, (cov_29ajiy3676().b[39][0]++, options === null) || (cov_29ajiy3676().b[39][1]++, options === void 0) ? (cov_29ajiy3676().b[38][0]++, void 0) : (cov_29ajiy3676().b[38][1]++, options.returnObjects))) {
3289
- cov_29ajiy3676().b[34][0]++;
3290
- cov_29ajiy3676().s[42]++;
3286
+ cov_yuojz2wow().f[8]++;
3287
+ cov_yuojz2wow().s[41]++;
3288
+ if ((cov_yuojz2wow().b[35][0]++, (cov_yuojz2wow().b[37][0]++, options === null) || (cov_yuojz2wow().b[37][1]++, options === void 0) ? (cov_yuojz2wow().b[36][0]++, void 0) : (cov_yuojz2wow().b[36][1]++, options.returnDetails)) || (cov_yuojz2wow().b[35][1]++, (cov_yuojz2wow().b[39][0]++, options === null) || (cov_yuojz2wow().b[39][1]++, options === void 0) ? (cov_yuojz2wow().b[38][0]++, void 0) : (cov_yuojz2wow().b[38][1]++, options.returnObjects))) {
3289
+ cov_yuojz2wow().b[34][0]++;
3290
+ cov_yuojz2wow().s[42]++;
3291
3291
  throw new Error("Translation key must map to a string, but the given options will result in an object");
3292
3292
  } else {
3293
- cov_29ajiy3676().b[34][1]++;
3293
+ cov_yuojz2wow().b[34][1]++;
3294
3294
  }
3295
- const en = (cov_29ajiy3676().s[43]++, this.i18next.getFixedT("en", namespace));
3296
- const str = (cov_29ajiy3676().s[44]++, en(key, options));
3297
- cov_29ajiy3676().s[45]++;
3295
+ const en = (cov_yuojz2wow().s[43]++, this.i18next.getFixedT("en", namespace));
3296
+ const str = (cov_yuojz2wow().s[44]++, en(key, options));
3297
+ cov_yuojz2wow().s[45]++;
3298
3298
  if (typeof str !== "string") {
3299
- cov_29ajiy3676().b[40][0]++;
3300
- cov_29ajiy3676().s[46]++;
3299
+ cov_yuojz2wow().b[40][0]++;
3300
+ cov_yuojz2wow().s[46]++;
3301
3301
  throw new Error("Translation key(s) not found");
3302
3302
  } else {
3303
- cov_29ajiy3676().b[40][1]++;
3303
+ cov_yuojz2wow().b[40][1]++;
3304
3304
  }
3305
- cov_29ajiy3676().s[47]++;
3305
+ cov_yuojz2wow().s[47]++;
3306
3306
  return str;
3307
3307
  }
3308
3308
  /** Get the promise for an already registered Namespace.
@@ -3310,20 +3310,20 @@ class ITwinLocalization {
3310
3310
  * @public
3311
3311
  */
3312
3312
  getNamespacePromise(name) {
3313
- cov_29ajiy3676().f[9]++;
3314
- cov_29ajiy3676().s[48]++;
3313
+ cov_yuojz2wow().f[9]++;
3314
+ cov_yuojz2wow().s[48]++;
3315
3315
  return this._namespaces.get(name);
3316
3316
  }
3317
3317
  /** @internal */
3318
3318
  getLanguageList() {
3319
- cov_29ajiy3676().f[10]++;
3320
- cov_29ajiy3676().s[49]++;
3319
+ cov_yuojz2wow().f[10]++;
3320
+ cov_yuojz2wow().s[49]++;
3321
3321
  return this.i18next.languages;
3322
3322
  }
3323
3323
  /** override the language detected in the browser */
3324
3324
  async changeLanguage(language) {
3325
- cov_29ajiy3676().f[11]++;
3326
- cov_29ajiy3676().s[50]++;
3325
+ cov_yuojz2wow().f[11]++;
3326
+ cov_yuojz2wow().s[50]++;
3327
3327
  return this.i18next.changeLanguage(language);
3328
3328
  }
3329
3329
  /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
@@ -3335,123 +3335,123 @@ class ITwinLocalization {
3335
3335
  * @public
3336
3336
  */
3337
3337
  async registerNamespace(name) {
3338
- cov_29ajiy3676().f[12]++;
3339
- const existing = (cov_29ajiy3676().s[51]++, this._namespaces.get(name));
3340
- cov_29ajiy3676().s[52]++;
3338
+ cov_yuojz2wow().f[12]++;
3339
+ const existing = (cov_yuojz2wow().s[51]++, this._namespaces.get(name));
3340
+ cov_yuojz2wow().s[52]++;
3341
3341
  if (existing !== undefined) {
3342
- cov_29ajiy3676().b[41][0]++;
3343
- cov_29ajiy3676().s[53]++;
3342
+ cov_yuojz2wow().b[41][0]++;
3343
+ cov_yuojz2wow().s[53]++;
3344
3344
  return existing;
3345
3345
  } else {
3346
- cov_29ajiy3676().b[41][1]++;
3346
+ cov_yuojz2wow().b[41][1]++;
3347
3347
  }
3348
- const theReadPromise = (cov_29ajiy3676().s[54]++, new Promise(resolve => {
3349
- cov_29ajiy3676().f[13]++;
3350
- cov_29ajiy3676().s[55]++;
3348
+ const theReadPromise = (cov_yuojz2wow().s[54]++, new Promise(resolve => {
3349
+ cov_yuojz2wow().f[13]++;
3350
+ cov_yuojz2wow().s[55]++;
3351
3351
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
3352
3352
  this.i18next.loadNamespaces(name, err => {
3353
- cov_29ajiy3676().f[14]++;
3354
- cov_29ajiy3676().s[56]++;
3353
+ cov_yuojz2wow().f[14]++;
3354
+ cov_yuojz2wow().s[56]++;
3355
3355
  if (!err) {
3356
- cov_29ajiy3676().b[42][0]++;
3357
- cov_29ajiy3676().s[57]++;
3356
+ cov_yuojz2wow().b[42][0]++;
3357
+ cov_yuojz2wow().s[57]++;
3358
3358
  return resolve();
3359
3359
  } else {
3360
- cov_29ajiy3676().b[42][1]++;
3360
+ cov_yuojz2wow().b[42][1]++;
3361
3361
  }
3362
3362
  // Here we got a non-null err object.
3363
3363
  // This method is called when the system has attempted to load the resources for the namespaces for each possible locale.
3364
3364
  // For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.
3365
3365
  // Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.
3366
3366
  // There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.
3367
- let locales = (cov_29ajiy3676().s[58]++, this.getLanguageList().map(thisLocale => {
3368
- cov_29ajiy3676().f[15]++;
3369
- cov_29ajiy3676().s[59]++;
3367
+ let locales = (cov_yuojz2wow().s[58]++, this.getLanguageList().map(thisLocale => {
3368
+ cov_yuojz2wow().f[15]++;
3369
+ cov_yuojz2wow().s[59]++;
3370
3370
  return `/${thisLocale}/`;
3371
3371
  }));
3372
- cov_29ajiy3676().s[60]++;
3372
+ cov_yuojz2wow().s[60]++;
3373
3373
  try {
3374
- cov_29ajiy3676().s[61]++;
3374
+ cov_yuojz2wow().s[61]++;
3375
3375
  for (const thisError of err) {
3376
- cov_29ajiy3676().s[62]++;
3376
+ cov_yuojz2wow().s[62]++;
3377
3377
  if (typeof thisError === "string") {
3378
- cov_29ajiy3676().b[43][0]++;
3379
- cov_29ajiy3676().s[63]++;
3378
+ cov_yuojz2wow().b[43][0]++;
3379
+ cov_yuojz2wow().s[63]++;
3380
3380
  locales = locales.filter(thisLocale => {
3381
- cov_29ajiy3676().f[16]++;
3382
- cov_29ajiy3676().s[64]++;
3381
+ cov_yuojz2wow().f[16]++;
3382
+ cov_yuojz2wow().s[64]++;
3383
3383
  return !thisError.includes(thisLocale);
3384
3384
  });
3385
3385
  } else {
3386
- cov_29ajiy3676().b[43][1]++;
3386
+ cov_yuojz2wow().b[43][1]++;
3387
3387
  }
3388
3388
  }
3389
3389
  } catch (e) {
3390
- cov_29ajiy3676().s[65]++;
3390
+ cov_yuojz2wow().s[65]++;
3391
3391
  locales = [];
3392
3392
  }
3393
3393
  // if we removed every locale from the array, it wasn't loaded.
3394
- cov_29ajiy3676().s[66]++;
3394
+ cov_yuojz2wow().s[66]++;
3395
3395
  if (locales.length === 0) {
3396
- cov_29ajiy3676().b[44][0]++;
3397
- cov_29ajiy3676().s[67]++;
3396
+ cov_yuojz2wow().b[44][0]++;
3397
+ cov_yuojz2wow().s[67]++;
3398
3398
  core_bentley_1.Logger.logError("i18n", `No resources for namespace ${name} could be loaded`);
3399
3399
  } else {
3400
- cov_29ajiy3676().b[44][1]++;
3400
+ cov_yuojz2wow().b[44][1]++;
3401
3401
  }
3402
- cov_29ajiy3676().s[68]++;
3402
+ cov_yuojz2wow().s[68]++;
3403
3403
  resolve();
3404
3404
  });
3405
3405
  }));
3406
- cov_29ajiy3676().s[69]++;
3406
+ cov_yuojz2wow().s[69]++;
3407
3407
  this._namespaces.set(name, theReadPromise);
3408
- cov_29ajiy3676().s[70]++;
3408
+ cov_yuojz2wow().s[70]++;
3409
3409
  return theReadPromise;
3410
3410
  }
3411
3411
  /** @internal */
3412
3412
  unregisterNamespace(name) {
3413
- cov_29ajiy3676().f[17]++;
3414
- cov_29ajiy3676().s[71]++;
3413
+ cov_yuojz2wow().f[17]++;
3414
+ cov_yuojz2wow().s[71]++;
3415
3415
  this._namespaces.delete(name);
3416
3416
  }
3417
3417
  }
3418
- cov_29ajiy3676().s[72]++;
3418
+ cov_yuojz2wow().s[72]++;
3419
3419
  exports.ITwinLocalization = ITwinLocalization;
3420
3420
  class TranslationLogger {
3421
3421
  log(args) {
3422
- cov_29ajiy3676().f[18]++;
3423
- cov_29ajiy3676().s[73]++;
3422
+ cov_yuojz2wow().f[18]++;
3423
+ cov_yuojz2wow().s[73]++;
3424
3424
  core_bentley_1.Logger.logInfo("i18n", this.createLogMessage(args));
3425
3425
  }
3426
3426
  warn(args) {
3427
- cov_29ajiy3676().f[19]++;
3428
- cov_29ajiy3676().s[74]++;
3427
+ cov_yuojz2wow().f[19]++;
3428
+ cov_yuojz2wow().s[74]++;
3429
3429
  core_bentley_1.Logger.logWarning("i18n", this.createLogMessage(args));
3430
3430
  }
3431
3431
  error(args) {
3432
- cov_29ajiy3676().f[20]++;
3433
- cov_29ajiy3676().s[75]++;
3432
+ cov_yuojz2wow().f[20]++;
3433
+ cov_yuojz2wow().s[75]++;
3434
3434
  core_bentley_1.Logger.logError("i18n", this.createLogMessage(args));
3435
3435
  }
3436
3436
  createLogMessage(args) {
3437
- cov_29ajiy3676().f[21]++;
3438
- let message = (cov_29ajiy3676().s[76]++, args[0]);
3439
- cov_29ajiy3676().s[77]++;
3440
- for (let i = (cov_29ajiy3676().s[78]++, 1); i < args.length; ++i) {
3441
- cov_29ajiy3676().s[79]++;
3437
+ cov_yuojz2wow().f[21]++;
3438
+ let message = (cov_yuojz2wow().s[76]++, args[0]);
3439
+ cov_yuojz2wow().s[77]++;
3440
+ for (let i = (cov_yuojz2wow().s[78]++, 1); i < args.length; ++i) {
3441
+ cov_yuojz2wow().s[79]++;
3442
3442
  if (typeof args[i] === "string") {
3443
- cov_29ajiy3676().b[45][0]++;
3444
- cov_29ajiy3676().s[80]++;
3443
+ cov_yuojz2wow().b[45][0]++;
3444
+ cov_yuojz2wow().s[80]++;
3445
3445
  message += `\n ${args[i]}`;
3446
3446
  } else {
3447
- cov_29ajiy3676().b[45][1]++;
3447
+ cov_yuojz2wow().b[45][1]++;
3448
3448
  }
3449
3449
  }
3450
- cov_29ajiy3676().s[81]++;
3450
+ cov_yuojz2wow().s[81]++;
3451
3451
  return message;
3452
3452
  }
3453
3453
  }
3454
- cov_29ajiy3676().s[82]++;
3454
+ cov_yuojz2wow().s[82]++;
3455
3455
  TranslationLogger.type = "logger";
3456
3456
 
3457
3457
  /***/ }),
@@ -22761,13 +22761,17 @@ class Logger {
22761
22761
  }
22762
22762
  /** Set the least severe level at which messages should be displayed by default. Call setLevel to override this default setting for specific categories. */
22763
22763
  static setLevelDefault(minLevel) {
22764
- Logger._minLevel = minLevel;
22764
+ var _a;
22765
+ this._minLevel = minLevel;
22766
+ (_a = this.logLevelChangedFn) === null || _a === void 0 ? void 0 : _a.call(this);
22765
22767
  }
22766
22768
  /** Set the minimum logging level for the specified category. The minimum level is least severe level at which messages in the
22767
22769
  * specified category should be displayed.
22768
22770
  */
22769
22771
  static setLevel(category, minLevel) {
22772
+ var _a;
22770
22773
  Logger._categoryFilter.set(category, minLevel);
22774
+ (_a = this.logLevelChangedFn) === null || _a === void 0 ? void 0 : _a.call(this);
22771
22775
  }
22772
22776
  /** Interpret a string as the name of a LogLevel */
22773
22777
  static parseLogLevel(str) {
@@ -22903,8 +22907,8 @@ class Logger {
22903
22907
  Logger._logTrace(category, message, metaData);
22904
22908
  }
22905
22909
  }
22906
- Logger._categoryFilter = new Map();
22907
- Logger._minLevel = undefined;
22910
+ Logger._categoryFilter = new Map(); // do not change the name of this member, it is referenced directly from node addon
22911
+ Logger._minLevel = undefined; // do not change the name of this member, it is referenced directly from node addon
22908
22912
  /** Should the call stack be included when an exception is logged? */
22909
22913
  Logger.logExceptionCallstacks = false;
22910
22914
  /** All static metadata is combined with per-call metadata and stringified in every log message.