@itwin/core-i18n 4.0.0-dev.8 → 4.0.0-dev.81

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,46 @@
1
1
  # Change Log - @itwin/core-i18n
2
2
 
3
- This log was last generated on Thu, 26 Jan 2023 22:53:27 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 12 Apr 2023 13:12:42 GMT and should not be manually modified.
4
+
5
+ ## 3.7.2
6
+ Wed, 12 Apr 2023 13:12:42 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.7.1
11
+ Mon, 03 Apr 2023 15:15:37 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.7.0
16
+ Wed, 29 Mar 2023 15:02:27 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 3.6.3
21
+ Mon, 27 Mar 2023 16:26:47 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 3.6.2
26
+ Fri, 17 Mar 2023 17:52:32 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 3.6.1
31
+ Fri, 24 Feb 2023 22:00:48 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 3.6.0
36
+ Wed, 08 Feb 2023 14:58:40 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 3.5.6
41
+ Fri, 24 Feb 2023 16:02:47 GMT
42
+
43
+ _Version update only_
4
44
 
5
45
  ## 3.5.5
6
46
  Thu, 26 Jan 2023 22:53:27 GMT
@@ -1,100 +1,100 @@
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 default namespace is a separate parameter and the key does not need
63
- * to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.
64
- * @param namespace - the namespace that identifies the particular localization file that contains the property.
65
- * @param key - the key that matches a property in the JSON localization file.
66
- * @returns The string corresponding to the first key that resolves.
67
- * @throws Error if no keys resolve to a string.
68
- * @internal
69
- */
70
- getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string;
71
- /** Gets the English translation.
72
- * @param namespace - the namespace that identifies the particular localization file that contains the property.
73
- * @param key - the key that matches a property in the JSON localization file.
74
- * @returns The string corresponding to the first key that resolves.
75
- * @throws Error if no keys resolve to a string.
76
- * @internal
77
- */
78
- getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string;
79
- /** Get the promise for an already registered Namespace.
80
- * @param name - the name of the namespace
81
- * @public
82
- */
83
- getNamespacePromise(name: string): Promise<void> | undefined;
84
- /** @internal */
85
- getLanguageList(): readonly string[];
86
- /** override the language detected in the browser */
87
- changeLanguage(language: string): Promise<void>;
88
- /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
89
- * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
90
- * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
91
- * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
92
- * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
93
- * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
94
- * @public
95
- */
96
- registerNamespace(name: string): Promise<void>;
97
- /** @internal */
98
- unregisterNamespace(name: string): void;
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 default namespace is a separate parameter and the key does not need
63
+ * to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.
64
+ * @param namespace - the namespace that identifies the particular localization file that contains the property.
65
+ * @param key - the key that matches a property in the JSON localization file.
66
+ * @returns The string corresponding to the first key that resolves.
67
+ * @throws Error if no keys resolve to a string.
68
+ * @internal
69
+ */
70
+ getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string;
71
+ /** Gets the English translation.
72
+ * @param namespace - the namespace that identifies the particular localization file that contains the property.
73
+ * @param key - the key that matches a property in the JSON localization file.
74
+ * @returns The string corresponding to the first key that resolves.
75
+ * @throws Error if no keys resolve to a string.
76
+ * @internal
77
+ */
78
+ getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string;
79
+ /** Get the promise for an already registered Namespace.
80
+ * @param name - the name of the namespace
81
+ * @public
82
+ */
83
+ getNamespacePromise(name: string): Promise<void> | undefined;
84
+ /** @internal */
85
+ getLanguageList(): readonly string[];
86
+ /** override the language detected in the browser */
87
+ changeLanguage(language: string): Promise<void>;
88
+ /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
89
+ * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
90
+ * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
91
+ * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
92
+ * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
93
+ * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
94
+ * @public
95
+ */
96
+ registerNamespace(name: string): Promise<void>;
97
+ /** @internal */
98
+ unregisterNamespace(name: string): void;
99
+ }
100
100
  //# sourceMappingURL=ITwinLocalization.d.ts.map