@enonic-types/lib-i18n 0.1.0 → 7.11.0-B1
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/i18n.d.ts +55 -55
- package/package.json +1 -5
package/i18n.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface XpLibraries {
|
|
3
|
-
'/lib/xp/i18n': typeof import('./i18n');
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
export interface LocalizeParams {
|
|
7
|
-
key: string;
|
|
8
|
-
locale?: string | string[];
|
|
9
|
-
values?: string[];
|
|
10
|
-
bundles?: string[];
|
|
11
|
-
application?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Internationalization functions.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* var i18nLib = require('/lib/xp/i18n');
|
|
18
|
-
*
|
|
19
|
-
* @module i18n
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* This function localizes a phrase.
|
|
23
|
-
*
|
|
24
|
-
* @example-ref examples/i18n/localize.js
|
|
25
|
-
*
|
|
26
|
-
* @param {object} params JSON with the parameters.
|
|
27
|
-
* @param {string} params.key The property key.
|
|
28
|
-
* @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.
|
|
29
|
-
* @param {string[]} [params.values] Optional placeholder values.
|
|
30
|
-
* @param {string[]} [params.bundles] Optional list of bundle names.
|
|
31
|
-
* @param {string} [params.application] Application key where to find resource bundles. Defaults to current application.
|
|
32
|
-
*
|
|
33
|
-
* @returns {string} The localized string.
|
|
34
|
-
*/
|
|
35
|
-
export declare function localize(params: LocalizeParams): string;
|
|
36
|
-
/**
|
|
37
|
-
* This function returns all phrases for the given locale and bundles.
|
|
38
|
-
*
|
|
39
|
-
* @param {string|string[]} locale A string-representation of a locale, or an array of locales in preferred order.
|
|
40
|
-
* @param {string[]} bundles List of bundle names. Bundle names are specified as paths, relative to the `src/main/resources` folder.
|
|
41
|
-
*
|
|
42
|
-
* @returns {object} An object of all phrases.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* i18nLib.getPhrases('en', ['i18n/phrases'])
|
|
46
|
-
*/
|
|
47
|
-
export declare function getPhrases(locale: string | string[], bundles: string[]): Record<string, string>;
|
|
48
|
-
/**
|
|
49
|
-
* This function returns the list of supported locale codes for the specified bundles.
|
|
50
|
-
*
|
|
51
|
-
* @param {string[]} bundles List of bundle names.
|
|
52
|
-
*
|
|
53
|
-
* @returns {string[]} A list of supported locale codes for the specified bundles.
|
|
54
|
-
*/
|
|
55
|
-
export declare function getSupportedLocales(bundles: string[]): string[];
|
|
1
|
+
declare global {
|
|
2
|
+
interface XpLibraries {
|
|
3
|
+
'/lib/xp/i18n': typeof import('./i18n');
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizeParams {
|
|
7
|
+
key: string;
|
|
8
|
+
locale?: string | string[];
|
|
9
|
+
values?: string[];
|
|
10
|
+
bundles?: string[];
|
|
11
|
+
application?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internationalization functions.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* var i18nLib = require('/lib/xp/i18n');
|
|
18
|
+
*
|
|
19
|
+
* @module i18n
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* This function localizes a phrase.
|
|
23
|
+
*
|
|
24
|
+
* @example-ref examples/i18n/localize.js
|
|
25
|
+
*
|
|
26
|
+
* @param {object} params JSON with the parameters.
|
|
27
|
+
* @param {string} params.key The property key.
|
|
28
|
+
* @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.
|
|
29
|
+
* @param {string[]} [params.values] Optional placeholder values.
|
|
30
|
+
* @param {string[]} [params.bundles] Optional list of bundle names.
|
|
31
|
+
* @param {string} [params.application] Application key where to find resource bundles. Defaults to current application.
|
|
32
|
+
*
|
|
33
|
+
* @returns {string} The localized string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function localize(params: LocalizeParams): string;
|
|
36
|
+
/**
|
|
37
|
+
* This function returns all phrases for the given locale and bundles.
|
|
38
|
+
*
|
|
39
|
+
* @param {string|string[]} locale A string-representation of a locale, or an array of locales in preferred order.
|
|
40
|
+
* @param {string[]} bundles List of bundle names. Bundle names are specified as paths, relative to the `src/main/resources` folder.
|
|
41
|
+
*
|
|
42
|
+
* @returns {object} An object of all phrases.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* i18nLib.getPhrases('en', ['i18n/phrases'])
|
|
46
|
+
*/
|
|
47
|
+
export declare function getPhrases(locale: string | string[], bundles: string[]): Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* This function returns the list of supported locale codes for the specified bundles.
|
|
50
|
+
*
|
|
51
|
+
* @param {string[]} bundles List of bundle names.
|
|
52
|
+
*
|
|
53
|
+
* @returns {string[]} A list of supported locale codes for the specified bundles.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getSupportedLocales(bundles: string[]): string[];
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.11.0-B1",
|
|
4
4
|
"description": "Type definitions for lib-i18n.",
|
|
5
5
|
"types": "i18n.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"i18n.d.ts"
|
|
8
8
|
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"pre": "npm run --prefix ../ pre",
|
|
11
|
-
"packlist": "npx npm-packlist"
|
|
12
|
-
},
|
|
13
9
|
"repository": {
|
|
14
10
|
"type": "git",
|
|
15
11
|
"url": "git+https://github.com/enonic/xp.git#master"
|