UNPKG

@itwin/core-i18n

Version:
2,126 lines (2,122 loc) • 1.06 MB
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./lib/cjs/ITwinLocalization.js": /*!**************************************!*\ !*** ./lib/cjs/ITwinLocalization.js ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Localization */ function cov_ogldeftyv() { var path = "C:\\agent\\_work\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js"; var hash = "d940188727f7c3f13464903c9fef76d730c540e6"; var global = new Function("return this")(); var gcv = "__coverage__"; var coverageData = { path: "C:\\agent\\_work\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js", statementMap: { "0": { start: { line: 9, column: 22 }, end: { line: 11, column: 1 } }, "1": { start: { line: 10, column: 4 }, end: { line: 10, column: 62 } }, "2": { start: { line: 12, column: 0 }, end: { line: 12, column: 62 } }, "3": { start: { line: 13, column: 0 }, end: { line: 13, column: 35 } }, "4": { start: { line: 14, column: 18 }, end: { line: 14, column: 53 } }, "5": { start: { line: 15, column: 43 }, end: { line: 15, column: 103 } }, "6": { start: { line: 16, column: 31 }, end: { line: 16, column: 79 } }, "7": { start: { line: 17, column: 23 }, end: { line: 17, column: 53 } }, "8": { start: { line: 18, column: 28 }, end: { line: 18, column: 29 } }, "9": { start: { line: 28, column: 18 }, end: { line: 28, column: 27 } }, "10": { start: { line: 30, column: 8 }, end: { line: 30, column: 58 } }, "11": { start: { line: 31, column: 8 }, end: { line: 35, column: 10 } }, "12": { start: { line: 36, column: 8 }, end: { line: 41, column: 10 } }, "13": { start: { line: 42, column: 8 }, end: { line: 49, column: 10 } }, "14": { start: { line: 50, column: 8 }, end: { line: 53, column: 36 } }, "15": { start: { line: 57, column: 31 }, end: { line: 57, column: 66 } }, "16": { start: { line: 58, column: 35 }, end: { line: 58, column: 78 } }, "17": { start: { line: 59, column: 33 }, end: { line: 59, column: 77 } }, "18": { start: { line: 60, column: 8 }, end: { line: 61, column: 53 } }, "19": { start: { line: 61, column: 12 }, end: { line: 61, column: 53 } }, "20": { start: { line: 62, column: 28 }, end: { line: 66, column: 9 } }, "21": { start: { line: 68, column: 8 }, end: { line: 69, column: 37 } }, "22": { start: { line: 69, column: 12 }, end: { line: 69, column: 37 } }, "23": { start: { line: 70, column: 28 }, end: { line: 70, column: 58 } }, "24": { start: { line: 71, column: 8 }, end: { line: 72, column: 50 } }, "25": { start: { line: 72, column: 12 }, end: { line: 72, column: 50 } }, "26": { start: { line: 73, column: 8 }, end: { line: 73, column: 27 } }, "27": { start: { line: 92, column: 8 }, end: { line: 92, column: 91 } }, "28": { start: { line: 92, column: 61 }, end: { line: 92, column: 89 } }, "29": { start: { line: 108, column: 8 }, end: { line: 110, column: 9 } }, "30": { start: { line: 109, column: 12 }, end: { line: 109, column: 116 } }, "31": { start: { line: 111, column: 22 }, end: { line: 111, column: 50 } }, "32": { start: { line: 112, column: 8 }, end: { line: 114, column: 9 } }, "33": { start: { line: 113, column: 12 }, end: { line: 113, column: 67 } }, "34": { start: { line: 115, column: 8 }, end: { line: 115, column: 21 } }, "35": { start: { line: 125, column: 8 }, end: { line: 127, column: 9 } }, "36": { start: { line: 126, column: 12 }, end: { line: 126, column: 116 } }, "37": { start: { line: 128, column: 8 }, end: { line: 131, column: 10 } }, "38": { start: { line: 132, column: 19 }, end: { line: 132, column: 58 } }, "39": { start: { line: 133, column: 20 }, end: { line: 133, column: 36 } }, "40": { start: { line: 134, column: 8 }, end: { line: 135, column: 60 } }, "41": { start: { line: 135, column: 12 }, end: { line: 135, column: 60 } }, "42": { start: { line: 136, column: 8 }, end: { line: 136, column: 19 } }, "43": { start: { line: 143, column: 8 }, end: { line: 143, column: 42 } }, "44": { start: { line: 147, column: 8 }, end: { line: 147, column: 38 } }, "45": { start: { line: 151, column: 8 }, end: { line: 151, column: 53 } }, "46": { start: { line: 162, column: 25 }, end: { line: 162, column: 51 } }, "47": { start: { line: 163, column: 8 }, end: { line: 164, column: 28 } }, "48": { start: { line: 164, column: 12 }, end: { line: 164, column: 28 } }, "49": { start: { line: 165, column: 31 }, end: { line: 190, column: 10 } }, "50": { start: { line: 167, column: 12 }, end: { line: 189, column: 15 } }, "51": { start: { line: 168, column: 16 }, end: { line: 169, column: 37 } }, "52": { start: { line: 169, column: 20 }, end: { line: 169, column: 37 } }, "53": { start: { line: 175, column: 30 }, end: { line: 175, column: 91 } }, "54": { start: { line: 175, column: 73 }, end: { line: 175, column: 90 } }, "55": { start: { line: 176, column: 16 }, end: { line: 184, column: 17 } }, "56": { start: { line: 177, column: 20 }, end: { line: 180, column: 21 } }, "57": { start: { line: 178, column: 24 }, end: { line: 179, column: 102 } }, "58": { start: { line: 179, column: 28 }, end: { line: 179, column: 102 } }, "59": { start: { line: 179, column: 69 }, end: { line: 179, column: 100 } }, "60": { start: { line: 183, column: 20 }, end: { line: 183, column: 33 } }, "61": { start: { line: 186, column: 16 }, end: { line: 187, column: 113 } }, "62": { start: { line: 187, column: 20 }, end: { line: 187, column: 113 } }, "63": { start: { line: 188, column: 16 }, end: { line: 188, column: 26 } }, "64": { start: { line: 191, column: 8 }, end: { line: 191, column: 51 } }, "65": { start: { line: 192, column: 8 }, end: { line: 192, column: 30 } }, "66": { start: { line: 196, column: 8 }, end: { line: 196, column: 38 } }, "67": { start: { line: 199, column: 0 }, end: { line: 199, column: 46 } }, "68": { start: { line: 201, column: 18 }, end: { line: 201, column: 26 } }, "69": { start: { line: 202, column: 16 }, end: { line: 202, column: 83 } }, "70": { start: { line: 203, column: 17 }, end: { line: 203, column: 87 } }, "71": { start: { line: 204, column: 18 }, end: { line: 204, column: 86 } }, "72": { start: { line: 206, column: 22 }, end: { line: 206, column: 29 } }, "73": { start: { line: 207, column: 8 }, end: { line: 210, column: 9 } }, "74": { start: { line: 207, column: 21 }, end: { line: 207, column: 22 } }, "75": { start: { line: 208, column: 12 }, end: { line: 209, column: 44 } }, "76": { start: { line: 209, column: 16 }, end: { line: 209, column: 44 } }, "77": { start: { line: 211, column: 8 }, end: { line: 211, column: 23 } } }, fnMap: { "0": { name: "(anonymous_0)", decl: { start: { line: 9, column: 56 }, end: { line: 9, column: 57 } }, loc: { start: { line: 9, column: 71 }, end: { line: 11, column: 1 } }, line: 9 }, "1": { name: "(anonymous_1)", decl: { start: { line: 29, column: 4 }, end: { line: 29, column: 5 } }, loc: { start: { line: 29, column: 25 }, end: { line: 54, column: 5 } }, line: 29 }, "2": { name: "(anonymous_2)", decl: { start: { line: 55, column: 4 }, end: { line: 55, column: 5 } }, loc: { start: { line: 55, column: 33 }, end: { line: 74, column: 5 } }, line: 55 }, "3": { name: "(anonymous_3)", decl: { start: { line: 91, column: 4 }, end: { line: 91, column: 5 } }, loc: { start: { line: 91, column: 27 }, end: { line: 93, column: 5 } }, line: 91 }, "4": { name: "(anonymous_4)", decl: { start: { line: 92, column: 44 }, end: { line: 92, column: 45 } }, loc: { start: { line: 92, column: 61 }, end: { line: 92, column: 89 } }, line: 92 }, "5": { name: "(anonymous_5)", decl: { start: { line: 107, column: 4 }, end: { line: 107, column: 5 } }, loc: { start: { line: 107, column: 37 }, end: { line: 116, column: 5 } }, line: 107 }, "6": { name: "(anonymous_6)", decl: { start: { line: 124, column: 4 }, end: { line: 124, column: 5 } }, loc: { start: { line: 124, column: 46 }, end: { line: 137, column: 5 } }, line: 124 }, "7": { name: "(anonymous_7)", decl: { start: { line: 142, column: 4 }, end: { line: 142, column: 5 } }, loc: { start: { line: 142, column: 30 }, end: { line: 144, column: 5 } }, line: 142 }, "8": { name: "(anonymous_8)", decl: { start: { line: 146, column: 4 }, end: { line: 146, column: 5 } }, loc: { start: { line: 146, column: 22 }, end: { line: 148, column: 5 } }, line: 146 }, "9": { name: "(anonymous_9)", decl: { start: { line: 150, column: 4 }, end: { line: 150, column: 5 } }, loc: { start: { line: 150, column: 35 }, end: { line: 152, column: 5 } }, line: 150 }, "10": { name: "(anonymous_10)", decl: { start: { line: 161, column: 4 }, end: { line: 161, column: 5 } }, loc: { start: { line: 161, column: 34 }, end: { line: 193, column: 5 } }, line: 161 }, "11": { name: "(anonymous_11)", decl: { start: { line: 165, column: 43 }, end: { line: 165, column: 44 } }, loc: { start: { line: 165, column: 56 }, end: { line: 190, column: 9 } }, line: 165 }, "12": { name: "(anonymous_12)", decl: { start: { line: 167, column: 46 }, end: { line: 167, column: 47 } }, loc: { start: { line: 167, column: 55 }, end: { line: 189, column: 13 } }, line: 167 }, "13": { name: "(anonymous_13)", decl: { start: { line: 175, column: 57 }, end: { line: 175, column: 58 } }, loc: { start: { line: 175, column: 73 }, end: { line: 175, column: 90 } }, line: 175 }, "14": { name: "(anonymous_14)", decl: { start: { line: 179, column: 53 }, end: { line: 179, column: 54 } }, loc: { start: { line: 179, column: 69 }, end: { line: 179, column: 100 } }, line: 179 }, "15": { name: "(anonymous_15)", decl: { start: { line: 195, column: 4 }, end: { line: 195, column: 5 } }, loc: { start: { line: 195, column: 30 }, end: { line: 197, column: 5 } }, line: 195 }, "16": { name: "(anonymous_16)", decl: { start: { line: 202, column: 4 }, end: { line: 202, column: 5 } }, loc: { start: { line: 202, column: 14 }, end: { line: 202, column: 85 } }, line: 202 }, "17": { name: "(anonymous_17)", decl: { start: { line: 203, column: 4 }, end: { line: 203, column: 5 } }, loc: { start: { line: 203, column: 15 }, end: { line: 203, column: 89 } }, line: 203 }, "18": { name: "(anonymous_18)", decl: { start: { line: 204, column: 4 }, end: { line: 204, column: 5 } }, loc: { start: { line: 204, column: 16 }, end: { line: 204, column: 88 } }, line: 204 }, "19": { name: "(anonymous_19)", decl: { start: { line: 205, column: 4 }, end: { line: 205, column: 5 } }, loc: { start: { line: 205, column: 27 }, end: { line: 212, column: 5 } }, line: 205 } }, branchMap: { "0": { loc: { start: { line: 9, column: 22 }, end: { line: 11, column: 1 } }, type: "binary-expr", locations: [{ start: { line: 9, column: 23 }, end: { line: 9, column: 27 } }, { start: { line: 9, column: 31 }, end: { line: 9, column: 51 } }, { start: { line: 9, column: 56 }, end: { line: 11, column: 1 } }], line: 9 }, "1": { loc: { start: { line: 10, column: 11 }, end: { line: 10, column: 61 } }, type: "cond-expr", locations: [{ start: { line: 10, column: 37 }, end: { line: 10, column: 40 } }, { start: { line: 10, column: 43 }, end: { line: 10, column: 61 } }], line: 10 }, "2": { loc: { start: { line: 10, column: 12 }, end: { line: 10, column: 33 } }, type: "binary-expr", locations: [{ start: { line: 10, column: 12 }, end: { line: 10, column: 15 } }, { start: { line: 10, column: 19 }, end: { line: 10, column: 33 } }], line: 10 }, "3": { loc: { start: { line: 32, column: 22 }, end: { line: 32, column: 75 } }, type: "binary-expr", locations: [{ start: { line: 32, column: 22 }, end: { line: 32, column: 42 } }, { start: { line: 32, column: 46 }, end: { line: 32, column: 75 } }], line: 32 }, "4": { loc: { start: { line: 51, column: 17 }, end: { line: 51, column: 86 } }, type: "binary-expr", locations: [{ start: { line: 51, column: 17 }, end: { line: 51, column: 40 } }, { start: { line: 51, column: 44 }, end: { line: 51, column: 86 } }], line: 51 }, "5": { loc: { start: { line: 52, column: 17 }, end: { line: 52, column: 73 } }, type: "binary-expr", locations: [{ start: { line: 52, column: 17 }, end: { line: 52, column: 39 } }, { start: { line: 52, column: 43 }, end: { line: 52, column: 73 } }], line: 52 }, "6": { loc: { start: { line: 57, column: 32 }, end: { line: 57, column: 58 } }, type: "binary-expr", locations: [{ start: { line: 57, column: 32 }, end: { line: 57, column: 52 } }, { start: { line: 57, column: 56 }, end: { line: 57, column: 58 } }], line: 57 }, "7": { loc: { start: { line: 59, column: 33 }, end: { line: 59, column: 77 } }, type: "binary-expr", locations: [{ start: { line: 59, column: 33 }, end: { line: 59, column: 60 } }, { start: { line: 59, column: 64 }, end: { line: 59, column: 77 } }], line: 59 }, "8": { loc: { start: { line: 60, column: 8 }, end: { line: 61, column: 53 } }, type: "if", locations: [{ start: { line: 60, column: 8 }, end: { line: 61, column: 53 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 60 }, "9": { loc: { start: { line: 68, column: 8 }, end: { line: 69, column: 37 } }, type: "if", locations: [{ start: { line: 68, column: 8 }, end: { line: 69, column: 37 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 68 }, "10": { loc: { start: { line: 108, column: 8 }, end: { line: 110, column: 9 } }, type: "if", locations: [{ start: { line: 108, column: 8 }, end: { line: 110, column: 9 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 108 }, "11": { loc: { start: { line: 108, column: 12 }, end: { line: 108, column: 60 } }, type: "binary-expr", locations: [{ start: { line: 108, column: 12 }, end: { line: 108, column: 34 } }, { start: { line: 108, column: 38 }, end: { line: 108, column: 60 } }], line: 108 }, "12": { loc: { start: { line: 112, column: 8 }, end: { line: 114, column: 9 } }, type: "if", locations: [{ start: { line: 112, column: 8 }, end: { line: 114, column: 9 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 112 }, "13": { loc: { start: { line: 125, column: 8 }, end: { line: 127, column: 9 } }, type: "if", locations: [{ start: { line: 125, column: 8 }, end: { line: 127, column: 9 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 125 }, "14": { loc: { start: { line: 125, column: 12 }, end: { line: 125, column: 60 } }, type: "binary-expr", locations: [{ start: { line: 125, column: 12 }, end: { line: 125, column: 34 } }, { start: { line: 125, column: 38 }, end: { line: 125, column: 60 } }], line: 125 }, "15": { loc: { start: { line: 134, column: 8 }, end: { line: 135, column: 60 } }, type: "if", locations: [{ start: { line: 134, column: 8 }, end: { line: 135, column: 60 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 134 }, "16": { loc: { start: { line: 163, column: 8 }, end: { line: 164, column: 28 } }, type: "if", locations: [{ start: { line: 163, column: 8 }, end: { line: 164, column: 28 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 163 }, "17": { loc: { start: { line: 168, column: 16 }, end: { line: 169, column: 37 } }, type: "if", locations: [{ start: { line: 168, column: 16 }, end: { line: 169, column: 37 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 168 }, "18": { loc: { start: { line: 178, column: 24 }, end: { line: 179, column: 102 } }, type: "if", locations: [{ start: { line: 178, column: 24 }, end: { line: 179, column: 102 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 178 }, "19": { loc: { start: { line: 186, column: 16 }, end: { line: 187, column: 113 } }, type: "if", locations: [{ start: { line: 186, column: 16 }, end: { line: 187, column: 113 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 186 }, "20": { loc: { start: { line: 208, column: 12 }, end: { line: 209, column: 44 } }, type: "if", locations: [{ start: { line: 208, column: 12 }, end: { line: 209, column: 44 } }, { start: { line: undefined, column: undefined }, end: { line: undefined, column: undefined } }], line: 208 } }, s: { "0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0, "11": 0, "12": 0, "13": 0, "14": 0, "15": 0, "16": 0, "17": 0, "18": 0, "19": 0, "20": 0, "21": 0, "22": 0, "23": 0, "24": 0, "25": 0, "26": 0, "27": 0, "28": 0, "29": 0, "30": 0, "31": 0, "32": 0, "33": 0, "34": 0, "35": 0, "36": 0, "37": 0, "38": 0, "39": 0, "40": 0, "41": 0, "42": 0, "43": 0, "44": 0, "45": 0, "46": 0, "47": 0, "48": 0, "49": 0, "50": 0, "51": 0, "52": 0, "53": 0, "54": 0, "55": 0, "56": 0, "57": 0, "58": 0, "59": 0, "60": 0, "61": 0, "62": 0, "63": 0, "64": 0, "65": 0, "66": 0, "67": 0, "68": 0, "69": 0, "70": 0, "71": 0, "72": 0, "73": 0, "74": 0, "75": 0, "76": 0, "77": 0 }, f: { "0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0, "11": 0, "12": 0, "13": 0, "14": 0, "15": 0, "16": 0, "17": 0, "18": 0, "19": 0 }, b: { "0": [0, 0, 0], "1": [0, 0], "2": [0, 0], "3": [0, 0], "4": [0, 0], "5": [0, 0], "6": [0, 0], "7": [0, 0], "8": [0, 0], "9": [0, 0], "10": [0, 0], "11": [0, 0], "12": [0, 0], "13": [0, 0], "14": [0, 0], "15": [0, 0], "16": [0, 0], "17": [0, 0], "18": [0, 0], "19": [0, 0], "20": [0, 0] }, inputSourceMap: { version: 3, file: "ITwinLocalization.js", sources: ["C:\\agent\\_work\\1\\s\\core\\i18n\\src\\ITwinLocalization.ts"], names: [], mappings: ";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,sDAA2E;AAC3E,wGAAmG;AACnG,gFAAqF;AACrF,sDAA6C;AAG7C,MAAM,mBAAmB,GAAW,CAAC,CAAC,CAAC,8GAA8G;AAcrJ;;;GAGG;AACH,MAAa,iBAAiB;IACrB,OAAO,CAAO;IACJ,YAAY,CAAc;IAC1B,eAAe,CAAiB;IAChC,iBAAiB,CAAkB;IACnC,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEhE,YAAmB,OAA6B;QAC9C,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC,cAAc,EAAE,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG;YACrB,QAAQ,EAAE,OAAO,EAAE,WAAW,IAAI,6BAA6B;YAC/D,WAAW,EAAE,IAAI;YACjB,GAAG,OAAO,EAAE,kBAAkB;SAC/B,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG;YACvB,KAAK,EAAE,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,CAAC;YAC9C,iBAAiB,EAAE,KAAK;YACxB,MAAM,EAAE,EAAE;YACV,GAAG,OAAO,EAAE,eAAe;SAC5B,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG;YAClB,aAAa,E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AC,CAAC,KAAK,QAAQ;gBAC7B,OAAO,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC", sourcesContent: ["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Localization\n */\n\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\nimport Backend, { HttpBackendOptions as BackendOptions } from \"i18next-http-backend\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\n\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\n\n/** Options for ITwinLocalization\n * @public\n */\nexport interface LocalizationOptions {\n urlTemplate?: string;\n backendPlugin?: Module;\n detectorPlugin?: Module;\n initOptions?: InitOptions;\n backendHttpOptions?: BackendOptions;\n detectorOptions?: DetectorOptions;\n}\n\n/** Supplies localizations for iTwin.js\n * @note this class uses the [i18next](https://www.i18next.com/) package.\n * @public\n */\nexport class ITwinLocalization implements Localization {\n public i18next: i18n;\n private readonly _initOptions: InitOptions;\n private readonly _backendOptions: BackendOptions;\n private readonly _detectionOptions: DetectorOptions;\n private readonly _namespaces = new Map<string, Promise<void>>();\n\n public constructor(options?: LocalizationOptions) {\n this.i18next = i18next.createInstance();\n\n this._backendOptions = {\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\n crossDomain: true,\n ...options?.backendHttpOptions,\n };\n\n this._detectionOptions = {\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\n lookupQuerystring: \"lng\",\n caches: [],\n ...options?.detectorOptions,\n };\n\n this._initOptions = {\n interpolation: { escapeValue: true },\n fallbackLng: \"en\",\n maxRetries: DEFAULT_MAX_RETRIES,\n backend: this._backendOptions,\n detection: this._detectionOptions,\n ...options?.initOptions,\n };\n\n this.i18next\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\n .use(options?.backendPlugin ?? Backend)\n .use(TranslationLogger);\n }\n\n public async initialize(namespaces: string[]): Promise<void> {\n\n // Also consider namespaces passed into constructor\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\n\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\n if (defaultNamespace)\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\n\n const initOptions: InitOptions = {\n ...this._initOptions,\n defaultNS: defaultNamespace,\n ns: [...combinedNamespaces],\n };\n\n // if in a development environment, set debugging\n if (process.env.NODE_ENV === \"development\")\n initOptions.debug = true;\n\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\n\n for (const ns of namespaces)\n this._namespaces.set(ns, initPromise);\n\n return initPromise;\n }\n\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\n * For example:\n * ``` ts\n * \"MyKeys\": {\n * \"Key1\": \"First value\",\n * \"Key2\": \"Second value\"\n * }\n * ```\n *\n * ``` ts\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\n * ```\n * @param line The input line, potentially containing %{keys}.\n * @returns The line with all %{keys} translated\n * @public\n */\n public getLocalizedKeys(line: string): string {\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\n }\n\n /** Return the translated value of a key.\n * @param key - the key that matches a property in the JSON localization file.\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\n * followed by a colon, followed by the property in the JSON file.\n * For example:\n * ``` ts\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\n * ```\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\n * @returns The string corresponding to the first key that resolves.\n * @throws Error if no keys resolve to a string.\n * @public\n */\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\n if (options?.returnDetails || options?.returnObjects) {\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\n }\n\n const value = this.i18next.t(key, options);\n\n if (typeof value !== \"string\") {\n throw new Error(\"Translation key(s) string not found\");\n }\n\n return value;\n }\n\n /** Gets the English translation.\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\n * @param key - the key that matches a property in the JSON localization file.\n * @returns The string corresponding to the first key that resolves.\n * @throws Error if no keys resolve to a string.\n * @internal\n */\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\n if (options?.returnDetails || options?.returnObjects) {\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\n }\n\n options = {\n ...options,\n ns: namespace, // ensure namespace argument is used\n };\n\n const en = this.i18next.getFixedT(\"en\", namespace);\n const str = en(key, options);\n if (typeof str !== \"string\")\n throw new Error(\"Translation key(s) not found\");\n\n return str;\n }\n\n /** Get the promise for an already registered Namespace.\n * @param name - the name of the namespace\n * @public\n */\n public getNamespacePromise(name: string): Promise<void> | undefined {\n return this._namespaces.get(name);\n }\n\n /** @internal */\n public getLanguageList(): readonly string[] {\n return this.i18next.languages;\n }\n\n /** override the language detected in the browser */\n public async changeLanguage(language: string) {\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\n }\n\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\n * @public\n */\n public async registerNamespace(name: string): Promise<void> {\n const existing = this._namespaces.get(name);\n if (existing !== undefined)\n return existing;\n\n