@discord/intl 0.10.2 → 0.10.3-canary.2d9f45f
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/dist/intl-manager.d.ts +1 -1
- package/dist/intl-manager.js +2 -2
- package/dist/message-loader.js +2 -1
- package/package.json +7 -13
- package/src/intl-manager.ts +2 -2
- package/src/message-loader.ts +2 -1
package/dist/intl-manager.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class IntlManager {
|
|
|
20
20
|
intl: IntlShape;
|
|
21
21
|
formatConfig: FormatConfig;
|
|
22
22
|
_localeSubscriptions: Set<(locale: string) => void>;
|
|
23
|
-
constructor(defaultLocale?: string);
|
|
23
|
+
constructor(initialLocale?: string, defaultLocale?: string);
|
|
24
24
|
/**
|
|
25
25
|
* Add a set of formatter implementations to this manager, making each available as a direct
|
|
26
26
|
* property
|
package/dist/intl-manager.js
CHANGED
|
@@ -10,7 +10,7 @@ const format_config_1 = require("./format-config");
|
|
|
10
10
|
*/
|
|
11
11
|
exports.DEFAULT_LOCALE = 'en-US';
|
|
12
12
|
class IntlManager {
|
|
13
|
-
constructor(defaultLocale = exports.DEFAULT_LOCALE) {
|
|
13
|
+
constructor(initialLocale = exports.DEFAULT_LOCALE, defaultLocale = exports.DEFAULT_LOCALE) {
|
|
14
14
|
/**
|
|
15
15
|
* Subscribe to changes in the current locale for this manager.
|
|
16
16
|
*/
|
|
@@ -18,8 +18,8 @@ class IntlManager {
|
|
|
18
18
|
this._localeSubscriptions.add(callback);
|
|
19
19
|
return () => this._localeSubscriptions.delete(callback);
|
|
20
20
|
};
|
|
21
|
+
this.currentLocale = initialLocale;
|
|
21
22
|
this.defaultLocale = defaultLocale;
|
|
22
|
-
this.currentLocale = defaultLocale;
|
|
23
23
|
this.formatConfig = format_config_1.DEFAULT_FORMAT_CONFIG;
|
|
24
24
|
this.intl = (0, intl_1.createIntl)({
|
|
25
25
|
formats: format_config_1.DEFAULT_FORMAT_CONFIG,
|
package/dist/message-loader.js
CHANGED
|
@@ -24,7 +24,8 @@ class MessageLoader {
|
|
|
24
24
|
this._localeLoadingPromises = {};
|
|
25
25
|
this._parseCache = {};
|
|
26
26
|
this._subscribers = new Set();
|
|
27
|
-
this.
|
|
27
|
+
// TODO: Bring this back as an option to pre-load the locale.
|
|
28
|
+
// this._loadLocale(this.defaultLocale);
|
|
28
29
|
this.fallbackMessage = new message_1.InternalIntlMessage([], this.defaultLocale);
|
|
29
30
|
// In cases where hot module replacement is available, set up cache clearing whenever the
|
|
30
31
|
// targets change so that values are always replaced.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/intl",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3-canary.2d9f45f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client runtime for managing messages and translations in a React project.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,12 +14,16 @@
|
|
|
14
14
|
"dist",
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/discord/discord-intl"
|
|
20
|
+
},
|
|
17
21
|
"dependencies": {
|
|
18
22
|
"@formatjs/icu-skeleton-parser": "1.8.2",
|
|
19
23
|
"@formatjs/intl": "^2.10.1",
|
|
20
24
|
"@intrnl/xxhash64": "^0.1.2",
|
|
21
25
|
"intl-messageformat": "^10.5.11",
|
|
22
|
-
"@discord/intl-ast": "0.10.
|
|
26
|
+
"@discord/intl-ast": "0.10.3"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
29
|
"@swc/cli": "^0.3.12",
|
|
@@ -27,17 +31,7 @@
|
|
|
27
31
|
"typescript": "*"
|
|
28
32
|
},
|
|
29
33
|
"peerDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"react": "> 16",
|
|
32
|
-
"webpack": "^5.0.0"
|
|
33
|
-
},
|
|
34
|
-
"peerDependenciesMeta": {
|
|
35
|
-
"@rspack/core": {
|
|
36
|
-
"optional": true
|
|
37
|
-
},
|
|
38
|
-
"webpack": {
|
|
39
|
-
"optional": true
|
|
40
|
-
}
|
|
34
|
+
"react": "> 16"
|
|
41
35
|
},
|
|
42
36
|
"scripts": {
|
|
43
37
|
"build": "tsc",
|
package/src/intl-manager.ts
CHANGED
|
@@ -45,9 +45,9 @@ export class IntlManager {
|
|
|
45
45
|
|
|
46
46
|
_localeSubscriptions: Set<(locale: string) => void>;
|
|
47
47
|
|
|
48
|
-
constructor(defaultLocale: string = DEFAULT_LOCALE) {
|
|
48
|
+
constructor(initialLocale: string = DEFAULT_LOCALE, defaultLocale: string = DEFAULT_LOCALE) {
|
|
49
|
+
this.currentLocale = initialLocale;
|
|
49
50
|
this.defaultLocale = defaultLocale;
|
|
50
|
-
this.currentLocale = defaultLocale;
|
|
51
51
|
this.formatConfig = DEFAULT_FORMAT_CONFIG;
|
|
52
52
|
this.intl = createIntl({
|
|
53
53
|
formats: DEFAULT_FORMAT_CONFIG,
|
package/src/message-loader.ts
CHANGED
|
@@ -96,7 +96,8 @@ export class MessageLoader {
|
|
|
96
96
|
this._parseCache = {};
|
|
97
97
|
this._subscribers = new Set();
|
|
98
98
|
|
|
99
|
-
this.
|
|
99
|
+
// TODO: Bring this back as an option to pre-load the locale.
|
|
100
|
+
// this._loadLocale(this.defaultLocale);
|
|
100
101
|
this.fallbackMessage = new InternalIntlMessage([], this.defaultLocale);
|
|
101
102
|
|
|
102
103
|
// In cases where hot module replacement is available, set up cache clearing whenever the
|