@aws-amplify/core 6.0.1-console-preview.0bbe168.0 → 6.0.1-console-preview.4b7d177.0
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/lib/I18n/I18n.d.ts +2 -18
- package/lib/I18n/I18n.js +5 -20
- package/lib/I18n/index.d.ts +2 -14
- package/lib/I18n/index.js +0 -12
- package/lib/I18n/types.d.ts +1 -4
- package/lib/I18n/types.js +5 -8
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/singleton/types.d.ts +2 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/I18n/I18n.d.ts +2 -18
- package/lib-esm/I18n/I18n.js +5 -20
- package/lib-esm/I18n/index.d.ts +2 -14
- package/lib-esm/I18n/index.js +0 -12
- package/lib-esm/I18n/types.d.ts +1 -4
- package/lib-esm/I18n/types.js +4 -7
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/singleton/types.d.ts +2 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/I18n/I18n.ts +4 -20
- package/src/I18n/index.ts +2 -14
- package/src/I18n/types.ts +1 -4
- package/src/Platform/version.ts +1 -1
- package/src/singleton/types.ts +2 -1
package/lib/I18n/I18n.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18nConfig } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Language translation utility.
|
|
4
|
-
*
|
|
5
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
6
4
|
*/
|
|
7
5
|
export declare class I18n {
|
|
8
6
|
/**
|
|
9
7
|
* @private
|
|
10
8
|
*/
|
|
11
|
-
_options:
|
|
9
|
+
_options: I18nConfig | null;
|
|
12
10
|
/**
|
|
13
11
|
* @private
|
|
14
12
|
*/
|
|
@@ -21,22 +19,16 @@ export declare class I18n {
|
|
|
21
19
|
* @constructor
|
|
22
20
|
* Initialize with configurations
|
|
23
21
|
* @param {Object} options
|
|
24
|
-
*
|
|
25
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
26
22
|
*/
|
|
27
23
|
constructor();
|
|
28
24
|
/**
|
|
29
25
|
* Sets the default language from the configuration when required.
|
|
30
|
-
*
|
|
31
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
32
26
|
*/
|
|
33
27
|
setDefaultLanguage(): void;
|
|
34
28
|
/**
|
|
35
29
|
* @method
|
|
36
30
|
* Explicitly setting language
|
|
37
31
|
* @param {String} lang
|
|
38
|
-
*
|
|
39
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
40
32
|
*/
|
|
41
33
|
setLanguage(lang: string): void;
|
|
42
34
|
/**
|
|
@@ -44,8 +36,6 @@ export declare class I18n {
|
|
|
44
36
|
* Get value
|
|
45
37
|
* @param {String} key
|
|
46
38
|
* @param {String} defVal - Default value
|
|
47
|
-
*
|
|
48
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
49
39
|
*/
|
|
50
40
|
get(key: string, defVal?: string | undefined): any;
|
|
51
41
|
/**
|
|
@@ -54,8 +44,6 @@ export declare class I18n {
|
|
|
54
44
|
* @param {String} key
|
|
55
45
|
* @param {String} language - Specified langurage to be used
|
|
56
46
|
* @param {String} defVal - Default value
|
|
57
|
-
*
|
|
58
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
59
47
|
*/
|
|
60
48
|
getByLanguage(key: string, language: string, defVal?: string | null): any;
|
|
61
49
|
/**
|
|
@@ -63,8 +51,6 @@ export declare class I18n {
|
|
|
63
51
|
* Add vocabularies for one language
|
|
64
52
|
* @param {String} language - Language of the dictionary
|
|
65
53
|
* @param {Object} vocabularies - Object that has key-value as dictionary entry
|
|
66
|
-
*
|
|
67
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
68
54
|
*/
|
|
69
55
|
putVocabulariesForLanguage(language: string, vocabularies: Record<string, any>): void;
|
|
70
56
|
/**
|
|
@@ -72,8 +58,6 @@ export declare class I18n {
|
|
|
72
58
|
* Add vocabularies for one language
|
|
73
59
|
* @param {Object} vocabularies - Object that has language as key,
|
|
74
60
|
* vocabularies of each language as value
|
|
75
|
-
*
|
|
76
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
77
61
|
*/
|
|
78
62
|
putVocabularies(vocabularies: Record<string, any>): void;
|
|
79
63
|
}
|
package/lib/I18n/I18n.js
CHANGED
|
@@ -15,19 +15,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.I18n = void 0;
|
|
17
17
|
var Logger_1 = require("../Logger");
|
|
18
|
+
var singleton_1 = require("../singleton");
|
|
18
19
|
var logger = new Logger_1.ConsoleLogger('I18n');
|
|
19
20
|
/**
|
|
20
21
|
* Language translation utility.
|
|
21
|
-
*
|
|
22
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
23
22
|
*/
|
|
24
23
|
var I18n = /** @class */ (function () {
|
|
25
24
|
/**
|
|
26
25
|
* @constructor
|
|
27
26
|
* Initialize with configurations
|
|
28
27
|
* @param {Object} options
|
|
29
|
-
*
|
|
30
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
31
28
|
*/
|
|
32
29
|
function I18n() {
|
|
33
30
|
/**
|
|
@@ -45,14 +42,12 @@ var I18n = /** @class */ (function () {
|
|
|
45
42
|
}
|
|
46
43
|
/**
|
|
47
44
|
* Sets the default language from the configuration when required.
|
|
48
|
-
*
|
|
49
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
50
45
|
*/
|
|
51
46
|
I18n.prototype.setDefaultLanguage = function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this._lang = i18nConfig
|
|
55
|
-
}
|
|
47
|
+
if (!this._lang) {
|
|
48
|
+
var i18nConfig = singleton_1.Amplify.getConfig().I18n;
|
|
49
|
+
this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
|
|
50
|
+
}
|
|
56
51
|
// Default to window language if not set in config
|
|
57
52
|
if (!this._lang &&
|
|
58
53
|
typeof window !== 'undefined' &&
|
|
@@ -66,8 +61,6 @@ var I18n = /** @class */ (function () {
|
|
|
66
61
|
* @method
|
|
67
62
|
* Explicitly setting language
|
|
68
63
|
* @param {String} lang
|
|
69
|
-
*
|
|
70
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
71
64
|
*/
|
|
72
65
|
I18n.prototype.setLanguage = function (lang) {
|
|
73
66
|
this._lang = lang;
|
|
@@ -77,8 +70,6 @@ var I18n = /** @class */ (function () {
|
|
|
77
70
|
* Get value
|
|
78
71
|
* @param {String} key
|
|
79
72
|
* @param {String} defVal - Default value
|
|
80
|
-
*
|
|
81
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
82
73
|
*/
|
|
83
74
|
I18n.prototype.get = function (key, defVal) {
|
|
84
75
|
if (defVal === void 0) { defVal = undefined; }
|
|
@@ -104,8 +95,6 @@ var I18n = /** @class */ (function () {
|
|
|
104
95
|
* @param {String} key
|
|
105
96
|
* @param {String} language - Specified langurage to be used
|
|
106
97
|
* @param {String} defVal - Default value
|
|
107
|
-
*
|
|
108
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
109
98
|
*/
|
|
110
99
|
I18n.prototype.getByLanguage = function (key, language, defVal) {
|
|
111
100
|
if (defVal === void 0) { defVal = null; }
|
|
@@ -123,8 +112,6 @@ var I18n = /** @class */ (function () {
|
|
|
123
112
|
* Add vocabularies for one language
|
|
124
113
|
* @param {String} language - Language of the dictionary
|
|
125
114
|
* @param {Object} vocabularies - Object that has key-value as dictionary entry
|
|
126
|
-
*
|
|
127
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
128
115
|
*/
|
|
129
116
|
I18n.prototype.putVocabulariesForLanguage = function (language, vocabularies) {
|
|
130
117
|
var lang_dict = this._dict[language];
|
|
@@ -138,8 +125,6 @@ var I18n = /** @class */ (function () {
|
|
|
138
125
|
* Add vocabularies for one language
|
|
139
126
|
* @param {Object} vocabularies - Object that has language as key,
|
|
140
127
|
* vocabularies of each language as value
|
|
141
|
-
*
|
|
142
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
143
128
|
*/
|
|
144
129
|
I18n.prototype.putVocabularies = function (vocabularies) {
|
|
145
130
|
var _this = this;
|
package/lib/I18n/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18nConfig } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Export I18n APIs
|
|
4
|
-
*
|
|
5
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
6
4
|
*/
|
|
7
5
|
export declare class I18n {
|
|
8
6
|
/**
|
|
@@ -11,22 +9,18 @@ export declare class I18n {
|
|
|
11
9
|
* Configure I18n part
|
|
12
10
|
* @param {Object} config - Configuration of the I18n
|
|
13
11
|
*/
|
|
14
|
-
static configure(config: Record<string, any>):
|
|
12
|
+
static configure(config: Record<string, any>): I18nConfig;
|
|
15
13
|
static getModuleName(): string;
|
|
16
14
|
/**
|
|
17
15
|
* @static
|
|
18
16
|
* @method
|
|
19
17
|
* Create an instance of I18n for the library
|
|
20
|
-
*
|
|
21
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
22
18
|
*/
|
|
23
19
|
static createInstance(): void;
|
|
24
20
|
/**
|
|
25
21
|
* @static @method
|
|
26
22
|
* Explicitly setting language
|
|
27
23
|
* @param {String} lang
|
|
28
|
-
*
|
|
29
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
30
24
|
*/
|
|
31
25
|
static setLanguage(lang: string): void;
|
|
32
26
|
/**
|
|
@@ -34,8 +28,6 @@ export declare class I18n {
|
|
|
34
28
|
* Get value
|
|
35
29
|
* @param {String} key
|
|
36
30
|
* @param {String} defVal - Default value
|
|
37
|
-
*
|
|
38
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
39
31
|
*/
|
|
40
32
|
static get(key: string, defVal?: string): any;
|
|
41
33
|
/**
|
|
@@ -44,8 +36,6 @@ export declare class I18n {
|
|
|
44
36
|
* Add vocabularies for one language
|
|
45
37
|
* @param {String} langurage - Language of the dictionary
|
|
46
38
|
* @param {Object} vocabularies - Object that has key-value as dictionary entry
|
|
47
|
-
*
|
|
48
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
49
39
|
*/
|
|
50
40
|
static putVocabulariesForLanguage(language: string, vocabularies: Record<string, string>): void;
|
|
51
41
|
/**
|
|
@@ -54,8 +44,6 @@ export declare class I18n {
|
|
|
54
44
|
* Add vocabularies for one language
|
|
55
45
|
* @param {Object} vocabularies - Object that has language as key,
|
|
56
46
|
* vocabularies of each language as value
|
|
57
|
-
*
|
|
58
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
59
47
|
*/
|
|
60
48
|
static putVocabularies(vocabularies: Record<string, string>): void;
|
|
61
49
|
static checkConfig(): boolean;
|
package/lib/I18n/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var _config = { language: null };
|
|
|
11
11
|
var _i18n = null;
|
|
12
12
|
/**
|
|
13
13
|
* Export I18n APIs
|
|
14
|
-
*
|
|
15
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
16
14
|
*/
|
|
17
15
|
var I18n = /** @class */ (function () {
|
|
18
16
|
function I18n() {
|
|
@@ -39,8 +37,6 @@ var I18n = /** @class */ (function () {
|
|
|
39
37
|
* @static
|
|
40
38
|
* @method
|
|
41
39
|
* Create an instance of I18n for the library
|
|
42
|
-
*
|
|
43
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
44
40
|
*/
|
|
45
41
|
I18n.createInstance = function () {
|
|
46
42
|
logger.debug('create I18n instance');
|
|
@@ -53,8 +49,6 @@ var I18n = /** @class */ (function () {
|
|
|
53
49
|
* @static @method
|
|
54
50
|
* Explicitly setting language
|
|
55
51
|
* @param {String} lang
|
|
56
|
-
*
|
|
57
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
58
52
|
*/
|
|
59
53
|
I18n.setLanguage = function (lang) {
|
|
60
54
|
I18n.checkConfig();
|
|
@@ -66,8 +60,6 @@ var I18n = /** @class */ (function () {
|
|
|
66
60
|
* Get value
|
|
67
61
|
* @param {String} key
|
|
68
62
|
* @param {String} defVal - Default value
|
|
69
|
-
*
|
|
70
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
71
63
|
*/
|
|
72
64
|
I18n.get = function (key, defVal) {
|
|
73
65
|
if (!I18n.checkConfig()) {
|
|
@@ -82,8 +74,6 @@ var I18n = /** @class */ (function () {
|
|
|
82
74
|
* Add vocabularies for one language
|
|
83
75
|
* @param {String} langurage - Language of the dictionary
|
|
84
76
|
* @param {Object} vocabularies - Object that has key-value as dictionary entry
|
|
85
|
-
*
|
|
86
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
87
77
|
*/
|
|
88
78
|
I18n.putVocabulariesForLanguage = function (language, vocabularies) {
|
|
89
79
|
I18n.checkConfig();
|
|
@@ -96,8 +86,6 @@ var I18n = /** @class */ (function () {
|
|
|
96
86
|
* Add vocabularies for one language
|
|
97
87
|
* @param {Object} vocabularies - Object that has language as key,
|
|
98
88
|
* vocabularies of each language as value
|
|
99
|
-
*
|
|
100
|
-
* @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
|
|
101
89
|
*/
|
|
102
90
|
I18n.putVocabularies = function (vocabularies) {
|
|
103
91
|
I18n.checkConfig();
|
package/lib/I18n/types.d.ts
CHANGED
package/lib/I18n/types.js
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
var I18nOptions = /** @class */ (function () {
|
|
10
|
-
function I18nOptions() {
|
|
5
|
+
exports.I18nConfig = void 0;
|
|
6
|
+
var I18nConfig = /** @class */ (function () {
|
|
7
|
+
function I18nConfig() {
|
|
11
8
|
this.language = null;
|
|
12
9
|
}
|
|
13
|
-
return
|
|
10
|
+
return I18nConfig;
|
|
14
11
|
}());
|
|
15
|
-
exports.
|
|
12
|
+
exports.I18nConfig = I18nConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.4b7d177.0+4b7d177";
|
package/lib/Platform/version.js
CHANGED
package/lib/singleton/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AnalyticsConfig } from './Analytics/types';
|
|
|
3
3
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
4
4
|
import { GeoConfig } from './Geo/types';
|
|
5
5
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
6
|
+
import { I18nConfig } from '../I18n/types';
|
|
6
7
|
export type LegacyConfig = {
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated The field should not be used.
|
|
@@ -13,6 +14,7 @@ export type ResourcesConfig = {
|
|
|
13
14
|
API?: APIConfig;
|
|
14
15
|
Analytics?: AnalyticsConfig;
|
|
15
16
|
Auth?: AuthConfig;
|
|
17
|
+
I18n?: I18nConfig;
|
|
16
18
|
Storage?: StorageConfig;
|
|
17
19
|
Geo?: GeoConfig;
|
|
18
20
|
};
|