@itwin/core-i18n 3.4.0-dev.9 → 3.5.0-dev.5

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,26 @@
1
1
  # Change Log - @itwin/core-i18n
2
2
 
3
- This log was last generated on Tue, 09 Aug 2022 15:52:41 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 01 Sep 2022 14:37:22 GMT and should not be manually modified.
4
+
5
+ ## 3.3.2
6
+ Thu, 01 Sep 2022 14:37:22 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.3.1
11
+ Fri, 26 Aug 2022 15:40:02 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.3.0
16
+ Thu, 18 Aug 2022 19:08:02 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 3.2.9
21
+ Fri, 26 Aug 2022 14:21:40 GMT
22
+
23
+ _Version update only_
4
24
 
5
25
  ## 3.2.8
6
26
  Tue, 09 Aug 2022 15:52:41 GMT
@@ -1,99 +1,99 @@
1
- /** @packageDocumentation
2
- * @module Localization
3
- */
4
- import { i18n, InitOptions, Module, TOptionsBase } from "i18next";
5
- import { DetectorOptions } from "i18next-browser-languagedetector";
6
- import { BackendOptions } from "i18next-http-backend";
7
- import type { Localization } from "@itwin/core-common";
8
- /** Options for ITwinLocalization
9
- * @public
10
- */
11
- export interface LocalizationOptions {
12
- urlTemplate?: string;
13
- backendPlugin?: Module;
14
- detectorPlugin?: Module;
15
- initOptions?: InitOptions;
16
- backendHttpOptions?: BackendOptions;
17
- detectorOptions?: DetectorOptions;
18
- }
19
- /** Supplies localizations for iTwin.js
20
- * @note this class uses the [i18next](https://www.i18next.com/) package.
21
- * @public
22
- */
23
- export declare class ITwinLocalization implements Localization {
24
- i18next: i18n;
25
- private readonly _initOptions;
26
- private readonly _backendOptions;
27
- private readonly _detectionOptions;
28
- private readonly _namespaces;
29
- constructor(options?: LocalizationOptions);
30
- initialize(namespaces: string[]): Promise<void>;
31
- /** Replace all instances of `%{key}` within a string with the translations of those keys.
32
- * For example:
33
- * ``` ts
34
- * "MyKeys": {
35
- * "Key1": "First value",
36
- * "Key2": "Second value"
37
- * }
38
- * ```
39
- *
40
- * ``` ts
41
- * i18.translateKeys("string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!"") // returns "string with First Value followed by Second Value!"
42
- * ```
43
- * @param line The input line, potentially containing %{keys}.
44
- * @returns The line with all %{keys} translated
45
- * @public
46
- */
47
- getLocalizedKeys(line: string): string;
48
- /** Return the translated value of a key.
49
- * @param key - the key that matches a property in the JSON localization file.
50
- * @note The key includes the namespace, which identifies the particular localization file that contains the property,
51
- * followed by a colon, followed by the property in the JSON file.
52
- * For example:
53
- * ``` ts
54
- * const dataString: string = IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.BingDataAttribution");
55
- * ```
56
- * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.
57
- * @returns The string corresponding to the first key that resolves.
58
- * @throws Error if no keys resolve to a string.
59
- * @public
60
- */
61
- getLocalizedString(key: string | string[], options?: TOptionsBase): string;
62
- /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.
63
- * @param namespace - the namespace that identifies the particular localization file that contains the property.
64
- * @param key - the key that matches a property in the JSON localization file.
65
- * @returns The string corresponding to the first key that resolves.
66
- * @throws Error if no keys resolve to a string.
67
- * @internal
68
- */
69
- getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string;
70
- /** Gets the English translation.
71
- * @param namespace - the namespace that identifies the particular localization file that contains the property.
72
- * @param key - the key that matches a property in the JSON localization file.
73
- * @returns The string corresponding to the first key that resolves.
74
- * @throws Error if no keys resolve to a string.
75
- * @internal
76
- */
77
- getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string;
78
- /** Get the promise for an already registered Namespace.
79
- * @param name - the name of the namespace
80
- * @public
81
- */
82
- getNamespacePromise(name: string): Promise<void> | undefined;
83
- /** @internal */
84
- getLanguageList(): readonly string[];
85
- /** override the language detected in the browser */
86
- changeLanguage(language: string): Promise<void>;
87
- /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
88
- * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
89
- * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
90
- * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
91
- * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
92
- * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
93
- * @public
94
- */
95
- registerNamespace(name: string): Promise<void>;
96
- /** @internal */
97
- unregisterNamespace(name: string): void;
98
- }
1
+ /** @packageDocumentation
2
+ * @module Localization
3
+ */
4
+ import { i18n, InitOptions, Module, TOptionsBase } from "i18next";
5
+ import { DetectorOptions } from "i18next-browser-languagedetector";
6
+ import { BackendOptions } from "i18next-http-backend";
7
+ import type { Localization } from "@itwin/core-common";
8
+ /** Options for ITwinLocalization
9
+ * @public
10
+ */
11
+ export interface LocalizationOptions {
12
+ urlTemplate?: string;
13
+ backendPlugin?: Module;
14
+ detectorPlugin?: Module;
15
+ initOptions?: InitOptions;
16
+ backendHttpOptions?: BackendOptions;
17
+ detectorOptions?: DetectorOptions;
18
+ }
19
+ /** Supplies localizations for iTwin.js
20
+ * @note this class uses the [i18next](https://www.i18next.com/) package.
21
+ * @public
22
+ */
23
+ export declare class ITwinLocalization implements Localization {
24
+ i18next: i18n;
25
+ private readonly _initOptions;
26
+ private readonly _backendOptions;
27
+ private readonly _detectionOptions;
28
+ private readonly _namespaces;
29
+ constructor(options?: LocalizationOptions);
30
+ initialize(namespaces: string[]): Promise<void>;
31
+ /** Replace all instances of `%{key}` within a string with the translations of those keys.
32
+ * For example:
33
+ * ``` ts
34
+ * "MyKeys": {
35
+ * "Key1": "First value",
36
+ * "Key2": "Second value"
37
+ * }
38
+ * ```
39
+ *
40
+ * ``` ts
41
+ * i18.translateKeys("string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!"") // returns "string with First Value followed by Second Value!"
42
+ * ```
43
+ * @param line The input line, potentially containing %{keys}.
44
+ * @returns The line with all %{keys} translated
45
+ * @public
46
+ */
47
+ getLocalizedKeys(line: string): string;
48
+ /** Return the translated value of a key.
49
+ * @param key - the key that matches a property in the JSON localization file.
50
+ * @note The key includes the namespace, which identifies the particular localization file that contains the property,
51
+ * followed by a colon, followed by the property in the JSON file.
52
+ * For example:
53
+ * ``` ts
54
+ * const dataString: string = IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.BingDataAttribution");
55
+ * ```
56
+ * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.
57
+ * @returns The string corresponding to the first key that resolves.
58
+ * @throws Error if no keys resolve to a string.
59
+ * @public
60
+ */
61
+ getLocalizedString(key: string | string[], options?: TOptionsBase): string;
62
+ /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.
63
+ * @param namespace - the namespace that identifies the particular localization file that contains the property.
64
+ * @param key - the key that matches a property in the JSON localization file.
65
+ * @returns The string corresponding to the first key that resolves.
66
+ * @throws Error if no keys resolve to a string.
67
+ * @internal
68
+ */
69
+ getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string;
70
+ /** Gets the English translation.
71
+ * @param namespace - the namespace that identifies the particular localization file that contains the property.
72
+ * @param key - the key that matches a property in the JSON localization file.
73
+ * @returns The string corresponding to the first key that resolves.
74
+ * @throws Error if no keys resolve to a string.
75
+ * @internal
76
+ */
77
+ getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string;
78
+ /** Get the promise for an already registered Namespace.
79
+ * @param name - the name of the namespace
80
+ * @public
81
+ */
82
+ getNamespacePromise(name: string): Promise<void> | undefined;
83
+ /** @internal */
84
+ getLanguageList(): readonly string[];
85
+ /** override the language detected in the browser */
86
+ changeLanguage(language: string): Promise<void>;
87
+ /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
88
+ * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
89
+ * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
90
+ * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
91
+ * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
92
+ * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
93
+ * @public
94
+ */
95
+ registerNamespace(name: string): Promise<void>;
96
+ /** @internal */
97
+ unregisterNamespace(name: string): void;
98
+ }
99
99
  //# sourceMappingURL=ITwinLocalization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITwinLocalization.d.ts","sourceRoot":"","sources":["../../src/ITwinLocalization.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAgB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAuC,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IAC7C,OAAO,EAAE,IAAI,CAAC;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkB;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoC;gBAE7C,O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