@enonic-types/lib-i18n 7.16.2 → 8.0.0-A2

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.
Files changed (2) hide show
  1. package/i18n.d.ts +8 -8
  2. package/package.json +2 -2
package/i18n.d.ts CHANGED
@@ -9,7 +9,7 @@ export interface LocalizeParams {
9
9
  locale?: string | string[];
10
10
  values?: string[];
11
11
  bundles?: string[];
12
- application?: string;
12
+ fallbackMessage?: string;
13
13
  }
14
14
  /**
15
15
  * Internationalization functions.
@@ -28,29 +28,29 @@ export interface LocalizeParams {
28
28
  * @param {string} params.key The property key.
29
29
  * @param {string|string[]} [params.locale] A string-representation of a locale, or an array of locales in preferred order. If the locale is not set, the site language is used.
30
30
  * @param {string[]} [params.values] Optional placeholder values.
31
- * @param {string[]} [params.bundles] Optional list of bundle names.
32
- * @param {string} [params.application] Application key where to find resource bundles. Defaults to current application.
31
+ * @param {string[]} [params.bundles] Optional list of message bundle names.
32
+ * @param {string} [params.fallbackMessage] Optional fallback message to use if the phrase is not found. Default is "NOT_TRANSLATED".
33
33
  *
34
- * @returns {string} The localized string.
34
+ * @returns {string} The localized string, or a fallback message if the phrase is not found.
35
35
  */
36
36
  export declare function localize(params: LocalizeParams): string;
37
37
  /**
38
38
  * This function returns all phrases for the given locale and bundles.
39
39
  *
40
40
  * @param {string|string[]} locale A string-representation of a locale, or an array of locales in preferred order.
41
- * @param {string[]} bundles List of bundle names. Bundle names are specified as paths, relative to the `src/main/resources` folder.
41
+ * @param {string[]} [bundles] Optional list of message bundle names.
42
42
  *
43
43
  * @returns {object} An object of all phrases.
44
44
  *
45
45
  * @example
46
46
  * i18nLib.getPhrases('en', ['i18n/phrases'])
47
47
  */
48
- export declare function getPhrases(locale: string | string[], bundles: string[]): Record<string, string>;
48
+ export declare function getPhrases(locale: string | string[], bundles?: string[]): Record<string, string>;
49
49
  /**
50
50
  * This function returns the list of supported locale codes for the specified bundles.
51
51
  *
52
- * @param {string[]} bundles List of bundle names.
52
+ * @param {string[]} [bundles] Optional list of message bundle names.
53
53
  *
54
54
  * @returns {string[]} A list of supported locale codes for the specified bundles.
55
55
  */
56
- export declare function getSupportedLocales(bundles: string[]): string[];
56
+ export declare function getSupportedLocales(bundles?: string[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-i18n",
3
- "version": "7.16.2",
3
+ "version": "8.0.0-A2",
4
4
  "description": "Type definitions for lib-i18n.",
5
5
  "types": "i18n.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
29
  "dependencies": {
30
- "@enonic-types/core": "7.16.2"
30
+ "@enonic-types/core": "8.0.0-A2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"